Protection circuit for Device

Discussion in 'General Electronics Chat' started by Fanfire174, Nov 27, 2018.

  1. Fanfire174

    Thread Starter Member

    Mar 13, 2018
    204
    0
    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
     
  2. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    9,945
    2,408
    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?
     
  3. ericgibbs

    Moderator

    Jan 29, 2010
    8,147
    1,651
    hi FF,
    A 15k and a 2k2 will give 3v fron 24v
    E
     
    Fanfire174 likes this.
  4. Fanfire174

    Thread Starter Member

    Mar 13, 2018
    204
    0
    How did you calculate resistor value ?
    upload_2018-11-27_17-56-49.png

    if V in = 12 V DC
    Vout = 3.3 V DC

    How to know R1 and R2
     
  5. Fanfire174

    Thread Starter Member

    Mar 13, 2018
    204
    0
    I have device that gives 24 DC signal and max current is 50 mA
     
  6. ericgibbs

    Moderator

    Jan 29, 2010
    8,147
    1,651
    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
     
    Fanfire174 likes this.
  7. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    9,945
    2,408
    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.
     
    Fanfire174 likes this.
  8. ericgibbs

    Moderator

    Jan 29, 2010
    8,147
    1,651
    hi alec,
    I thought the TS was dividing down a 24Vdc 'Digital Signal'.
    As you say it should suit both types of reduction.
    Eric
     
    Fanfire174 likes this.
  9. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    9,945
    2,408
    I overlooked the 'DC' bit :oops:.
     
  10. ian field

    AAC Fanatic!

    Oct 27, 2012
    6,543
    1,197
    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.
     
    Fanfire174 likes this.
  11. Fanfire174

    Thread Starter Member

    Mar 13, 2018
    204
    0
    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
     
  12. ericgibbs

    Moderator

    Jan 29, 2010
    8,147
    1,651
    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.
     
  13. Fanfire174

    Thread Starter Member

    Mar 13, 2018
    204
    0
    Yes I am asking for contacts
    How to connect the contacts of relay to input of microcontroller ?
     
  14. ericgibbs

    Moderator

    Jan 29, 2010
    8,147
    1,651
    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
     
    Fanfire174 likes this.
  15. Fanfire174

    Thread Starter Member

    Mar 13, 2018
    204
    0
    correct
    I'm looking for connection
     
  16. ericgibbs

    Moderator

    Jan 29, 2010
    8,147
    1,651
    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
     
  17. Fanfire174

    Thread Starter Member

    Mar 13, 2018
    204
    0
    Yes 24V is input supply for relay

    This is my connection

    Can we connect relay shown in diagram
    upload_2018-12-1_15-53-24.png
     
  18. ericgibbs

    Moderator

    Jan 29, 2010
    8,147
    1,651
    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.
     
Loading...