2018 Energy Meter


I had an old fashioned power meter with the spinning disk but wanted to get my power usage into Cacti.
I fashioned this cheap sensor and it worked ike a charm.
You can find this information with images, video and 3D files on my Thingiverse.

Components used:

Arduino Nano V3
BTE16-18 IR Reflection sensor
10µF capacitor
3D printed sensor case (Thingiverse)


VCC -> 5V
OUT -> Pin D2

RST of the arduino is bridged to GND with a 10µF capacitor to prevent the Arduino from resetting when a serial conection is established (this works on a Nano V3 but different methods apply to other Arduinos). You MUST pull this capacitor if you want to upload code to the Arduino.

The IR will reflect off the plastic housing of the meter and it will be impossible to callibrate if you do not isolate the IR emitter. I just made a small tube out of some electrical tape that fits just around the emitter an sits flush against the plastic window; this fixed all callibration issues.

The sensor should be set up to look at the shiny side of the spinning disk. When the black stripe comes by it wil trigger the sensor (='tick'). The arduino will keep track of the ticks and the count can be read throught the USB serial interface of the Arduino. After connecting, issue command 'c' (count) to read the current count or 'd' (delta ... seemed logical at the time) to read the current count and reset the counter.

Shell code to check current tick count only:

echo 'c' > /dev/ttyUSB0
ticks=$(head -n 1 /dev/ttyUSB0)
echo "ticks:$ticks"

Shell code to read current tick count and reset the counter:

echo 'd' > /dev/ttyUSB0
ticks=$(head -n 1 /dev/ttyUSB0)
echo "ticks:$ticks"

Arduino code for Arduino Nano V3:

int buttonPin = 2;
volatile int buttonCounter = 0;
int buttonState = 0;
int inByte = 0;

void countButtonPresses();

void setup(){
pinMode(buttonPin, INPUT);

void loop(){
inByte = Serial.read();
switch (inByte)
case 99:
case 100:
buttonCounter = 0;

void countButtonPresses()

You can also find this information on Thingivierse.