Read 24V with an Arduino

Status
Not open for further replies.

jelezarov

Member level 1
Joined
Jan 29, 2016
Messages
32
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
313
Hi,

like the title says, my aim is to detect on/off states on a 24V input with a microcontroller (arduino). A pretty common problem, for the looks of it, but none of the found solutions meets all of the following criteria:

- the input may vary to some degree (22-30V);
- ideally no heat generation, no 1-2W resistors;
- as small and with little parts as possible;
- and it has to have a LED

So I came up with this:


On a breadboard this seems to work so far, but I wanted to show it here, because most of you are lot more experienced than I am. So, can something be improved in my circuit, considering the above expectations ?


Cheers
 

why not just have a voltage divider on an input and drive an LED with a separate output?
 

Hi,

Add a 1k resistor from base to GND, this ensures higher noise immunity.

Klaus
 
@barry - then if I try to measure more than a couple inputs, the MC will quickly run out of IO pins

@KlausST - thanks for the suggestion
 

Hi,

Is that quite usual, to have say 24V into the base and 5V on the collector of an NPN? You can do that, can you, based on Vcb ratings, ignoring Vbe? I thought Vbe was usually 6 to 7V max. I feel a little confused in this thread, I haven't seen that before. Where's the 24V going? Is that schematic wrong? Thanks.

- - - Updated - - -

Hi jelezarov,

If that is not correct because of the BJT Vbe abs. max. ratings, then a 38k or 3.8k into the base, and a 10k or a 1k to ground will divide that 24V down to 5V.
 

@barry - then if I try to measure more than a couple inputs, the MC will quickly run out of IO pins.

You said "a 24V input" not multiple inputs.

Maybe you need a multiplexer. I don't think you're giving us the whole story.
 
The Vbe(max) is not exceeded. It is ~0.7V all the time.
If that is not correct because of the BJT Vbe abs. max. ratings, then a 38k or 3.8k into the base, and a 10k or a 1k to ground will divide that 24V down to 5V.
10k-1k-BJT does not make a resistor divider because of the BJT. The BJT will clamp its Vbe to ~0.7V, so there will be no 5 V.
 
Thanks all for the replies!

@barry - you are of course right about my description The current experiment I am working on is about watching 6x24V inputs. Anyway I though that in general would be easier to add some more small components than another Arduino if one needs to watch more inputs, so I toke this route. I will check the multiplexer approach too, thanks for the suggestion. It is always nice to learn new stuff.
 

Why not this?

input -> resistor -> LED -> GND

If you use white or blue, you will get about 3.0 to 3.3V at the top of the LED when on.

Bob
 
Reactions: d123

    d123

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…