-1
\$\begingroup\$

I have a micro-controller based project. I am using nrf51822 as the MCU.

there are two 12V relays in my project and they are used to switch 230V AC.

These relays are controlled by nrf51822. Currently the output is connected to the normally close pin of relay. When I switch on the relay using MCU which works fine. But when I switch off the relay the MCU will restart.

MCU says that the reason for restart is power failure.

How can I solve this issue?

this is the schematic for the setup enter image description here

Edit: i have added a 220uf/16v capacitor between the VCC and GND of nrf51822. the problem is solved. but not with a .1uf. is this is a correct solution for this............?

\$\endgroup\$
  • 2
    \$\begingroup\$ How do you control the relays? transistors? optocouplers? What is the power supply? Is is shared between relays and the nRF chip? Do you have enough decoupling capacitance? \$\endgroup\$ – filo Feb 21 '17 at 9:47
  • 1
    \$\begingroup\$ Do we assume (because you don't show a circuit) that you have protection diodes across the relay coil, that you have taken precautions to ensure that your relays do not pull current away from your device. The "switching off problem" indicates the lack of diodes. \$\endgroup\$ – JIm Dearden Feb 21 '17 at 10:34
  • 1
    \$\begingroup\$ It the diode across the coil fast enough? What diode are you using? Can you actually show us the relevant portions of your circuit, including all your power caps? \$\endgroup\$ – Scott Seidman Feb 21 '17 at 13:21
  • 2
    \$\begingroup\$ Please show schematic. \$\endgroup\$ – markrages Feb 21 '17 at 16:27
  • 2
    \$\begingroup\$ See also: PIC16F628A Resetting after relay turned off \$\endgroup\$ – Tut Feb 21 '17 at 16:32
1
\$\begingroup\$

i have added a 220uf/16v capacitor between the VCC and GND of nrf51822. the problem is solved. but not with a .1uf. is this is a correct solution for this............?

The nRF51 (and most micros for that matter) need to have decoupling on their power supply lines. You'll often find a big cap (10uF) in parallel with a much smaller cap (10nF or even smaller) to provide a reservoir or "tank" of energy. It smooths out the often heavy and fast power draws that micros are known to produce.

This question and answer can explain it far better than I can. What is a decoupling capacitor and how do I know if I need one?

Power supplies are slow...they take roughly 10 us to respond (i.e. bandwidth up to 100 kHz). So when your big, bad, multi-MHz microcontroller switches a bunch of outputs from high to low, it will draw from the power supply, causing the voltage to start drooping until it realizes (10 us later!) that it needs to do something to correct the drooping voltage.

To compensate for slow power supplies, we use decoupling capacitors. Decoupling capacitors add fast "charge storage" near the IC. So when your micro switches the outputs, instead of drawing charge from the power supply, it will first draw from the capacitors. This will buy the power supply some time to adjust to the changing demands.

The "speed" of capacitors varies. Basically, smaller capacitors are faster; inductance tends to be the limiting factor, which is why everyone recommends putting the caps as close as possible to VCC/GND with the shortest, widest leads that are practical. So pick the largest capacitance in the smallest package, and they will provide the most charge as fast as possible.

\$\endgroup\$
0
\$\begingroup\$

Firstly check the voltage of output pin in nrf51 without connecting transistor circuit if it's voltage level changing according to setting pin High & Low. If nrf51 reset then it's firmware error.

If firmware working fine then check transistor circuit. Is it properly become High & Low(if not change your transistor). Have you properly connected both GND (nrf51 & transistor).

Check you relay config & circuit (eg working voltage & current level etc)

If all good then lastly change your load.

Your problem look like similar: link

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.