Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Mcu reset when I turn on relay.

Status
Not open for further replies.
Hi,

The reset happening even no motor connected to relay. When relay closes and opens.

Try placing a series diode that isolates the 10uF and 0.1uF MCU capacitors from the 100uF capacitor and connect the inductor coil on the anode side of the diode (so the inductor coil can only draw current from the 100uF capacitor and cannot draw current from the 10uF and 0.1uF capacitors).
.

Like this ?
What is the value if L?

15345029864501228265748.jpg


I have tried another code without using push button .the code print a message at the begining then turn relay on for 5 sec then turn it off for 5 sec . The pic reset once the relay turned on.somtimes no reset when the relay on but it reset once the relay become off.


I will try a separate power supply once I get another transformer or battery .


I tried a 1n4148 instead of 1n4007, the same problem occurred.

I am using bc547 npn and the following relay.

mGWWoJGmFKWWb5ZuT5-QuqQ.jpg


The power supply able to run the relay.

I tried to use led instead of the relay no problem occurred.


I am using solderless breadboard.


.

Additionally, as alec_t said in post 10, check your grounding scheme. The microcontroller circuitry can share a common ground connection to C7. But the emitter of Q1 must have it's own path to C7.

I can't understand this point :)
 
Oh, this is happening even when no motor is connected to the relay? Is the reset happening when the relay CLOSES? or OPENS? What relay are you using?

Did you try powering the relay off a separate supply like I asked?

Try placing a series diode that isolates the 10uF and 0.1uF MCU capacitors from the 100uF capacitor and connect the inductor coil on the anode side of the diode (so the inductor coil can only draw current from the 100uF capacitor and cannot draw current from the 10uF and 0.1uF capacitors).

I wonder if this issue could be caused because you are not debouncing your pushbutton. Write code for that too. You can check if the lack of debouncing causing the issue by writing a main program that just waits a bit, and then raises automatically D0 on it's own (no pushbutton) and see if it still happens.
Was gonna say this. Remove the button from the system, and just switch the relay on after a delay.

EDIT: I must've missed the post above - only saw after posting.
 
You could try adding ceramic caps in parallel with the electrolytics either side of the 7805.

Mike.
 
You don't need the L. Wire mcu on right side of diode and relay on left side.

I have tried another code without using push button .the code print a message at the begining then turn relay on for 5 sec then turn it off for 5 sec . The pic reset once the relay turned on.somtimes no reset when the relay on but it reset once the relay become off.
:)

This indicates you might have more than one problem, one of which might be debouncing. Debounce your button and isolate the relay supply.
 
Almost every time somebody says their circuit has a problem then it is built in a mess of wires all over the place on a solderless breadboard.
Many of the connections on a solderless breadboard are intermittent.
The stray capacitance between the rows of contacts and wires all over the place couple high frequencies.
Maybe the magnetic force in the relay coil couples a voltage into a few of the nearby wires all over the place.

If you use a properly laid out pcb then your circuit will probably work properly.
 
Hi,

Yeah it sounds like noise that resets the uC.
Alternately, if the relay draws a lot of current relative to the ESR of the power supply and that causes a momentary drop in supply voltage which of course then resets the CPU because it thinks power has been cut and then returned.
A cap across the power supply with one lead near the relay and the other near the ground of the transistor that drives the relay will help solve the reset problem if it is the current draw of the relay causing it.
 
Just an little extra bit of information that the TS has not provided. From the picture of the relay I looked on ebay to see if any of them gave the current or power of the coil. I eventualy found one that claimed that the coil power was 0.45 watts. So the current will be just under 100 mA.
I have been using a PIC16f877 in a camera switching unit for years driving 8 relays with no problems. This is the schematic.
Switcher.png


This is a picture of the construction. As you can see it is rather a rats nest with no special precautions about screening or supply decoupling. (The 100 nF supply decoupling capacitor is for the proccesor is mounted underneath it in the space between the sides of the socket).
IMG_0498 (Medium).JPG

Les.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top