0
\$\begingroup\$

I am working on a project based on Arduino, but currently stuck. I have three 24V lights to monitor, sent by a tower wired to a machine. My idea is to use a relay to convert first 24 voltage to 5V, so I can then work with Arduino, reading relay status.

I know how to let Arduino do the processing, but the problem is how I can get the data from the three patrol lights.

I thought of wiring 4Pin DC Power Relay with each 24V signal the following way

Relay coil with tower wires (VCC and GND)

Relay contacts with Arduino Pins (NO, COM, NC)

Still don’t know if I made the right choice choosing a relay or not. I’ll be grateful if you help me on this point.

\$\endgroup\$
2
  • \$\begingroup\$ The relay will work. As Lundin pointed out, you probably don't need it, but it will work. \$\endgroup\$ Commented Sep 9, 2022 at 11:25
  • 1
    \$\begingroup\$ If you add a relay though, you will need to debounce the signal similar to how you debounce a button, either through hardware RC filter or software. You also need a freewheel diode across the coil. \$\endgroup\$
    – Lundin
    Commented Sep 9, 2022 at 11:27

1 Answer 1

3
\$\begingroup\$

For some reason, everyone using Arduino seems completely obsessed with galvanic isolation in all manner of strange situations... If you have a somewhat stable 24DC then forget about relays! They are slow, they bounce, they break, they are relatively expensive.

Just use a voltage divider. Add a TVS for protection and also place a high ohm series resistor towards the MCU. Roughly this:

schematic

simulate this circuit – Schematic created using CircuitLab

Always design with margins. This divider and TVS were picked for a maximum of 30V giving 5V, to allow supply voltage errors in case this is a vehicle generator voltage which could be somewhere between 24 to 29VDC. If that's not a concern you can go for something closer to 24V (4k7 would give a standard E12 series for example). In this circuit at 24V you'd get 4VDC logic level on the MCU pin which will still be a logic 1.

More advanced flavour of the above is to also add 2 diodes on the signal towards the MCU - one towards your 5V net and one towards GND. You can then dimension the voltage divider slightly higher and guarantee a fairly accurate 5V logic no matter the input.

\$\endgroup\$
3
  • \$\begingroup\$ Lundin I m worried about the power dissipation of the zener. \$\endgroup\$
    – Miss Mulan
    Commented Sep 9, 2022 at 11:26
  • 2
    \$\begingroup\$ @MissMulan It's not just any zener, it's supposed to be a TVS - I couldn't find the most correct symbol in the SE schematic editor. They typically handle 800W or 1600W if automotive grade. And only conduct in case of spikes. So what's the problem. \$\endgroup\$
    – Lundin
    Commented Sep 9, 2022 at 11:28
  • \$\begingroup\$ Just so OP is absolutely clear: the GND of the 24V supply should be attached the the GND of the Arduino. Otherwise this will misbehave. \$\endgroup\$
    – Polynomial
    Commented Sep 9, 2022 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.