Further investigations with Optical Pulse Sensor connected to emonTH. No external pull-up or pull down resistor connected for these measurements, but a 0.1 uF capacitor left connected between IRQ and Gnd.
- Vcc = 3.346 V
- Virq with sensor in darkness = 0.745 V
- Virq with sensor illuminated = 3.333 V BUT the LED on the sensor can be misleading ie in partial illumination Virq varies with light level but the sensor LED remains off. In partial illumination Virq can be as high as 3.330 V (ie high) and the LED still off. I expect this is one reason I was getting spurious counts – as I moved the sensor the LED said it was in darkness but was still getting enough light to be seen as a high.
- Pulse count only increments on a positive edge of the IRQ. IRQ is normally low when the sensor is plugged in, and goes high when there is light on the sensor. This initially threw me, since if the sensor is unplugged the internal pull-up raises Virq to 3.336 V.
- Using a 1 k ohm resistor connected from IRQ to ground, with the sensor illuminated, 2.58 mA of current was drawn. Voc = 3.333 V therefore the internal source resistance = 292 ohm.
- Using a milliameter connected from IRQ to ground, with the sensor in darkness, 0.08 mA of current was drawn. Voc = 0.745 V therefore the internal source resistance = 9.3 k ohm (ignoring meter internal impedance). Similar source impedance is seen if testing from IRQ to Vcc.
- Looking at the numbers above, an additional external pull-up or pull-down resistor is not needed for noise elimination, but I still think will influence sensitivity – hard to go further without a circuit diagram. I’ll still keep the 0.1 uF cap to try and filter any spurious noise.
- Have run with the 0.1 uF cap for a few days, and pulse counts align with meter readings. Have only used a few kWh so need to let it run for a bit longer.
[Update - June 2020: A circuit diagram of the sensor is available: First try with EmonPi - Pulsecount stuck at 1 - #16 by Robert.Wall - RW]