Optical Pulse Sensor with Arduino and LoRaWan radio

Hi Everyone,

Has anyone has this sensor work on another unit?

Welcome, Tom, to the OEM forum.

You’ll need to be a bit more specific.

It’s an optical sensor. I’ve carefully omitted ‘pulse’ because, from the tests I’ve done, the output is from an amplifier with no pulse shaping and no hysteresis, so over a very limited range the output is roughly linear. Also, and almost certainly as a result of that, the green LED on the back doesn’t necessarily indicate the presence or otherwise of an output.

Bearing that in mind, it should work into any reasonably high impedance input, and I think I’ve seen a mention that a Raspberry Pi input can work with it.

Thanks for connecting Robert. I have this unit but don’t have a sensor for it.

http://www.netvox.com.tw/um/R718H/R718HUsermanual.pdf

Keen to work out a way to utilise it for pulse flashing on my power meter.

Kind Regards,

Tom Linnell

Managing Director

I think you’ll be able to get it to work, but it is going to require a bit of DIY.

The R718H manual says it requires a voltage not greater than 3 V, and gives you two input wires. It’s full of “glossy sales” blurb but says nothing else that’s useful to us for this purpose. That might actually mean that it expects a contact pair and it supplies 3 V. We don’t know.

Our sensor operates on 3.3 – 5 V, and gives you an output of roughly 0 V to the supply voltage.

Here’s what I think. You need a separate battery supply to power the optical sensor, between 3.3 and 5 V. 3 × AA or AAA cells should do nicely, or one rechargeable Li-Ion that the DIYBMS people are using - the 18650.
Then, to reduce the output to the input range of the transmitter, you’ll need a simple zener diode clamp and a current limiting resistor.

If you’re up to lashing that up, I’ll draw a diagram and calculate some values.

Thanks Robert again. I’m not an expert in this space but wanting to find ways to achieve my solution. The reason I’ve opted for the Netvox unit is because of its LoRaWan capabilities. Have you used or explored this comms technology before?

I too thought the Netvox handbook was pretty patchy, providing little technical information. The Lorawan aspect of it was why I purchased it but looking to find a way to integrate the pulse function work. Any rough sketches/diagrams would be very much appreciated!

Has the OEM community created an Arduino board which connects to the optical pulse sensor? If so, perhaps I bypass the Netvox unit and start from the Arduino but make its comms Lorawan based, rather than wifi. Possible?

Similar to the Open Enery Monitoring product, I came across this unit in the UK as well; https://www.heatingsave.co.uk/product/optical-pulse-sensor-electricity-meters/. I couldnt find much more information but looks to do a similar role.

Kind Regards,

Tom Linnell

Managing Director

Considering the paucity of useful information about the Netvox unit, even if I’d got it in my hands, it would need some investigation to find out what it’s expecting to use as the pulse sensor. It might well be a simple reed switch, or a photodiode, or an opto-coupler, or a voltage. Without having a receiver to know what it’s sending, and measuring what’s on the two wires, I can guess a few things that might work, but it’s very hard to know what will work.

The optical pulse sensor works happily with our emonTx and emonPi, the front ends of which use the same processor as the Arduino Uno (particularly), so connecting it to an Arduino board should be relatively simple - it’s a case of 1 wire to GND, 1 wire to 5 V and the last to a digital input pin.

We use the 433 MHz ISM band with the emonTx/emonPi/emonTH. I’ve no knowledge of LoRaWan, however a quick search shows there are many Arduino Shields to choose from. As there’s likely to be a lot more and more useful information down that route, I’d be tempted to say that’s the way to go.

We know very little about our pulse sensor, but it looks as if there’s even less information about that one. At least I’ve had my hands on ours and measured it.

Thanks Robert. You are a wealth of knowledge! I will jump onto your store and buy the optical pulse unit and attempt to connect it to an Arduino with a lorawan shield! Any schematics or links to github for the Arduino/optical sensor would be very much appreciated if you had anything!

Will keep in touch! You know your stuff!

Kind Regards,

Tom Linnell

Managing Director

The only problem you will have is you will need to either get an adapter for RJ45 socket to terminals so that you can wire the pulse sensor into the Arduino I/O, or you’ll need to cut the RJ45 off the sensor - the wire colours on mine are:

  • RJ45 Pin 2 - VCC - Red
  • RJ45 Pin 5 - GND - Black
  • RJ45 Pin 6 - TTL Data - Blue

Superstar!

Kind Regards,

Tom Linnell

Managing Director

I’ve no idea what will be required for the radio, for the pulse sensor we put it on an interrupt pin and use a very simple Interrupt service routine to count the pulses and send them by radio. I think the same strategy will work for you.

The pulse parts of your sketch will look something like this. You’ll need to merge this with a working radio sketch. One major caveat - it’s untested.

unsigned long totalPulseCount = 0;
volatile byte pulseCount = 0;           // Assumes less than 256 pulses per main loop
unsigned long pulsetime = 0;          // Record time of interrupt pulse        
const byte min_pulsewidth = 0;      // Set this to (say) 100 (millisec) to suppress very short pulses
const byte pulse_countINT = 1;     // INT 1 for our emonTx 
const byte pulse_count_pin = 3;    // Dig 3 for our emonTx

void setup()
{ 
  pinMode(pulse_count_pin, INPUT_PULLUP);  
  attachInterrupt(pulse_countINT, onPulse, FALLING);     // Attach pulse counting interrupt pulse counting 
 
}

void loop()
{
  if (pulseCount)                                               // if the ISR has counted some pulses, update the total count
  {
    cli();                                                             // Disable interrupt just in case a pulse comes in while we are updating the count
    totalPulseCount += pulseCount;
    pulseCount = 0;
    sei();                                                            // Re-enable interrupts
  }
}

// The interrupt routine - runs each time a falling edge of a pulse is detected
void onPulse()                  
{  
  if ( (millis() - pulsetime) > min_pulsewidth) 
  {
    pulseCount++;
    pulsetime=millis(); 
  }	
}

It has compiled, but my pulse sensor is in use, so I can’t test it.

Potential premade solution!

https://shop.skysens.io/products/remote-energy-meter-reading-deviceskyenr1

Kind Regards,

Tom Linnell

Managing Director