external power supply to control relay issue...

Hi

I'm controlling a 5V relay, using 6 piezo ceramic vibration sensors though the analogue pins of an Arduino Uno.

When the circuit is powered via USB from my laptop it works fine. When the analogue signal from one of the sensors goes higher than a certain value, the relay triggers on. This is what I want.

Problems occur when I power it through an external power supply. The relay just stays turned on. I'm powering the relay through the VIN pin, and have tested it at different voltages between 3 and 12V from the supply, but no use. The sensors are are also powered through the VIN pin.

I used a multimeter to check on the current through the external and it seems like it's jumping all over the place??

Any ideas?

Thanks,

James

You really need to provide a diagram of your circuit. The first guess is that you don't have everything tied to ground (exteranl PS ground + arduino ground + relay, etc.)

I'm powering the relay through the VIN pin, and have tested it at different voltages between 3 and 12V from the supply, but no use

The relays should have a separate connection to the power supply. I assume they are 5V relays, so the Arduino* and relay board** can share the power supply but you can't power the relays through the Arduino's voltage regulator.

  • Connect the 5V power supply to the Arduino's 5V pin. If you connect to Vin you are going through the regulator and the regulator needs more than 5V in order to get 5V out.

** I assume you have a relay board with a relay driver circuit. The Arduino can't put-out enough current to directly drive a relay coil.

Why not start by Purchasing the Arduino cookbook and read it, this will give you some basics. also use the online tutorials and videos available, there are many good ones on this web site.

james_irwin:
Problems occur when I power it through an external power supply. The relay just stays turned on. I'm powering the relay through the VIN pin, and have tested it at different voltages between 3 and 12V from the supply, but no use.

No doubt.

The on-board regulator is not capable of supplying current for anything other than the microcontroller itself. The relay requires more current.

The clear blunder is not comprehending what the "Vin" or "RAW" terminal is. The regulator on the Arduino UNO/ Nano/ Pro Mini/ Mega2560/ Leonardo/ Pro Micro has very little heatsink, so will not pass very much current (depending on the input voltage and thus, how much voltage it has to drop) before it overheats and (hopefully reversibly) shuts down. It is essentially a novelty provided in the very beginning of the Arduino project when "9V" power packs were common and this was a practical way to power a lone Arduino board for initial demonstration purposes. And even then it was limited because an unloaded 9 V transformer-rectifier-capacitor supply would generally provide over 12 V which the regulator could barely handle.

Nowadays, 5 V regulated switchmode packs are arguably the most readily available in the form of "Phone chargers" and switchmode "buck" regulators are cheap on eBay so these can be fed into the USB connector or 5 V pin to provide adequate power for most applications. Unfortunately, many tutorials or "instructables" are seriously outdated or misleading and have not been updated to reflect the contemporary situation.

You can learn how to use a relay in this tutorial

james_irwin:
Problems occur when I power it through an external power supply. The relay just stays turned on. I'm powering the relay through the VIN pin, and have tested it at different voltages between 3 and 12V from the supply, but no use. The sensors are are also powered through the VIN pin.

You've missed the big hint there. That pin is called V IN because it is not intended as a power output pin.

If you want to use an external power supply make it a 5V supply and connect it to the 5V pin. Connect the sensors and relay direct to the supply, not through the Uno. Connect all the grounds together.

Steve

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile: