Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Motor control with relays with PIC16F628A

Status
Not open for further replies.

thedezer

Newbie level 4
Joined
Apr 28, 2021
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
45
When I export the LM2576-5.0 to the PIC16F628A, the PIC16F628A becomes unusable. PIC hangs.
 

Attachments

  • B.PNG
    B.PNG
    34.2 KB · Views: 122
  • A.PNG
    A.PNG
    117.4 KB · Views: 135

Hi,

I see several issues:
* no power supply ceramics caps at the microcontroller and the ULNxxxx
* no RESET circuit at the microcontroller
* no snubber at the relay contacts
* maybe floating pins at the microcontroller

What I don´t see:
* PCB layout
* code, especially port setup, clock setup
* clock circuit
* exact capacitor type and inductor type for the LMxxx

Most often problem: No suitable PCB layout.

Klaus
 

Thanks for be interested.
* i used internal oscillator and turned off MCLR.
* The output of ULN did not need a collector anyway.
* I used a 100nF ceramic capacitor at the PIC supply input.
*I set up the circuit in the datasheet. I used a 100uF electrolyte capacitor at the input, and a 1000uF electrolyte capacitor at the output, its coil is 100uH.
 

Attachments

  • 3 MOTOR CONTROL.zip
    956.1 KB · Views: 92
Last edited:

Hi,

The fail is no surprise. The board is not suitable for switch mode power supply. I´d call it not suitable for a microcontroller, too.
It doesn´t mean that there is no chance to make it running.
What I mean: The behaviour is not predictable, not stable, not reliable.

* ULN: for sure you use the collectors.
* I don´t see a ceramics capacitor in your whole circuit. Neither in the schematic nor in the photo.
* There is more than "1000uF" or "100uH" of a capacitor/coil specification. Otherwise the datasheet would be very short ;-)
* usually it´s impossible to follow the layout guidelines on a strip board

I´m not familiar with PICs, but from your code I don´t see PortA to be defined at all. So I guess there are pins left floating.

Klaus
 

    thedezer

    Points: 2
    Helpful Answer Positive Rating
I have previously run for a motor with the 7805 IC, but I need to set up the stable circuit required for the LM2576. What kind of additions should I make in the power part?
 

Hi,

Read it´s datasheet and follow it´s guidelines - especially regarding part selection and PCB layout.

.. But still the remaining issues with the rest of the circuit.

I see no reliable operation on that strip board.

Klaus
 

    thedezer

    Points: 2
    Helpful Answer Positive Rating
If you have a scope, a DSO, set it up to one shot trigger on Vcc transient, say
1 V outside its rail. Also look at reset pin, ground bounce on the board, etc..
See if you can capture the transient to get some clues.

Not not all caps equal in ESR for same value cap, choose carefully. Look at bypass
recommendations of the micro as well.

1619608744478.png



Does micro ground meet motor grounds/relay current at board edge. I see no
ground buss, rather connections with a lot of parasitic L in them that create
transients. Micro bypassing, both ceramic and bulk at Vdd pin.

**broken link removed**


**broken link removed**

Regards, Dana.
 

    thedezer

    Points: 2
    Helpful Answer Positive Rating
Thanks for your help. Now only a 100nF ceramic capacitor is connected, will it be alright if I add it like in the photo?
 

Attachments

  • sda.jpg
    sda.jpg
    844.9 KB · Views: 99

Hi,

A schematic shows only that it is connected.
But for a real circuit it is important "how" it is connected.

General rule recommendation:
* Use a solid (really solid, no traces, no copper pour) GND plane (you don´t have)
* connect the microcontroller_gnd with very short connection to the GND plane
* place the capacitor close to microcontroller_vcc pin
* connect capacitor to microcontroller_VCC with very short trace
* connect the capacitor_gnd with very short connection to the GND plane

--> the same applies to every supply pin of every IC (also the ULNxxx)

Klaus
 
Last edited:

    thedezer

    Points: 2
    Helpful Answer Positive Rating
Please explain more about what you mean by the MCU "becomes unusable. PIC hangs"?
How do you know it 'hangs'? Is it even running?
Have you put a scope on the output pins to make sure they are switching correctly and at the required times and sequence?
The way you have written your code it is very susceptible to RMW failures.
Susan
 

thanks for your answer.
* When I tried to program the PIC16F628A, I said something like that because my PICKIT3 programmer did not see the microprocessor.
* I cannot find time to watch the transitions, as I give electricity, my microprocessor is broken.
 

So to be clear, you have NOT programmed the PIC MCU at all yet!
All of the above hardware-related comments still apply but until you can program the MCU then it is all just guesswork.
I suggest that you concentrate on getting the code to run and then connect the rest of the hardware - solve one problem at a time.
How are you connecting the PicKit3? I note that the MCLR line is shown as disconnected on your schematic (post #1) as are RB6 and RB7. Is the PicKit3 the only thing connected to these lines or are there other parts of the schematic missing?
What IDE are you using? MPLAB X? I assume so as you appear to be using the XC8 compiler.
Have you got the PicKit3 configured to use High-voltage programming (at least after the first programming of the MCU) as you have turned off LVP? (Personally I would not do that yet - you don't appear to be using RA5 [the same pin as \MCLR\] for anything so this just adds a complication as to when the code starts running.)
Are you disconnecting the PicKit3 after programming?
Are you compiling for debug or release?
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top