Resetting Microcontroller when rellay turned ON.

Go To Last Post
35 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi...

 

I designed a circuit for control AC Bulb throgh bluetooth. but the problem is, when the rellay turned on with load, Device is restarting(microccontroller reseting). 

 

in my design, i already connected diode across relay coil and also 104 capacitor is connected across microcontroller Vcc & Gnd pin. 

 

There is no problem when no load is connected to relay. and also try with 0.5W LED bulb, and the device works perfectly. But when i connect a 9W bulb, the controller reset when relay turned on.

 

i check internet about this problem and everyone says add diode across relay coil. but, its already added in my design.

 

please help me to rectify my problem. 

 

 

 

NB: iam using 24 V relay. and supply it with 24 V power supply. then convert it with regulator and provide 5v to controller.

      

 

 

 

Thank you

-Aju Remesh

 

Thank you

 

-Aju Remesh

 

This topic has a solution.

Aju Remesh

Last Edited: Fri. Jul 2, 2021 - 11:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ajuremesh007 wrote:

NB: iam using 24 V relay. and supply it with 24 V power supply. then convert it with regulator and provide 5v to controller.

 

Schematic and photo of setup please.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i tried many times to add image to this page. but there is some error..

Aju Remesh

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ajuremesh007 wrote:
i tried many times to add image to this page. but there is some error..

Right click copy the image, paste (ctrl-V) in text field where you type the post. It will show up.

 

 

“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?” - Brian W. Kernighan
“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint-Exupery

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ajuremesh007 wrote:
i tried many times to add image to this page. but there is some error..
 

You mean this: https://www.avrfreaks.net/forum/media-browser-you-are-not-authorized-access-page ?

 

As  Heisen said, you should still be able to copy & paste images.

failing that, attachments still work.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ajuremesh007 wrote:
when the rellay turned on with load, Device is restarting(microccontroller reseting). 

this is usually because the "sudden" application of the load causes your supply voltage to "droop"

 

There is no problem when no load is connected to relay. and also try with 0.5W LED bulb, and the device works perfectly. But when i connect a 9W bulb, the controller reset when relay turned on.

indeed sounds like your 24V supply (and/or its wiring) is too "weak". Note that the ground connection is as important as the supply ...

 

Do you have an oscilloscope to see what's happening?

 

Please give details of your power supply & wiring and, as Brian said, your schematic & photos of the setup. 

 

ADDENDUM

 

a 9W bulb

What type of bulb?

 

Remember that incandescent filament bulbs draw many times more current when cold that their steady-state value ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Mon. Jun 14, 2021 - 11:12 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Aju Remesh

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thank you..

Aju Remesh

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i mean, i drive relay using 24 v dc. the load is 230v AC.

 

i tried 0.5W & 9W 230v LED Bulb. 0.5w LED Bulb works perfectly. but, uc reset when 9W LED connected to relay

Aju Remesh

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you have an O'scope then look at Vin to the voltage regulator.

As mentioned above, it is likely falling, briefly, when the load turns on.

 

You can put a large cap in parallel to C3, (the input to the voltage regulator), perhaps 220 uF.

 

The KIA 7805 data sheet doesn't mention a maximum Cinput cap.

It is not usually a problem, but it is nice when the data sheet specifically says you can make it as high as you want.

 

You can also provide a "protected" supply to the micro, that won't drop when the Vsupply drops, (glitches low).

You can feed your V+ through a diode, to a cap to Ground.

The voltage after the diode is used to power the micro.

The cap can be 10 or 20 uF, for example.

 

Now when the supply drops, briefly, the micro runs on the cap.

the diode keeps the cap from trying to back feed power into the power supply or to the reset of the circuit.

 

The down side of this is that the micro runs at a slightly lower supply voltage due to the V drop across the diode.

For your project that won't be an issue.

 

Not at the right computer to add a schematic.

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

is it possible to draw that changes for better understanding?

Aju Remesh

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Use isolation transformer for such project design and test.

Add standard High Voltage Warning to the picture before of publishing.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Arrrgggg!  Transformer-less power supply!  No wonder your having issues, not to mention a very dangerous circuit to connect a oscope, or programmer/pc too!  Keep one hand in your pocket at all times while troubleshooting.  You do not have enough power supply filtering to prevent 24v voltage sag when the relay/load are turned on, so your vcc voltage to the micro is dipping and causing a brown out reset.

C1 couples any high freq noise (due to rapid load changes) into your circuit causing voltage sags/spikes, an inherent characteristic of xformer-less power supply designs!!!

Making C3 330uF or larger may help.

Jim

 

Keys to wealth:

Invest for cash flow, not capital gains!

Wealth is attracted, not chased! 

Income is proportional to how many you serve!

If you want something you've never had...

...you must be willing to do something you've never done!

Lets go Brandon!

Last Edited: Mon. Jun 14, 2021 - 01:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Labeling AC1 and AC2 may be wrong in India, as your earthing system is probably similar to Eu, with Neutral grounded at the distribution point.
In Eu we have Live and Neutral. AC2 should be connected to Neutral power socket (and not directly, do use 100 ohm resistor for security).
You may answer the questions /and then we will know which one is L and N/:
-Voltage AC1-Ground
-Voltage AC2-Ground

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:
If you have an O'scope then look at Vin to the voltage regulator.

Stop - Nooooo! Don't do that.

 

Unless you have a scope with isolated inputs ($$$$) then probing a non-isolated supply (even a capacitive dropper type) is a recipe for bangs and explosions. (misleading results also)

 

Put away the current PSU and use a bench PSU for now until you get things working.

My money's on a Brownout reset or even a Power-On reset. Your 5V rail will almost certainly collapse when the filament bulb is connected.

 

Edit: I see it isn't a filament bulb but a 9W LED. This is 375mA although there may be some inrush, albeit infinitely less than with a filament bulb.

Edit2: Great schematic drawing skills by-the-way sad. It usual to place the Pin Number above the Pin Terminal not below. You get this correct on J2, but on U3 where it matters most, it's a disaster.

 

Also What is N76E003AT20 ?

 

Last Edited: Mon. Jun 14, 2021 - 03:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


N.Winterbottom wrote:
Also What is N76E003AT20 ?

Letting the smoke out since 1978

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
Keep one hand in your pocket at all times while troubleshooting.
Flashover can burn one's hand; might find a lineman's glove while walking alongside a road.

Circuit breakers and switches can flashover a "bit".

Also, consider probe tip covers [transparency (though a soldering iron tip) - don't forget to disconnect off-line power before diagnosis and repair]

ki0bk wrote:
C1 couples any high freq noise (due to rapid load changes) into your circuit causing voltage sags/spikes, an inherent characteristic of xformer-less power supply designs!!!

Alternatives add a switch to make the bulk capacitor's charge last longer (shunt, pass)

Another alternative is an off-line PMIC (relatively inexpensive, greatly reduced standby power, a lot of competition)

 


USB-ISO USB 2.0 Full Speed insulator passed all EMC tests in certified laboratory and now can bear CE mark! | olimex

 

lineman's gloves | McMaster-Carr

CT3654-8 Cal Test | Mouser (probe tip cover for integrated circuits)

CT3653-8 Cal Test | Mouser

CT3900B UL Listed DMM Probes & Accessories - Cal Test Electronics | Mouser

CT4422 Fused Probe DMM Electrical Kit - Cal Test Electronics | Mouser

 

SR10 Capacitor-Coupled, Switched Shunt, (CCSS) Regulator - Power Management - Inductorless Off-Line Regulator ICs (Microchip Technology)

SR087 Adjustable Off-line Inductorless Switching Regulator - Power Management - Inductorless Off-Line Regulator ICs (Microchip Technology)

Microchip | AC/DC Power Conversion

NCP10970: Dual output HV Buck Switcher | Products - ON Semiconductor (150mA)

AP3917D (Primary Side Regulation Switchers) (Diodes, 250mA approx)

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

N.Winterbottom wrote:
Unless you have a scope with isolated inputs ($$$$) then probing a non-isolated supply (even a capacitive dropper type) is a recipe for bangs and explosions. (misleading results also)
A somewhat common defect is mis-wiring neutral; otherwise, resistance and battery-powered instruments aid.

 

Protect Equipment with USB Isolators - B&B Electronics

Test Meters at Lowes.com (Receptacle Tester)

TEX250HV - DC to 250MHz X100 Higher Voltage Probe (Tyrosys, 1200V)

Oscilloscopes: Xminilab Portable (Gabotronics)

 

edit : new arrival

AC-DC Voltage & Receptacle Electrical Test Kit - Klein Tools | Mouser

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Tue. Jun 15, 2021 - 05:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hii.. Sorry for late reply..

 

For debug this error, i already remove the transformerless power supply section from my board and provide 24 V supply from an SMPS. and also provide direct 230v ac for 9W LED BULB. But the problem still there.

Aju Remesh

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you try other types of load, for example 40W solder iron.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ajuremesh007 wrote:
i already remove the transformerless power supply section from my board and provide 24 V supply from an SMPS

 

Well, if you have gone that far might as well try to power the MCU from a very clean power source like a battery (3 AAA or AA cells in series will be about 4.5V). Report after doing this if MCU resets or not.

 

Make sure all grounds are connected to each other and flyback diode is connected in right direction.

 

Also double check all your caps and resistor values.

 

Also post image of your setup / PCB. 

“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?” - Brian W. Kernighan
“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint-Exupery

Last Edited: Tue. Jun 15, 2021 - 06:25 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Heisen wrote:
and flyback diode is connected in right direction.
and directly across the relay coil terminals.

Ross McKenzie, Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

in #2, Brian Fairchild wrote:
Schematic and photo of setup please.

Still waiting for the photo(s) ...

 

And, now that you've got a proper power supply, have you used an oscilloscope to look at what's happening ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


How are you planning on getting power to your circuit?  The diode bridge is not connected to the AC input (prob from 24V transformer)

 

The power should go DIRECT to the full wave bridge , NOT through a 1 meg resistor or some little capacitor!

 

Also the regulator has essentially zero capacitance on the output...add a few uF, maybe 4.7, or 10

 

Make R9 1K, why starve it?? Give it at least a few ma!!!, Or use a small fet, then you don't even need the diode on the relay.

 

 

Is there a connection there?  Hard to say at a glance.   Why did you draw it as a 4-way? Use T connections and avoid ambiguity.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Tue. Jun 15, 2021 - 08:25 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
The diode bridge is not connected to the AC input (prob from 24V transformer)

Look again - it's connected direct to the 230V mains! surprise

 

(yes, I missed that at first)

 

But see #19:

ajuremesh007 wrote:
For debug this error, i already remove the transformerless power supply section from my board and provide 24 V supply from an SMPS.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

NB: iam using 24 V relay. and supply it with 24 V power supply. then convert it with regulator and provide 5v to controller.

So is this all coming from a standard 24V HVAC transformer?  

Look again - it's connected direct to the 230V mains! surprise

 

Hmmm...some clarity is needed...then I see he says is also connecting to 230v

 

Hopefully he isn't trying to use a transformerless design with a low voltage transformer input.

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The post title Resetting Microcontroller was promising, expected to deal with AVR, and instead it is totally different chip.

All other seems to be from SF horror story, going mad electronic, electocuted persons, fried scopes, stuff like that.

So I asked what will happen on 40W solder iron. Just to keep suspense going on.
At the times I am thinking to ask the Moderator to lock this all because of evident security violations.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

N.Winterbottom wrote:
Also What is N76E003AT20 ?

That was actually a rhetorical question but I guess that concept is hard to put across in a forum post.

 

ajuremesh007 wrote:
also 104 capacitor is connected across microcontroller Vcc & Gnd pin.

Not according to your schematic it isn't. N76E003AT20  won't be different to AVR in this respect. You MUST have decoupling immediately adjacent to the pins.

 

ajuremesh007 wrote:
For debug this error, i already remove the transformerless power supply section from my board and provide 24 V supply from an SMPS.

Then layout may be a problem for which a photo is essential for diagnosis. You must keep the lamp wiring both before & after the relay in a small loop area.

 

PS: You've already been asked for a photo; perhaps we should all shut up until a photo of the PCB & wiring appears.

 

Last Edited: Tue. Jun 15, 2021 - 10:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


ajuremesh007 wrote:
transformerless power supply

 

This meme seems to be doing the rounds at the moment; this version brought this thread to mind:

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wrong and dangerous scope handling, no wonder this person becomes evil one.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
Is there a connection there?  Hard to say at a glance.

 

Yup, a 4 WAY connection!!  Yippeee.  I saw it without issue.

 

If the circuit is powered up EXACTLY as shown in the schematic of Post #7, I can see why teh AVR resets.

 

The 330ohm resistor limits teh current to 24v/72ma at best.  I looked up the relay and the coil for that model has an 18ma coil current, but it says nothing about the inrush current.  Which I will bet is causing the 24vdc to drop at the input of the 7805 long enough for the 5v to sag, and the AVR resets.

 

As noted in #21 and #24 you might want to put a 10 or 100uF cap on the input of the 7805, and a 1uf on the output of the 7805.

 

 

And I completely agree with the others that if you intend on powering this direct from mains power as your schematic suggests, it is a recipe for disaster.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:

And I completely agree with the others that if you intend on powering this direct from mains power as your schematic suggests, it is a recipe for disaster.

Well, not really, almost... limited security on conditions that the ground wire is removed and the project is perfectly box-in to not cause what we expect to do.

 

There are similar construction (sells by Lidl), plug CEE 7/3 in-out /German invention, the funniest (yet obscure) plug in an electric history/, with a remote switch on/off for night-light and the relay that clicks inside, two large pushb. and a led.

Last Edited: Fri. Jun 18, 2021 - 02:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:

As noted in #21 and #24 you might want to put a 10 or 100uF cap on the input of the 7805

Not directly. Do use 1N4004 to separate 24V source from 100uF cap on 78L05 input.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

grohote wrote:
Not directly. Do use 1N4004 to separate 24V source from 100uF cap on 78L05 input.

 

You did not seem to have issue before, now you do?

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:

You did not seem to have issue before, now you do?

Right, I am sorry, I should do it before, because the separation on high voltage is better than on 5V:

I missed to do it on #10:

DocJC wrote:

You can also provide a "protected" supply to the micro, that won't drop when the Vsupply drops, (glitches low).

You can feed your V+ through a diode, to a cap to Ground.

The voltage after the diode is used to power the micro.

The cap can be 10 or 20 uF, for example.

Now when the supply drops, briefly, the micro runs on the cap.

the diode keeps the cap from trying to back feed power into the power supply or to the reset of the circuit.

The down side of this is that the micro runs at a slightly lower supply voltage due to the V drop across the diode.

For your project that won't be an issue.