Connect with us

Reading 24 V signal

Discussion in 'Microcontrollers, Programming and IoT' started by champ1, Mar 2, 2019.

  1. champ1

    champ1

    24
    0
    Jul 17, 2018
    I'm working on a project to measure the pressure, I have a DP-102-E-P and I am trying to interface it to the AT89c51

    I have designed with divider circuit

    upload_2019-3-2_12-55-31.png

    I want to use optcoupler ic to read 24 v signal to 8051

    I have 4n35 optcoupler

    Can we use 4n32 to read 24 V signal ?
     
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    8,881
    1,751
    Nov 17, 2011
    Do you want to measure the 24 V or simply detect the presence of the 24 V?
    To measure your approach using the divider is o.k.
    To detect you can use an optocoupler. Drive the LED by a series resistor, connect the output (transistor) to an input pin of the mcu. But why would you use an optocoupler? Battery and mcu share a common ground, so there is no need for potential isolation. You could as well use a voltage divider to detect the presence of the 24 V. Additional protection for the mcu can be achieved by a zener diode in parallel to the mcu input or a pair of diodes as shown e.g.here (you will not need the series resistor shown as your voltage divider fulfills the same purpose).
     
    champ1 likes this.
  3. champ1

    champ1

    24
    0
    Jul 17, 2018
    I want to detect the presence of the 24 V

    mine circuit

    upload_2019-3-2_16-55-12.png

    Is it look's fine to interface 24 V Sensor to input of microcontroller ?
     
  4. Bluejets

    Bluejets

    3,159
    616
    Oct 5, 2014
    I think you will find the sensor is open collector pnp.
     
  5. Harald Kapp

    Harald Kapp Moderator Moderator

    8,881
    1,751
    Nov 17, 2011
    No. the output of the sensor is open collector and cannot drive the LED as shown ín your circuit. Here is the correct setup (using open drain instead of open collector but that is the same in this application).

    Right.
    You can directly connect sensor out to the mcu input pin provided R2 is present and the grounds of the sensor and the mcu are connected.
     
  6. champ1

    champ1

    24
    0
    Jul 17, 2018
    I didn't understand, I have doubt if i do this, my controller can damage
     
  7. Harald Kapp

    Harald Kapp Moderator Moderator

    8,881
    1,751
    Nov 17, 2011
  8. Bluejets

    Bluejets

    3,159
    616
    Oct 5, 2014
    I think that if PNP open collector the diagram should be the other way around' with the signal line to the micro taken from pin 4. pnp.jpg
     
  9. Harald Kapp

    Harald Kapp Moderator Moderator

    8,881
    1,751
    Nov 17, 2011
    Absolutely right. I missed that part where it says "PNP open collector" in the data. I beg to excuse .
    Of course, then the connection cannot be done as in my post #7.
    Champ's diagram in post #3 will work fine.

    The optocoupler provides potential isoaltion which is fine but not truly required. A voltage divider would work as well.
     
  10. champ1

    champ1

    24
    0
    Jul 17, 2018
    the sensor has PNP output
    detail is here https://www3.panasonic.biz/ac/ae/search_num/index.jsp?c=detail&part_no=DP-102-E-P

    I am sorry I forgot to provide detail
     
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-