Protection circuit for Device

Thread Starter

Fanfire174

Joined Mar 13, 2018
240
I have raspberry Pi and I want to read 24 V DC Digital signal. I can't give 24V signal to Pi otherwise it will damage. I have searched on google, GPIO of PI work well with 3.3 V signal

I know I need voltage divider circuit to convert 24 v into 3.3 V.

I am looking help to choose resistor's value to divide voltage

Can anyone suggest me resistor's range to divide voltage
 

Alec_t

Joined Sep 17, 2013
14,314
The resistor values will depend on what is providing the 24V signal and how much current it can source. So, where does this 24V come from?
 

ericgibbs

Joined Jan 29, 2010
18,849
hi
R2/(R1+R2) is a Ratio.
Considering the available current from the 24v voltage, choose a preferred resistor value for R2, then work out Ratio value for R1.
I choose 2k2 for R2, you know Vin and Vout
Place those values in the equation and solve for R1

E
 

Alec_t

Joined Sep 17, 2013
14,314
The ADC inputs of micros are typically specified for a source impedance of less than 10k, so Eric's choice of 2k2 is good. The load on your device will be 15k+2k2 = 17k2, which will draw a current of 24V/17k2Ω = 1.4mA. This is much less than the rated output current of the device, so is unlikely to pull down the device output voltage significantly. The measurement accuracy should therefore be good.
 

ian field

Joined Oct 27, 2012
6,536
I have device that gives 24 DC signal and max current is 50 mA
Looks like everyone else got the voltage divider bit covered. There are various ways you can protect the micro from catching something nasty.

The simplest is a clamp diode from the input to supply rail, but fast edges may not like the junction capacitance and a really big whammy can overvolt the whole chip. Some devices already have these diodes on the silicon die - but the diode doesn't really do anyone much good if it sacrifices itself to save the chip. An external clamp diode COULD make that damage less likely.

In a harsh environment - I'd be tempted to add an op-amp unity gain buffer or a logic gate that is simpler and cheaper to replace. For dangerous environments - you could go for opto-isolation. linear is fairly complex, and probably cheaper to buy a made for the job chip/module. For logic levels, opto is easy enough - but not particularly fast.
 

Thread Starter

Fanfire174

Joined Mar 13, 2018
240
Output of relay should be connect to input of divider circuit and the output of divider circuit goes to GPIO of PI

How to connect relay output
upload_2018-11-28_17-55-7.png
 

ericgibbs

Joined Jan 29, 2010
18,849
hi FF,
Are you asking how to connect the relay contacts or coil.?
E
If its the contacts, you have to say what the source voltage is and do you want it be input to the MCU be when relay is energised or de-energised.
 

Thread Starter

Fanfire174

Joined Mar 13, 2018
240
hi FF,
Are you asking how to connect the relay contacts or coil.?
E
If its the contacts, you have to say what the source voltage is and do you want it be input to the MCU be when relay is energised or de-energised.
Yes I am asking for contacts
How to connect the contacts of relay to input of microcontroller ?
 

ericgibbs

Joined Jan 29, 2010
18,849
hi FF,
OK,
You say you want to drop 24Vdc down to 3V, the resistor divider will do that.
Is that 24V voltage being switched by the relay contacts.?
If Yes, then you have to say will the 24V be connected to the divider when the relay is operated or not [ coil energised or not]
Then I can show a drawing for the connections.
E
 

ericgibbs

Joined Jan 29, 2010
18,849
hi FF,
I cannot answer your question until you tell me how you want to use the relay.??

Is that 24V voltage being switched by the relay contacts.?
If Yes, then you have to say will the 24V be connected to the divider when the relay is operated or not [ coil energised or not]
Then I can show a drawing for the connections.


Eric

@OBW0549
 

ericgibbs

Joined Jan 29, 2010
18,849
hi,
If you connect the incoming 24V onto pin #3, when the relay is energised, the 24v will be connected to the top of the divider, the PI will read 3V.
When the relay is not energised, the PI will read 0v.
 
Top