Power meter sensor from BTE16-18 & Arduino Nano V3
thingiverse
I have an old-fashioned power meter with a spinning disk, but I wanted to get my power usage into Cacti. I fashioned this cheapo sensor and it works like a charm. Sensor Used: BTE16-18 IR Reflection Sensor from Aliexpress (https://goo.gl/4wDt8Z $0.78) Connections: Sensor->Arduino VCC -> 5V GND -> GND 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 connection 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 calibrate 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 and sits flush against the plastic window; this fixed all calibration issues. The sensor should be set up to look at the shiny side of the spinning disk. When the black stripe comes by it will trigger the sensor (='tick'). The Arduino will keep track of the ticks and the count can be read through 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: #!/bin/sh echo 'c' > /dev/ttyUSB0 ticks=$(head -n 1 /dev/ttyUSB0) echo "ticks:$ticks" Shell Code to Read Current Tick Count and Reset Counter: #!/bin/sh 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); Serial.begin(9600); buttonState=digitalRead(buttonPin); attachInterrupt(0,countButtonPresses,FALLING); } void loop(){ while(Serial.available()==0){} inByte = Serial.read(); switch (inByte) { case 99: Serial.println(buttonCounter); break; case 100: Serial.println(buttonCounter); buttonCounter = 0; break; } } void countButtonPresses() { buttonCounter++; }
With this file you will be able to print Power meter sensor from BTE16-18 & Arduino Nano V3 with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Power meter sensor from BTE16-18 & Arduino Nano V3.