## Sensing 24VDC

6 posts / 0 new
Author
Message

So here is how I do it today:

I have the 24VDC line connected to an opto-coupler that can actually sense AC (had a few laying around). It's the LTV-844S chip (Digikey 160-1348-5-ND).

I have to have a current limiting resister so I have a 1600 ohm resister in series there. The other line of the opto input is tied to ground.

Ok, that lights up the little LED in the optoisolator. The output of the optoisolator is held high with a 10k pullup resistor with the other output tied to ground.

As such, when the LED inside lights up, the opto ties the line pulled up directly to ground. Obviously, the line being held high via pullup is connected to the AVR.

This all works peachy keen. Here's the trouble: The 1600ohm resistor has to be able to dissipate quite a lot of heat. Doing the math, a 24V circuit with a 1600ohm resistor has 15mA of current. The heat dissipation is 24 * 0.015 = 0.36Watts.

This requires me to have substantial size resistors (I chose 1-Watt to be safe) and they look crazy big next to all the 0805 resistors on the board.

I keep thinking there's got to be a simpler, smaller and cooler (as in temperature) way to do this kind of sensing. Anyone have any ideas?

Total votes: 0

There is. If your 24v source and the Avr system share a common ground, and if the 24v signal is positive, you can use a simple voltage divider to translate the +24v to +5v at the port pin. Use relatively high value resistors and heat is not a factor. Calculate the ratio so that a valid logic high is guaranteed at the minimum expected "24v" input level. The integral clamp diode in the chip will protect the input from excess voltage while sufficiently high resistance will keep current at a harmless level.

Using an opto is no benefit unless you want to couple systems that do not share a common ground. If you do want to use the opto, you can drive the led with much less current when the collector pullup is a high value.

Tom Pappano
Tulsa, Oklahoma

Total votes: 0

Good point on the voltage divider. Two resistors of moderately high value would indeed do the trick but I do lose that isolation benefit I guess.

The 24V and the 5V AVR supply do indeed share common ground so perhaps isolation really isn't happening anyway.

The 24V is actually voltage being sent to a relay. I just want to tap into it so I can read if that relay is being energized or not. There is a flyback diode across the coil to get rid of the nasty spikes so perhaps isolation isn't really necessary.

Total votes: 0

You should be good to go then. I routinely use this exact method to verify relay driver and coil status in my temperature controllers.

Tom Pappano
Tulsa, Oklahoma

Total votes: 0

Or just use another pole on the relay to switch 5 V.

JC

Total votes: 0

increase the resistor so the currnet would be around 5ma!

I love Digital
and you who involved in it!