Measures the power consumption by counting LED pulses from the home fuse box. Measurements can be read via a serial interface, uses the AVR ATtiny2313 microcontroller.

Table of contents

Details

In Norway we have a LED in our home fuse boxes that flashes a defined number of times per kW, this unit measures the home power consumption by counting those pulses. This is calculated into kW and can be read from a computer over the serial interface. In addition to this unit you will need a sensor to read the LED, that is not covered in this project. It is important that this sensor is accurate to get precise values.

Inside unit, during assembly
Inside unit, complete

Values

Calculation

The consumption is measured in kW and calculated by dividing the number of LED pulses by 500 (500 pulses pr. kW). The registration will continue as long as the module receives a signal from the sensor.

Storing values

Two values are stored in EEPROM; current and previous consumption. By sending a command over the serial interface the current value can be moved to previous and cleared. This makes it possible to compare the current period with the previous. Values are written to EEPROM every hour, and restored during boot. This means that in the event of a power loss you could lose up to one hour of monitoring.

On first start up the unit will show -1 kW for both current and previous usage, this can be cleared by moving current to previous two times. Or you can enter a current value manually. Correct EEPROM values will then be stored one hour after the first signal is received.

Reading values

It is possible to use the serial interface directly to read and move consumption values. But ideally an external system, like a computer or Raspberry Pi, could pull values at set intervals. This would make it possible to create graphs and trends over time.

Video

I/O

Input pins

  1. PB.0 Sensor

Output pins

  1. PB.1 Run LED
  2. PB.2 Signal LED

Connectors

Power connector

2,5 mm, 9-12V=, positive center.

9-pin Sensor

  • 6 : 5V + out
  • 7 : 5V - out
  • 8 : 5V + sensor in
  • 9 : 5V - sensor in

9-pin RS-232

  • 2 : Transmit
  • 3 : Receive
  • 5 : GND

Serial

Terminal communication

Forbruksmaaler v.1.0
JensenCorp 0704001

Press 0 for help

1 - Current usage
2 - Previous usage
3 - Enter starting point
4 - Move current to previous

Current usage will be deleted! (0 to cancel)
Enter starting point in kW : 100
100 kW saved
100 kW current usage (50000 pulses)
100 kW moved to previous
100 kW previous usage
0 kW current usage (0 pulses)

Serial settings

  • Baud: 9600
  • Data bits: 8
  • Parity: None
  • Stop bits: 1

Source code

Schematic drawing

Home power consumption measuring unit schematics

Parts list

Sensor not included.
  • 1 × AVR ATtiny2313-20PU, DIL-20, 20 MHz, 18 I/Os
  • 5 × Capacitor, aluminium electrolytic, 1 µF, 50V
  • 1 × Capacitor, aluminium electrolytic, 10 µF, 25V
  • 2 × Capacitor, aluminium electrolytic, 47 µF, 25V
  • 2 × Capacitor, ceramic, 1 nF, 100V
  • 2 × Capacitor, metallized polyester foil, 10 nF, (0.01 µF)
  • 1 × D-sub cable, pin-to-pin 5m, 9-pin male-female
  • 2 × D-sub soldering cups, 9 pin female
  • 1 × D-sub soldering cups, 9 pin male
  • 1 × DIL socket, 16-pin, 7.62mm
  • 1 × DIL socket, 20-pin, 7.62mm
  • 1 × DIL socket, 6-pin, 7.62mm
  • 1 × Diode, rectifier, 1 A, 400V, 1N4004
  • 1 × Enclosure, plastic (1591 FL), 112x62x31mm, flange
  • 1 × Fuse 5x20 mm, 400 mA, fast-acting
  • 1 × Fuse holder, open, PCB, 5x20mm
  • 1 × Fuse holder, open, PCB, Protective cover
  • 1 × Heatsink, 27.3K/W, 19mm, attachable, TO220
  • 1 × LED 3mm, Green, 2.1V, 20mA, 3.5mcd, 38°
  • 1 × LED 3mm, Yellow, 2.0V, 20mA, 2.5mcd, 38°
  • 2 × LED holder 3mm, Black plastic
  • 1 × Optocoupler, single, CNY17F-3, DIL-6
  • 32 cm2 PCB, stripboard, 100x160mm, 160cm2
  • 1 × Power jack, panel, 2.5mm, plastic housing
  • 1 × Power jack, plug-in, 2.5mm
  • 4 × Resistor, carbon film, 0.25W, 330 Ω, 5%
  • 1 × Resistor, carbon film, 0.25W, 4.7 kΩ, 5%
  • 1 × Resistor, carbon film, 0.25W, 10 kΩ, 5%
  • 1 × RS232 interface, MAX232CPE, dual
  • 2 × Spacer, round unthreaded, 3mm, Ø6mm, Delrin
  • 6 × Straight pin header, female, Dual row, 2.54mm
  • 9 × Straight pin header, female, Single row, 2.54mm
  • 2 × Straight pin header, male, Dual row, 2.54mm
  • 17 × Straight pin header, male, Single row, 2.54mm
  • 1 × Voltage regulator +5V, 2 A, L78S05CV

Last commit 2024-11-11, with message: Add lots of tags to posts.