alimentation Arduino + 4 sensors + 1 relay

Hello, I’m completely new to Arduino,

My project consists of installing an anticollision system on a moving machine.

That’s why I would like to

  • wire 4 SRF05 sensors to my Arduino Uno card
  • control an electrical relay from the Arduino, in function of the signals issued from the sensors

If one of the 4 sensors detects an obstacle closer to a threshold I previously set in the Arduino, then the Arduino opens the relay and the machine stops moving.

consommation of

  • one sensor : 5V, 30 to 50mA => 4 sensors < 200mA
  • the Arduino : 55mA (apparently)
  • the relay : I don’t know much about relays, but I would like a relay closed when the Arduino sends 5V and opened when it sends 0V. The relay communtes a 24V line, <50mA (charge line).

Here is my first question : for this relay function to be done, I have found this one : ref n° 2919726 at RadioSpare. Do you think it is suitable for my use?

My second question is : can the USB cable from the PC to the Arduino be sufficient to power all of this ?

Thank you very much!

maybe the 5V of the usb cannot power it, because initially it can only supply 150mA then AFTER that supply 500mA, but you can try, maybe monitor the 5V with a multimeter on the arduino

that relay must be powered with 24V so i think it's not suitable for you, you need a 5V one (a stupid\standard type) and you need to power it via a transistor and don't forget the anti-spike dieode across the relay (browse the internet for this circuit)

Thank you for your answer!
As you say, I'll try the USB power supply or I just found a standard 9V external power supply.

Concerning the relay, you are right, I need one that can be powered with 5V so I lookek for one and I figured out that standard relays allow a maximum duration power command of a few microseconds...
For security reasons, I first wanted to power the relay with 5V when everything was going well and pass it to 0V when there is a problem (I liked it because I thought that if something is burnt or disconnected, I would have 0V and it would open the relay and stop the move!). But with this maximum power duration, I don't know how to do, I don't know well enough... Can anyone help please?

Also I had never heard about the anti spike diode. I'll investigate!

this is a good schematic, maybe use a bc337 instead of the 3904

i don’t know what you are talking about “maximum duration power command of a few microseconds”

relays are meant to operate with a minimum pulse of around 2\10 sec. there’s no limit on how long you can let them stay on

about response time i think you don’t have problems for a moving machine with a realay for safety

Thank you very much for the schematic!!

Is it completely equivalent to use a solid state relay (quicker and longer life?) instead of a SPST (mechanical?) relay?

"relays are meant to operate with a minimum pulse of around 2\10 sec. there's no limit on how long you can let them stay on". OK, thank you, I didn't know that!

So let's see if I understand your schematic :
Here the relay is normally open, if the Arduino sends 5V, the relay closes, and if it sends 0V, the relay is open, right? If so, that's exactly what I want!

I feel that my question is a bit dumb but I have to be sure : is it possible to supply the 5V (wired to the collector of the transistor) from the Arduino and the ground (emitter) on the ground of the Arduino?

And is there a reason why you would use pin D6 (digital, PWM)?
I would have used a normal digital pin...


i don't trust solid state relays a lot... maybe ensure yourself that it's 5V operated at last
if it's just for safety it will turn on\off little times and classic relays are safer

99% percent of relay actuation schematics fit your needs and this schem. will do

it's possible to do that 5V thing, just ensure you don't fit too much relays, maybe you can add a 220uF capacitor from the +Vcc of the relay to the transistor's emitter (very close to this) to stabilize transients
if you power the arduino with 12V on the barrel connector use a 12v relay and connect it's side to +12v and common the grounds (best solution)

it's not my handdrawn schematic so.... :roll_eyes:

I'll only use one relay.

"if you power the arduino with 12V on the barrel connector use a 12v relay and connect it's side to +12v and common the grounds". It will still work the same with 12V on the Collector (instead of 5V), even if the pin D6 only supplies 5V on the Base?

It will work the same with the same references of elements as in the schematic (only with a different relay and +12V)?

There ARE relays that will handle your task (24V @ 50mA) that can run directly off 5V. The part below has a coil resistance of 500 ohms, therefore it CAN be switched by one Arduino pin per relay. Just remember to add the freewheeling diode as you would with the 12V. Why put in so much more relay than you need?

Thank you for your reply. Unfortunately, the link is unavailable in my country, it says :

"Unfortunately, access to this particular item has been blocked due to legal restrictions in some countries. We are blocking your viewing in an effort to prevent restricted items from being displayed. Regrettably, in some cases, we may prevent users from accessing items that are not within the scope of said restrictions because of limitations of existing technology. Please accept our apologies for any inconvenience this may cause, and we hope you may find other items of interest on eBay."


however 50mA seems a bit low for a machine

use a 12V relay (12V is the voltage you will apply on the coil, the internal switch can withstand way more)

you can use any arduino pin :slight_smile:

don’t use a 2n3904 as transistor use a BC337 or a 2n2222, all of these can withstand something like 50V when open

Thank you for your help!

Attached is a schematic I made. Could it work well this way ? (reliable? stable? compatible power supplies? compatible elements?)

If I don’t use a reed relay, what can I use then?

Also, I forgot to mention, I would like the whole circuit to generate minimal heat! Does this circuit generates heat? How is it quantifiable?


nice scheme!!! :slight_smile:
it will work :slight_smile:

use a relay the more similiar as possible to this

reed relys are intended for switching "signals" not power

it will heat up like 1Watt or so

Is this relay siutable for me : G3TB-ODX03PM-US-DC4-24 ?

I think it is a bit overdimensionned for my need but that's the only one I found at a reasonable price.

hahahahahahahahahaha :slight_smile:
this relay costs like a sports car

you can do it with a 1$ piece, search a bit harder

and i still suggest you to not use solid state but if you REALLY wont ssr.....

Ah ok...

I'm happy to learn I can find cheaper but also I feel a bit dumb because you laugh at me :). Anyway, at the end I'm happy. Thank you! I'll search a bit harder!

I just found this one : PCH-112L2M for approximately 1$

coil : 200 mW sensitive, 12VDC, resistance 700 Ohm
charge : 5 A @ 250 V c.a. (CEI 61810), 10 A @ 125 V c.a. (UL 508)

Is it convenient?

Also when you say "it will heat up like 1Watt or so", you were talking about the relay or about the whole circuit?