Go Down

Topic: Monitor 24VDC lights in arduino (Read 337 times) previous topic - next topic

noodlesadobencha

Apr 18, 2018, 06:17 pm Last Edit: Apr 18, 2018, 06:26 pm by noodlesadobencha
Hello guys,

I am starting a new project and I am trying to read, with an arduino, multiple signals that are entering a switchboard.

Basically, there is a switch that lights up a 24VDC light and (probably) there's a relay after it that keeps it from going off, until another button gets pressed.

There are 10 of this switches, which means 10 of these lights to monitor.

Assuming these lights are all connected to the same switchboard, how can I read them as arduino inputs?

Thanks a lot for your help.

wvmarle

Depends on how they are connected and what connections you can make to them. Please post a circuit diagram of the whole thing, and where you would want to connect the Arduino.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Wawa

If you don't know if you can connect Arduino ground to device ground,
then the safest way is to use optocouplers.
Look for "8 channel opto isolator" on ebay.
Leo..

lastchancename

#3
Apr 19, 2018, 05:25 am Last Edit: Apr 19, 2018, 05:25 am by lastchancename
Several questions and points...

Are the lights driven with AC or DC ?
Do you want to monitor the light, or the voltage going to it?
(You could monitor both to detect blown bulbs).

Monitoring could be performed one-to-one, or using a 74165 style multiplexer.
When posting - use the toolbar and read the stickies if you're not sure!  </code> tags are our friend!
You can lead a plug to an outlet, but you can't make them turn it on.

noodlesadobencha

#4
Apr 19, 2018, 10:18 am Last Edit: Apr 19, 2018, 10:19 am by noodlesadobencha
Trying to answer the questions made:

- I can probably connect the GROUNDs between devices
- the lights are 24VDC
- just want to monitor if the lights are on or off

I was thinking about using a voltage divider like this one:



Thank you all for your replies.

(edit) I am begginer in this matters so, if you can, explain it in the simplest way

wvmarle

#5
Apr 19, 2018, 10:48 am Last Edit: Apr 19, 2018, 10:49 am by wvmarle
It seems you have full access, so it can be a lot simpler:

Left hand side: the switch is connected between GND (0V) and the lamp; connect the Arduino to the switch. 0V side of the switch to GND of the Arduino; the other side of the switch with diode (mind the direction!) to the Arduino. When the switch is closed, it connects the pin to GND, pulling it low. When the switch is open, the diode blocks the 24V from reaching the pin while the internal pull-up pulls it high. So your pin will read LOW when the lights are on, HIGH when they're off.

Right hand side: the switch is connected between 24V and the lamp (I expect yours is like this - check carefully). Connect the lamp side of the switch to the Arduino pin via the diode (again, mind the direction), and connect grounds (0V - the other side of the lamp in this situation). Now when the switch is open, the low resistance of the lamp pulls down the pin, and when the switch is closed 24V is supplied, the diode blocks, and the internal pull-up does its thing.

It's best to use a fast diode here, like the 1N4148 or even a Schottky, or add a resistor (1-5k or so - not too big or you can't pull low the pin, it's a voltage divider together with the ~30k internal pull-up) if you have a slow diode like the 1N400x to protect your pin.

Beware: if you connect the diode the wrong way, the 24V will destroy your Arduino in an instant.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

lastchancename

#6
Apr 19, 2018, 10:55 am Last Edit: Apr 19, 2018, 10:57 am by lastchancename
Just to reiterate my question...
The way you're going, you're monitoring if the supply is present, not whether the lamp is actually working.

@wvmarle... if you omit the pullup, and current limit the input, the bulb itself will provide the bias to identify when it's actually on.
When posting - use the toolbar and read the stickies if you're not sure!  </code> tags are our friend!
You can lead a plug to an outlet, but you can't make them turn it on.

wvmarle

True. Replace the diode with a resistor and use the clamping diodes of the pin.
These clamping diodes are rated up to 0.5 mA iirc (you have to double check this with the data sheet before implementing!) which at 24V (well, 19V after deducting the 5V of the Arduino's supply but let's be safe in case of the Arduino switched off) means you need a resistor with value >48k. A 100k one would do fine in this case.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

noodlesadobencha

@wvmarle
So that way I don't even need that voltage divider circuit for each lamp, with just 1 diode (1N4148) per lamp I can do it? You've just put it waaaay simpler that I was thinking.

Meanwhile you posted another answer, so now you are saying that I replace that diode in the schematic with a 100k resistor?

@lastchancename
I mentioned the lamp because it's the visual evidence that the switch was pressed. What I really want to know is if the switch has been pressed.


Once again, thank you for your replies.

lastchancename

#9
Apr 19, 2018, 11:28 am Last Edit: Apr 19, 2018, 11:29 am by lastchancename
Post #5 (left side diagram) plus Post #7
- both our brains combined == the best solution, but make sure to follow wvmarle's thoughts completely - or you'll smoke the Arduino.
The 100K resistor is *really* important!

Quote
If the input is HIGH - the LAMP is ON
If the input is LOW, the LAMP is OFF (or blown!)
When posting - use the toolbar and read the stickies if you're not sure!  </code> tags are our friend!
You can lead a plug to an outlet, but you can't make them turn it on.

wvmarle

@wvmarle
So that way I don't even need that voltage divider circuit for each lamp, with just 1 diode (1N4148) per lamp I can do it? You've just put it waaaay simpler that I was thinking.

Meanwhile you posted another answer, so now you are saying that I replace that diode in the schematic with a 100k resistor?
Yes - can do. The Arduino's processor's pins have clamping diodes to keep the input voltage under control (that's why you have to stay between +5.5V and -0.5V normally). These actually can be used in the exact way as I described - this is even written in the data sheet - to keep the voltage under control, as long as you keep the current under control with a resistor.

This works as long as you can be sure that your 24V doesn't have spikes or so, like in automotive applications. I'm assuming a nice clean 24V supply here. Lamps are also nice and clean almost purely resistive loads (incandescents are really just resistors, but also LEDs), so no problems there either. If these assumptions are wrong you have to let us know, as my very simple circuits are not suitable for all situations.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

noodlesadobencha

Post #5 (left side diagram) plus Post #7
- both our brains combined == the best solution, but make sure to follow wvmarle's thoughts completely - or you'll smoke the Arduino.
The 100K resistor is *really* important!

Yes - can do. The Arduino's processor's pins have clamping diodes to keep the input voltage under control (that's why you have to stay between +5.5V and -0.5V normally). These actually can be used in the exact way as I described - this is even written in the data sheet - to keep the voltage under control, as long as you keep the current under control with a resistor.

This works as long as you can be sure that your 24V doesn't have spikes or so, like in automotive applications. I'm assuming a nice clean 24V supply here. Lamps are also nice and clean almost purely resistive loads (incandescents are really just resistors, but also LEDs), so no problems there either. If these assumptions are wrong you have to let us know, as my very simple circuits are not suitable for all situations.
So to sum up, I identify which of the diagrams I have - left or right side - I go with a 100k resistor and DON'T use that diode and then use only INPUT instead of the PULLUP?

lastchancename

#12
Apr 19, 2018, 01:31 pm Last Edit: Apr 19, 2018, 01:33 pm by lastchancename
Use the LEFT diagram...
The bulb itself is what replaces the PULLUP.

The reason is as noted above -
If the input is HIGH - the LAMP is ON
If the input is LOW, the LAMP is OFF
(or blown!)

The 100K resistor is *really* important!

In theory, you could use an input to sense the 'driving signal', and if that is ON, but the bulb is OFF - the globe is dead - as explained above.
When posting - use the toolbar and read the stickies if you're not sure!  </code> tags are our friend!
You can lead a plug to an outlet, but you can't make them turn it on.

noodlesadobencha

Use the LEFT diagram...
The bulb itself is what replaces the PULLUP.

The reason is as noted above -
If the input is HIGH - the LAMP is ON
If the input is LOW, the LAMP is OFF
(or blown!)

The 100K resistor is *really* important!

In theory, you could use an input to sense the 'driving signal', and if that is ON, but the bulb is OFF - the globe is dead - as explained above.
Ok, left diagram and the pin as an INPUT only.

As a sequence to the project, if I want to read the signal in a computer that is 10 meters away from the arduino (wifi or ethernet), in an interface that shows the bulbs and if they are ON or OFF.

Like this but in a computer interface:

Any suggestions on how to do this? (or should I create a new topic?)

Thanks a lot for your help.

wvmarle

#14
Apr 19, 2018, 03:20 pm Last Edit: Apr 19, 2018, 03:20 pm by wvmarle
I'm expecting you need the right-hand diagram (switch wired high side, but that's maybe less important with 24VDC than 240VAC) but it depends on the actual wiring. In the case of the right-hand diagram the bulb would act as pull-down when the switch is open.

And for the fun of it I started to think on how you could sense whether the bulb is broken. This can be done with a network of resistors and two diodes:

This can be sensed with an analog pin. I didn't try to optimise values, these should work fine.

Lamp good, switch open: current via R18 and lamp+D2+R20, then R19 to ground. Output 4V.
Lamp good, switch closed: current via lamp+D2+R20 and R18, then R19 and R21+D4 to GND. Output 1.1V.
Lamp broken, switch open: current via R22+R20 and R18, then R19 and to GND. Output 3.5V.
Lamp broken, switch closed: current via R22+R20 and R18, then R19 and R21+D4 to GND. Output 1.9V.

Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Go Up