Monitoring 24V LED stack tower lights status

Hello everyone,
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 realy 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.

Relays should work, as long as whatever is powering the tower lights has enough output to power the lights and relay coils as well. Likely it will.

One option is to use optocouplers to provide isolation. They are an LED and photodiode in a DIP package. Wire the LED in parallel with a tower light, using an appropriate series resistor (~ 2K2 ). You can then use the photodiode side of the opto to trigger your 5V circuit.

Or there’s the real simple approach if you can use a common ground and don’t need isolation. Use a couple of resistors as a voltage divider to drop the 24V down to 5V.

https://ohmslawcalculator.com/voltage-divider-calculator

1 Like

Thank you for your detailed answer.
Optocoupler I think they get trigged just by low currents.
How can I wire 24V relay(s) or voltage divider with Arduino and the tower light ?
Thank you.

Yes. That is the advantage over a relay. it requires very little power (limited by the 2K2 resistor) to send an isolated signal to your Arduino.

The voltage divider calculator I posted has wiring. The left hand battery is your light. The right hand output is the output to your circuit.

Relay can be wired like this:

Thank you so much @tom_I, you really comforted me.
Do I need any resistors with relays or no ?

No, as long as the relays have 24V coils you do not need resistors. Just wire the relay coils in parallel with the lights.

1 Like

You’ll need pull-down resistors on A1,2 and 3, either in software or physical.

And what the switch is for ?
If you can explain the role of a pull down resistor here ?
Should I press it everytime I want to get a signal ?
and how it will be wired ?
Excuse my lack of knowledge.

The machine works with a current = 0.3A
Relays in this case is not a good choice.

There is no switch. That is the relay contact.

When the relay is on you have 5v on your input. When the relay is off your input is floating at an unknown voltage. Floating inputs are bad. The pull down resistor weakly pulls the input to ground in this case. 10K Ohm is a good choice. Search the internet for a diagram

Just as well I gave you two other options then. Both draw less than 15mA which will imperceptibly dim the lights.

Voltage divider, simple but no isolation:

or

Optocouplers, more complicated but 2kV minimum isolation:

You can buy modules with this circuit already built for you. Search for “4 Channel 24V to 5V optocoupler module”, e.g.

http://www.icstation.com/channel-voltage-level-shifter-translator-optocoupler-isolation-board-signal-4bit-converter-module-p-8042.html

One other thing to note is that ESPHome is much easier to interface to Home Assistant than an Arduino.

1 Like

Thank you so much @tom_l for your patience. I appreciated it. Thank you for your help. I’m so grateful :blush:

Hello,

I tried to work with only one relay, and make this code to display its status, but the only thing I get is when relay is “ON” when it’s hight in all cases : with or without 24V power supply.

The code :

#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C LCD(0x27,16,2);

const int relay = 1;

int relayState = 0;

void setup(){
Serial.begin(9600);
Serial.println(F(“Initialize system”));

LCD.init();
LCD.backlight();
pinMode(relay, INPUT);
}

void loop(){
relayState = digitalRead(relay);

if(relay == HIGH) {
LCD.setCursor(3, 0);
LCD.print(“ON”);

}
else {
LCD.setCursor(3, 0);
LCD.print(“OFF”);
}
}

I cant help you with C. Someone else may be able to if you format it correctly.

1 Like