I am trying to design a sensor to read the pulses on my electricity meter. The meter has 1 LED that gives 1000 pulses / KWh. Each pulse is 30ms in width. I am using a phototransistor and a LM311 to reshape the signal into clean 5V pulses.
Challenges:
- there is a sheet of plexiglass in front of the meter, which forces me to place the sensor some 3cm away from the pulse LED.
- The meter has another LED that is always on, consequently shifting the output of my sensor some 120mV up.
Here is the Kicad schematics. The phototransistor has been scavenged from another circuit so I do not know the part number.
and some scope traces
Basically I am trying to detect the edges of the input pulse, shift them to 2.5V then apply them to the comparator that was set up with a 400mV hysteresis between 2.7V - 2.3V.
In the datasheet it says that the recommended input voltage Vi
is between VCC– + 0.5
and VCC+ – 1.5
. Theoretically, S2
could go above 5V and below 0V.
How can I implement a simple circuit to limit the up and down excursions of S2
to be between 2V
and 3V
?
Are there any other obvious issues with this design?