Go Down

Topic: 5V Relay Rapidly clicks on and off (Read 263 times) previous topic - next topic



I have a circuit made up on 8 C Cell batteries, an arduino nano, a 5V relay, amber LED, two fans (data sheet listed below), and an MQ2 Gas Sensor.The circuit is designed so that when the MQ2 sensor reads above a certain threshold value, which is set as 1.3V right now so that it triggers when smoke from a blown out match hits it, it triggers the rest of the circuit which is that for 5 seconds it runs the two fans, and blinks the LED. The MQ2 gas sensor is powered off of the 5V pin on the arduino.

The fans need 12V to run so it is set up so that once the arduino reads above the value at the analog pin, it sends a digital signal to the relay so that it can connect the fans to the 12V supplied by the batteries. Another digital pin then blinks the LED. This all works 100% when connected via USB to a computer for power.

The problem comes in when I try to run the circuit off of the batteries alone. I have a toggle switch set up between half of the batteries so that when it is switched on, 6V is used to power the arduino at Vin. This appears to work fine, as nothing is standing out as wrong at this point. Once I introduce the smoke, the sensor reads it and triggers the function for the 5 seconds, however, this is where the problem lies. The relay, instead of kicking on for 5 seconds and running the fans, rapidly switches back and forth never actually running the fans. The digital output seems to do the same, where instead of a slow blink with a delay of about 1 second, it rapidly blinks on and off.

Any help would be greatly appreciated, and thank you in advance

PS: Here is the data sheet for the fan if need be.



Do not use "Vin".  Unless you have a regulated 5 V supply such as a "phone charger" to power the Nano, you will need a 5 V "buck" regulator to power the 5 V pin and all your other 5 V devices.


May 09, 2019, 05:46 pm Last Edit: May 09, 2019, 05:51 pm by PaulRB
Or... you could power the Arduino from 12V through the Vin pin. But if you do that, change out the 5V relay for a 12V relay and power the relay direct from the batteries. The change of relay is because, with a 12V input, the Arduino's regulator may overheat if it needs to power the relay.

Better still, power the Arduino from 12V through Vin, and change out the relay for a logic-level MOSFET such as IRL520 or STP16NF06L. The MOSFET will require almost no power to run, and will not click! Put a 10K pull-down on the Arduino pin connected to the MOSFET gate to prevent unwanted running of the fans when the Arudino starts up.


Or... you could power the Arduino from 12V through the Vin pin.
A most surprising recommendation!

Did you not read the first posting?   :smiley-eek:
The MQ2 gas sensor is powered off of the 5V pin on the Arduino.


Paul__B is correct, this sensor draws almost 200mA and that will stress the Nano's regulator if powered by 12V. Ignore my previous advice.

@Paul__B thanks for giving me the opportunity to explain to the OP why my advice was wrong.


Well, my point is to maintain a consistent stance.  The on-board regulator of the original Arduinos - the UNO and its predecessors, the Nano, Pro Mini, Leonardo, Pro Micro - is simply not suitable for the vast majority of applications so I feel that it is actually unhelpful to ever suggest that it might be in some particular situation since even if it is usable, an apparently "minor" adaptation will promptly cause a failure mode puzzling to the uninitiated.

This is such a frequent theme here, and such a time-waster when someone reports a peculiar behaviour and suggestion after suggestion is made only to find out the problem is simple.  For example: "Yes, I am powering it with a 5 V regulated supply" - via the "Barrel jack".

And just to really confuse matters, there are the properly designed later models of Arduino (and the "Robored" UNO variant) which can with certainty be powered at 12 V via a proper on-board regulator and power other modules in addition.

Go Up