All Power Labs

A couple of weeks ago I visited All Power Labs over in Berkeley CA on the recommendation of Ken Boak who went over there for a workshop in March. All power labs are:

“ incubator for open source energy experiments and distributed manufacturing solutions. We work to generate physical tools and information resources for people exploring alterative energy through DIY innovation and online collaboration. We believe that a bottom up, participatory ecology in energy is just as possible as it has been in computing. And we expect the impact of such creative self-determination will be no less transforming than its been in digital realms.”

Their current main project is called the GEK gasifier, (Gasifiers Experimenters Kit). The GEK gasifier converts biomass (woodchip etc) into wood gas, this gas can then be run in a car or burned for heating or used to generate electricity by running a gas turbine (they have a gas turbine!)+ generator or internal combustion engine + generator. The gasifier+engine+generator combination is called the Power pallet and can produce 10kW.

Bear Kaufmann who is investigating the performance of the system was looking for energy monitoring equipment and so Mario and I went over to see the operation and work with Bear on getting some energy monitoring working.

The generator they are using is a single phase 3-wire generator that is effectively the same configuration as household electrical wiring in the states. The energy monitoring setup therefore consisted of 2 CT sensors for current measurement: one for each leg a step down transformer for voltage measurement.

The power pallet has a gasifier control unit (GCU) which is based on the Atmel ATmega 1280 which is used in the Arduino Mega and so the unit is compatible with and uses the Arduino IDE for programming. The GCU has a lot of things happening on it: it monitors temperatures and pressures and controls things like flow to keep the gasifier working efficiently, there are critical servo updates that happen about every 20ms and so the main challenge of the visit was to try to fit the energy monitoring on to the GCU, to fit the real power, apparent power, powerfactor, vrms, irms sampling and calculation into those 20ms time slots. Up until now I have usually had the arduino dedicate around a second to make these measurements and so the question was could we squash the energy monitoring down and still get accurate results. Luckily we found we could do this, by taking one wavelength long samples and then averaging around 10 of these one wavelength samples to get a more stable result and so now the power output and efficiency of the power pallet can be tested with out a lot of extra equipment just a couple of sensors, resistors and capacitors connected to the GCU.

Here's a test output with different loads:

For more information have a look at Bear's post and write up here:

I will also try to upload the code for single phase 3-wire and the one wavelength sampling soon as I get a chance.

Mains AC: non-invasive version 3.0 up

The documentation for version 3 of the Mains AC: non-invasive energy monitor is up. It can be found here:

The main changes are:


  • 2x 10uF bias stabilizing capacitors added significantly improving accuracy: more info
  • Changed Voltage measurement circuit
  • Power for arduino comes from a seperate transformer to AC voltage measurement transformer.


  • Arduino sketch rewrite, sketch now follows Atmel's AVR 465 app note method, adding:
    • Phase calibration
    • Digital high pass filter to remove offset.


  • Much simplified calibration
There is also new more detailed documentation with this version, including separate pages on:

I've also done a bit of re-arranging of the documentation layout, trying to make the website a little easier to navigate, if you have any suggestions on this they would be very welcome.

Mission Science Workshop Project

I'm currently in San Francisco :) I'm here helping an organisation called Mission Science Workshop, who are interested in developing a course based on the energy monitor for high schools. The idea is to use the arduino and computer based graphing/logging as a platform to make scientific measurements of things like: voltage, current, power, energy, temperature, light, etc, that can be used in workshops to make it possible to see useful, interesting phenomenon and demonstrate the use of computers in science. Mission Science Workshop teach science in a very hands on, experiential way, trying to keep kids curiosity alive and sparking their interest in science. Have a look at their website here:

I'm working with Mario Landau Holdsworth from mission science on the project, he teaches at Mission Science and has a keen interest in Arduino's, energy monitoring, electric cars, mycelia and teaching science in a fun way. He has been very kind to sort out the whole visit.

As a part of the mission science project I gave a short workshop on the energy monitor last Friday. For the workshop I did a bit more work on the energy monitor design and tried to improve the documentation a bit, creating a printable energy monitor guide. I'm going to upload these to the main website today, but here are the printable pdf's for the mean time:
I'm in the San Francisco area until the end of the month, working on the project and going hiking around marin county and hopefully Yosemite, if your in the area, Mario and I will be down at Mission Science building things so let us know if you'd like to come and have a look.

Reducing noise, adding a capacitor

I recently bought a new laptop and when I plugged it in to the mains and connected up the energy monitor via usb and monitored the current of one light the current value it read was much higher than what my reference meter said it should be. I got the following results:

Load description: One light
Energy monitor power supply: Laptop mains connected.
Energy monitor: 1050mA reference meter: 189mA

Load description: One light
Energy monitor power supply: Laptop running off battery.
Energy monitor: 186mA reference meter: 189mA

I loaded up the waveform sampler program to see what was going wrong and saw this when the laptop was connected to the mains:

When the laptop was not connected to the mains the fluctuations largely disappeared.

I then checked to see what the energy monitor would read when powered by an external supply rather than the laptop supply. The energy monitor was now a lot closer to the reference meter than before:

Load description: One light
Energy monitor power supply: External power supply
Energy monitor: 225mA reference meter: 191mA
The laptop is not connected to the mains here.

Load description: One light
Energy monitor power supply: External power supply
Energy monitor: 215mA reference meter: 191mA
The laptop is connected to the mains here but on a separate plug socket.

Interestingly the laptop still produces an effect even when its plugged into another socket not part of the measuring setup. The other thing to note is that the energy monitor current is higher by about 20-35mA with the external power supply than when powered by the laptop running off its battery.

It would clearly be nice to get rid of the noise when the laptop is connected to the mains and the difference in measured current between the different power supplies.

Reading through the Atmel AVR465 application note, they use a 10uF capacitor across the biasing voltage divider to stabilise the DC level. I added the capacitor and low and behold the noise and difference in power supplies disappeared and now the results are much better :) The energy monitor now reads

Load description: One light

Energy monitor power supply: Laptop mains connected.
Energy monitor: 194mA Reference meter: 191mA

Energy monitor power supply: Laptop running off battery.
Energy monitor: 194mA Reference meter: 191mA

Energy monitor power supply: External power supply.
Energy monitor: 193mA Reference meter: 191mA
The laptop is not connected to the mains here.

Energy monitor power supply: External power supply.
Energy monitor: 193mA Reference meter: 191mA
The laptop is connected to the mains here but on a separate plug socket.

The variation between power supplies and the effect of the noisy laptop power supply is significantly reduced.

Here's a screenshot measuring the same lamp as I was measuring above with the energy monitor powered from the laptop connected to the mains but now with the 10uF capacitor across the 2.5V bias:

Very steppy but this is due to the small magnitude of the signal versus the ADC resolution which is expected, the large noise fluctuations have disappeared.

Here's the new circuit diagram:

Component values

CT sensor turns ratio – for the efergy sensor seems to be 1:1500 which means the current in the secondary windings will be 1500 times less than the current in the mains primary winding.

RsensI - Dictates the range that the current can be read over.

  • 56Ohms gives a current range of 0 to 47Amps (with efergy CT, turns ratio: 1500)
  • 100Ohms gives a current range of 0 to 26Amps (with efergy CT, turns ratio: 1500)

C1 – The bias stabilizing capacitor.

  • Noise decreases as the capacitor size increases.
  • Energy monitor start-up time increases as capacitor size increases – this is the time taken for the capacitor to charge, measured as the time it takes for the current measurement to reach within 20mA of the final value. Only a noticeable delay the first time you put the energy monitor on.
  • Atmel recommends a 10uF capacitor in their AVR465 app note.
  • 10uF works well, I tried a couple of other values and there doesn't seem to be a very noticeable difference at 4.7uF, 1uF, 0.1uF, needs further testing to establish exactly how much difference there is between the values.

Rvd – 2x equal sized voltage divider resistors

  • Increasing the resistor size decreases current consumption in the voltage divider.
  • Increasing the resistor size increases noise due to high impedance.
  • Increasing the resistor size increases the energy monitor start-up time due to charging of C1.
  • 2x 100k resistors and a C1 of 10uF gives a start-up time of 16s.
  • 2x 10k resistors and a C1 of 10uF gives a start-up time of 4s.

I've also removed the 100Ohm current limiting resistor from the above circuit as I'm not sure that it was really doing anything, I put it in there out of general practice, feel free to use one if you like.

Its also worth adding a 10uF capacitor on to the voltage measurement circuit in the same place. I will discuss that in more detail soon along with some other changes to the voltage measurement electronics.

Application Notes

Been realising what a great source of information application notes are, when I started this project I didn't really know were to look to get good information on energy monitoring but I think I'm slowly getting better at it now :) I've put together a page here:

which is full of links to application notes. Thanks to Danny for the link to the AVR-465 note on creating an energy monitor with an atmel micro. Its even got open source firmware details there and an interesting use of opamps to increase accuracy at low current ranges which I'd like to try at some point.

If you know of any other good resources, Id be interested in knowing about them, please post them below, thanks!

Maker Faire Newcastle

I will be at Maker Faire 2010 in Newcastle this coming weekend (March the 13th-14th) and will be exhibiting the energy monitor, should be a fun event! drop by if your in the area.

ArduinoPower - ADE7753

Last year I met James Devine at homecamp a home hacking, automation and green technology unconference in London. He has been developing an arduino energy monitor based on an Analogue Devices ADE 7753 IC which is a custom energy meter IC for use with CT sensors. The ADE7753 looks like a really good way of doing the measurement, it communicates with the arduino via SPI and does all the energy metering calculations itself, therefore freeing up the arduino for other tasks.

Here's a mockup picture from his site of the energy metering arduino shield that he is developing:

His project aim is to create an accurate desktop scale power meter, suitable for measuring individual power usage at a desk, the power meter then communicates with a PC I think via the arduino bluetooth shield and it's all open source, have a look:


I've just set up a forum here:

It might be easier to use than the comment pages on the website and a bit easier to see what's going on.