Skip to content

Simple USB power usage monitor with just a split-coil current transformer and a microcontroller

License

Notifications You must be signed in to change notification settings

rodajc/USB-power-meter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

USB-power-meter

Simple power usage monitor with just a split-coil current transformer and a ATtiny45 microcontroller.

Hardware

To use this USB power usage monitor simply clamp a split-coil current transformer like the SCT013-000 in the picture onto the electric cable to be measured.

SCT013-000 and ATtiny45

The current transformer generates a current in the secondary coil that is proportional to the current going through the primary coil which is proportional to the apparent power usage assuming a resistive load.

The challenge is to measure the current and make it available through USB. The first step is to convert the current to a voltage by connecting a load resistor to the secondary coil. The result is an AC voltage.

The trick is to take many samples and calculate the average of the absolute values.

ATtiny45 microcontroller

The bipolar differential ADC of the ATtiny45 microcontroller can handle this without additional hardware. And connecting it to USB is very simple thanks to the V-USB project. Only three resistors and a decoupling capacitor are needed.

ATtiny45 circuit

Firmware

The rest is done in firmware. Not even an external crystal or resonator is needed as the internal RC oscillator is used. It is calibrated by the firmware at power up.

The firmware samples during approx. 200 ms, i.e. 10 waves @ 50 Hz. The sum of the samples is divided by the number of samples (approx. 1600) to achieve the average voltage. This is proportional to the RMS voltage which is proportional to the current and therefore to the power usage.

Command line tool

On the host a command line tool called tinysct retrieves the result from the microcontroller through USB.

Documentation

All documentation (e.g. how to calculate the load resistor), firmware, command line tool and schematics are available in this repository.

SCT013-000 mounted in dsitribution panel

About

Simple USB power usage monitor with just a split-coil current transformer and a microcontroller

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published