2
\$\begingroup\$

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:

  1. 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.
  2. 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.

enter image description here

and some scope traces

enter image description here

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?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Why do you have such a short time constant (~6ms) for coupling a 30ms pulse? Do you want double pulses from the comparator? \$\endgroup\$ Jun 5, 2023 at 10:20
  • \$\begingroup\$ Your S1 waveform doesn't appear to be shifted by 120 mV \$\endgroup\$
    – Andy aka
    Jun 5, 2023 at 11:22
  • \$\begingroup\$ @Andyaka "Your S1 waveform doesn't appear to be shifted by 120 mV" That depends on the exact position of the sensor relative to the two LEDs. I have a test jig on my workbench to simulate the actual meter setup. \$\endgroup\$ Jun 6, 2023 at 19:29
  • \$\begingroup\$ @SpehroPefhany I am trying to detect both the rising and falling edge then recreate a pulse with the same width at the output of the comparator but with a 0V to 5V amplitude. However, now that you have mentioned it, I've realised that there is no useful information in the width of the pulse. All the information is in the timespan between two consecutive pulses. Potentially, I could just detect one of the edges and generate a pulse out of it. \$\endgroup\$ Jun 6, 2023 at 19:50

1 Answer 1

2
\$\begingroup\$

If you want to attenuate the amplitude of signal arriving at the comparator input, you could simply increase the source's resistance, by adding a series resistor. The potential divider R1 and R2, providing 2.5V bias, has an equivalent impedance of 50kΩ, as is evident from the Thevenin equivalent:

schematic

simulate this circuit – Schematic created using CircuitLab

Adding 50kΩ of resistance between the signal source and this 2.5V source will halve the the signal amplitude:

schematic

simulate this circuit

Here the input signal, a 5V/0V square is blue, the unnattenuated, differentiated signal at X is in orange:

enter image description here

This is the potential at S2:

enter image description here

Simply choose R5 for an appropriate level of attenuation.

It might be better for you to adjust the bias potential at S2 to be right in the middle of the comparator's acceptable input voltage range. From the datasheet, the range seems to be between 0.5V above the lower supply, and 2V short of the positive supply:

$$ V_{S2(DC)} = \frac{(0V + 0.5V) + (5V - 2V)}{2} = +1.75V $$

Modify R1 and R2 (and of course Rx1 and Ry2 to match) to obtain about +1.75V bias. I've done that here, and also increased R5 for more attenuation:

schematic

simulate this circuit

enter image description here enter image description here

As you can see, the signal never exceeds the permissible range of input potentials, +0.5V to +3.0V, and is also centered within that range.


Update

To limit excursions by clipping/clamping, rather than attenuating, one way would be to use zener diodes:

schematic

simulate this circuit

enter image description here enter image description here

You still require R5, to allow the diodes to conduct without large currents flowing, but by making it small compared to R1 and R2, attenuation is very low. D1 prevents S2 from falling further than 4.3V from the positive supply, and D2 prevents S2 from rising more than 3.0V above ground. In practice, with such low diode currents, clamping will begin slightly within those bounds.

\$\endgroup\$
2
  • \$\begingroup\$ Adjusting the bias to be in the middle of the comparator's acceptable input voltage range is a very good point. Regarding the 0.5 attenuation, if the sensor is not perfectly aligned with the pulse LED the input signal at s1 will be less than 500mV. I am thinking that maybe I do not want to attenuate s2. I would like to chop it to a min and max value \$\endgroup\$ Jun 6, 2023 at 5:10
  • \$\begingroup\$ @DanCorneanu I've added a clamping solution to my answer \$\endgroup\$ Jun 6, 2023 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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