1
\$\begingroup\$

My aim is to switch an electric bulb operating at 220v AC. For this purpose I use a 12V DC relay that can operate for 220V appliance according to its data sheet. My relay circuit is as under:

enter image description here
Using a regulated power supply (a desktop PC's SMPS unit with 12v, 5v, and 3.3v outputs), when 5V is applied to the pin of microcontroller, I get a click sound from the relay and the bulb is switched ON and when the pin is kept open, the bulb is OFF.

But when using an Arduino Uno board for the same purpose (I have 12V, 5V, 3.3V and GND pins on the board so I give all of the supply from the board itself now not from the separate supply), when I connect 12V GND and 5V at the pin that goes to MCU pin the relay is making noise. I am getting a continuous clicking sound from the relay. If I connect the bulb to it, it may damage my bulb (I'm assuming this since the relay seems to be switching fast and continuously)

Why am I getting the noise of clicking continuously when I use Arduino instead of the power supply?

How could I solve this problem?

\$\endgroup\$
  • \$\begingroup\$ Why would you apply 5V to the MCU pin separately? \$\endgroup\$ – Sohail Jan 14 '15 at 11:38
  • \$\begingroup\$ Have you used a capacitor (say 220uF) to decouple the supplies? \$\endgroup\$ – JIm Dearden Jan 14 '15 at 11:40
  • \$\begingroup\$ You need to describe your power supplies in more detail. It sounds like the 12V supply you have on the Arduino does not have enough current capacity to drive the relay. \$\endgroup\$ – Dave Tweed Jan 14 '15 at 12:33
2
\$\begingroup\$

One issue is that you do not have a fixed grounding resistor on the transistor. This may not always be needed. However the Uno ports are not programmed at reset or when there is no program running. In those cases the port may be set to a high impedance input with or with out a light pull up resistance. In this case you might be unknowingly turning the transistor on intermittently with noise or pull up leakage current.

To insure stable operation be sure to set the controlling port pin quickly to a digital output and set the initial logic value. Adding a resistor to ground, (before or after the existing 10k) will help prevent an open port or a light pull up from activating the transistor. With a 5v Uno a matching 10k should be OK. Lower resistor values reduce the chance of unknowingly activating the transistor, but at some point the high signal will not be able to turn it on.

If immediate switching time is not critical adding a small cap on the transistor base to ground can prevent fast multiple ON-OFF cycles that could reduce the life of the bulb. (Maybe 1uf).

\$\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.