Reading 24 V signal

champ1

Jul 17, 2018
55
Joined
Jul 17, 2018
Messages
55
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 ?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
14,271
Joined
Nov 17, 2011
Messages
14,271
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

Jul 17, 2018
55
Joined
Jul 17, 2018
Messages
55
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. .
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 ?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
14,271
Joined
Nov 17, 2011
Messages
14,271
Is it look's fine to interface 24 V Sensor to input of microcontroller ?
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).

I think you will find the sensor is open collector pnp.
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.
 

champ1

Jul 17, 2018
55
Joined
Jul 17, 2018
Messages
55
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.
I didn't understand, I have doubt if i do this, my controller can damage
 

Bluejets

Oct 5, 2014
7,374
Joined
Oct 5, 2014
Messages
7,374
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
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
14,271
Joined
Nov 17, 2011
Messages
14,271
I think that if PNP open collector the diagram should be the other way around
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.
 

champ1

Jul 17, 2018
55
Joined
Jul 17, 2018
Messages
55
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.
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
 
Top