0
\$\begingroup\$

I am working on a board which has six inductive sensors.

I am using optocouplers for isolation between sensor output and MCU. Four of them work fine and two show very unreliable behaviour.

When I detect a metal object,the voltage at the Zener diode (3.3V) is 0.70 V which is fine but when I connect a microcontroller GPIO pin to read the voltage at same point (Zener diode 3.3 V) is 0.254 V and sometimes when there is no metal detection then the voltage at (Zener diode 3.3 V) is 1.154 V but it should be 3.3 V.

I already raised this issue in another forum and people suggested that there could be design issue or cold solder issue. I made a new board on perforated PCB but issue is still same, even after swapping them.

  • Inductive sensor operating voltage: (10-30V)
  • Output voltage is :(23.32 V) when supply voltage is (24V)
  • Optocoupler :PC817
  • Pull-up resistor:4.7K

enter image description here

\$\endgroup\$
8
  • \$\begingroup\$ Your Zener diode is short-circuiting the sensor output to ground. When the sensor output goes high your opto and LED1 are reverse biased. It should never work. Is the sensor PNP or NPN? Link to datasheet (in your question), please. \$\endgroup\$ – Transistor Jan 23 at 18:32
  • \$\begingroup\$ "when I detect metal object voltage at zener diode (3.3V) is 0.70V which is fine but when I connect microcontroller GPIO pin to read them voltage at same point (zener diode 3.3V) is .254V." - Connecting the MCU should make no difference if the port pin is an input, unless a pull-down is activated. Which MCU are you using, and which I/O pins are the sensors connected to? Can you show the port initialization source code? \$\endgroup\$ – Bruce Abbott Jan 23 at 18:57
  • \$\begingroup\$ @Transistor I have edited the question and when sensor detect metal it gives 0 otherwise 1 \$\endgroup\$ – user274774 Jan 23 at 19:25
  • \$\begingroup\$ That doesn't tell me if the sensor is PNP or NPN. Why not include the datasheet link? \$\endgroup\$ – Transistor Jan 23 at 19:37
  • \$\begingroup\$ And why is the image sideways? :^? \$\endgroup\$ – Transistor Jan 23 at 20:29
0
\$\begingroup\$

... four of them work fine and two show very unreliable behaviour.

That means either:

  • you have a mistake on two of the boards.
  • your design is on the edge of not/working.

When I detect metal object voltage at Zener diode (3.3V) is 0.70 V which is fine but when I connect microcontroller GPIO pin to read them voltage at same point (Zener diode 3.3 V) is 0.254 V and some time when there is no metal detection voltage at (Zener diode 3.3 V) is 1.154 V but it should be 3.3 V.

Numbering the components ZD1, ZD2, R1, R2, etc., makes it much easier to discuss the circuit. However, connecting the MCU pin to the 3.3 V Zener should not load the circuit unless the GPIO is programmed as an output.

General comments:

  • The 24 V Zener shouldn't be required if you are running on a good 24 V supply. If you do get an overvoltage there is nothing limiting the current so it will probably overheat and die. Also note that if is a ±5% device that its breakdown voltage could be < 23 V so it will be on all the time so you may be just lucky if you haven't seen smoke yet. If you really feel you need overvoltage protection then put ZD1 as shown in Figure 1.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. D1 provides over-voltage and reverse polarity protection.

  • Connecting LED1 in series with the opto-LED saves a couple of components and LED1 gives an indication that current is actually flowing through OPTO1.
  • The 3.3 V Zener diode does nothing for you other than cause another possible hot component since its breakdown voltage is the same as the supply. Your pull-up is to the microcontroller's power rail anyway so if you get a high voltage from the pull-up then it's most likely that the MCU is cooked already.
  • I've used different ground symbols to indicate that the circuits are isolated. It's not clear from your diagram whether or not this is the case.
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.