Reading 24V with arduino pin

Thread Starter

jeffjohnvol

Joined Oct 15, 2008
37
I have a switch that has 24 Volts that I need to feed into an Arduino. I also need an LED to show the status of the 24v signal. Will the attached circuit do the job, or is there an easier way to do it?
 

Attachments

BillB3857

Joined Feb 28, 2009
2,570
Just two resistors as a voltage divider would do the 24v to 5v conversion for you. Standard LED with series resistor could monitor the 24V line.
 

Thread Starter

jeffjohnvol

Joined Oct 15, 2008
37
Yes. I thought about the resistor divider of 4.8K and 1K, but then when I put the LED circuit in parallel, I was concerned about a voltage drop.

I suppose if I put the LED in the series circuit and assume a 0.7v drop, it could work....
 

BillB3857

Joined Feb 28, 2009
2,570
Make two separate circuits. The 4.8K/1k for the 24/5v conversion. Then I would use a 1k in series with the LED and connect it to the 24V line and ground for a simple indicator. On second thought, you may want to check the values you suggest for the 24v/5v divider circuit. I think with the values given, you will come up short for the 5v.
 

Thread Starter

jeffjohnvol

Joined Oct 15, 2008
37
Bill, yes, you are correct. They should be ~3.8 and 1 for a total of 4.8. My bad.

Though, I'm sort of thinking all in series of LED, 1K, 280 with the pickup to the uP between the the 2 resistors. That would save me a resistor and some soldering.
 

Thread Starter

jeffjohnvol

Joined Oct 15, 2008
37
LED cathode to ground. 1k resistor to LED anode. 5K resistor in series to 1k to 24v. Take 5v from junction of 5k and 1k.
Ah, okay. That makes sense. Thanks!

And Scott, thanks for the drawing. That would be what I would do if it were a permanent installation, but this will just be a breadboard for 2 days of testing. Thanks to all that replied!
 

philraf

Joined Feb 25, 2014
1
Scott,

I have the same need (24 VDC to Arduino), and came across your post. I was planning to use a simple two-resistor voltage divider circuit, but will go with your more complex approach if it is better.

I don't really understand the purpose of the Zener diode and the capacitor. Are they to protect against surges?

Also, I am perplexed by the resistances. If R2 is 330 ohms, doesn't R1 have to be around 1220 ohms to result in a 5.1V signal for the Arduino?

Hoping to be enlightened ...

Phil
 

ScottWang

Joined Aug 23, 2012
7,400
Scott,

Hoping to be enlightened ...

Phil
I don't really understand the purpose of the Zener diode and the capacitor. Are they to protect against surges?
You should know more about the zener.
The Equivalent Circuit of Zener diode Using Diode and LED Protection.

The capacitor will be about 47~220uF, the output of this kind of simple regular will more easier to affected by the load, so using a capacitor to discharge for the load, and making the output more stable.

Also, I am perplexed by the resistances. If R2 is 330 ohms, doesn't R1 have to be around 1220 ohms to result in a 5.1V signal for the Arduino?
The output will be fixed under 5.1V,
V_zener = 24V-5.1V = 18.9V,
I_zener = 10~50mA, if the current too less then the output voltage will be unstable.
I_LED = (5.1V-2V)/330Ω = 9.4mA, for the life of parts that you can choosing the current about 8mA.

You can calculate how much current the load can get.
 

BobTPH

Joined Jun 5, 2013
8,967
There seem to be 2 different kind of posters here answering 2 different questions. One seems to think the 5V for the Arduino is to power the Aduino. The others seem to think the 5V is just a signal as an input to the Arduino.

So, OP, which is it?

Bob
 
Top