Mazzini Monitors Its First Appliance

This past week the Mazzini project, my controllable electricity monitor, has taken a great step forwards. The initial hardware prototype I talked about earlier has undergone a few tweaks and is now soldered up rather than push-fitted together on breadboard. It's also boxed up in a not-too-pretty but suitably environmentally-sound reused ice-cream tub, which means I can leave it running without fear of anyone accidentally coming into contact with 240V AC.

Picture of the Mazzini prototype board

The couple of wires you can see dangling over the edge of the box are all from the low-voltage, Arduino side of things and are completely electronically isolated from the mains. They hook up to the light and temperature sensors, which I obviously want to measure the conditions outside the box. I'll be moving them to a better location next time I break out the soldering iron.

But the bigger advances have been made on the software side.

The Arduino board measures the voltage and current a thousand times each second, and uses that to work out the power used. Every five minutes it then reports how much power has been used, along with the temperature and light level, over a Zigbee wireless networking channel to a receiver plugged into my server. The server then sticks the readings into a database and uploads it to a Pachube feed.

That gives me an easy way to get pretty graphs showing how the power usage, light level and temperature have varied over time - like these:

Picture of the graphs showing the temperature, light-level and energy usage as measured by the Mazzini prototype

It also means that anyone can have a look for themselves at the live feed from the Mazzini prototype. It's currently monitoring my home file and email server.

What Next?

There are still a few things to add to the prototype, and a couple of bugs to iron out, but I'm starting to look ahead to what happens next.

I've just ordered some parts to let me build a second prototype, which will add a relay to let the Arduino control whatever is plugged in, and also let me update the software to cope with multiple monitors talking to the server. In the longer-term I'll extend one of the units with the new Arduino ethernet shield so it collects all the data for the monitors,
uploads it to Pachube, and removes the need for an always-on PC (not the most energy efficient way of collecting the data, although mine is doing other things 24x7 already).

I'm also looking into ways to make the Mazzini modules more widely available. Making my house more energy-efficient and energy-aware is interesting, but isn't going to make a huge difference to the world. Imagine how cool it would be if anyone could buy one of these and start to monitor and control the appliances in their home or workplace. It would also let me devote more time to working out how to monitor other things, like gas or water usage, or to find better ways to visualize how much energy we consume.

However, I'm still planning to make the hardware and software open source. There are just far too many possibilities for interesting and novel uses that I've not thought about.

How You Can Help

Tell people you think might be interested. Tell me what you think of the idea, or what you'd do with one. Let me know if you want to buy one - either a fully finished hardware model or just the power-monitoring board that you'll box up with your own Arduino. I'm not going to assume an expression of interest is a definite order, I just want to gauge how much interest there is. It'll be a while anyway before complete units could be available, although the hardware-hacker boards would be released sooner.

Finally, if you want some ASAP or if you want something similar but tailored more to your situation, hire me to build it for you.

Hello Adrian!! I found your

Hello Adrian!!

I found your project through Arduino forum and I found it really interesting. I am thinking about developing such thing but I have some difficulties. Could you post your code if you don't mind?

Thank you very much,

I'm working on a very

I'm working on a very similar project. I'm an interaction designer so I'm developing it from an usability and interface point of view.
For my thesis though, I would like to make a very simple prototype. I altready connected arduino to flash to try the interface, now I just need a sensor to get the istant w consumptions a simple circuit (let's say with 3 60w light bulbs) for demo and presentation purposes.

I dont need the wireless stuff, what I need is just an energy consumption meter that possibily works without the need to cut the high current wires (same principle of this device that sends the data directly into analog input.

I will give you credit for you collaboration and also I'm willing to pay a reasonable price if you are able to help me (I'm a student). So tell me if, how much and when. Do not spread my email.

If our collaboration works maybe there's more to do...

I think this project is

I think this project is great. It is what I'm trying to hack together with bits from around the house for my current project. I would definitely be interested in buying one if the price was right.

You are too modest on this,

You are too modest on this, such a device is a real necessity for many of us. This monitor could have countless industrial or household applications. Tracking electricity consume on household appliances is something technologists work on for a while now, you could contribute to such projects.
Darren, Kenmore Parts

Hi, I would really like to


I would really like to know how you were able to store voltage and current a thousand times each second. I have a project that requires me to sample voltage 240 times a second for up to 15 seconds and I'm running into memory limitations with the Duemilanove.

Are you storing each sample as a byte in memory or as an integer? Are you storing your data in EEPROM or SRAM?


Hi John, I'm not actually

Hi John,

I'm not actually storing all the values that frequently, just calculating things that often. The code then works out an average or cumulative value (depending on the type of data), so the memory requirements aren't that high. I did have some code just logging data values to memory but soon ran into the sort of problems you're seeing.

Could you maybe output the data over serial and store it elsewhere? And possibly just use a buffer on the Arduino to soak up any difference in bandwidth? Or another option could be to look at the Adafruit GPS logger kit and see if you could repurpose that to log the data you're gathering rather than GPS data.

Hope that helps,


Gerryk : Right on about the

Gerryk : Right on about the ethernet RF problems. The idea of transmitting energy usage data and on/off signalling over the powerline doesn't require the high frequencies of PLC/BPL and a far slower protocol like X10 would do just fine. I'm looking for circuit diagrams for building an X1O type interface for an Arduino or even a homebrew low freq tx/rx circuit.

Robert : Your idea of using an ADE7757 still seems good and its not clear to me what advantages the Mazzini offers over this. The Arduino is not doing any measurement and contents itself with the smart business of data mashing and communication.

This looks amazing. I'm

This looks amazing. I'm definitely interested in the shield and software. We run only via diesel generator, so monitoring power would be to great advantage.

Keep us posted.


Excellent work, when do you

Excellent work, when do you think you'll have the circuit diagrams available ? The project I'm thinking of is two fold. Firstly, use the Arduino to measure electricity usage, this is just what you've done, so saves me all that work, thanks ! Secondly, use the Arduino to communicate over the power-line to a second Arduino which has an ethernet shield. This second Arduino uploads the data to my database/Pachube/whatever. A third Arduino, communicating over the powerline, could be used as an energy monitor, driving ouptut to an LCD or summat. If the powerline communication can be sorted out its a better candidate than zigbee IMHO. In the perfect world, this is what the new plug would do, monitor power usage, transmit usage data, switch on/off as needs be.
Keep up the good work / Colm

I'm not sure exactly when

I'm not sure exactly when things will be available, but I'm hoping it will be measured in weeks rather than months.

The powerline Ethernet solution sounds like the ideal answer, but there seems to be a lot more activity in the Zigbee arena these days, and I think it's also turning out to be the cheaper option. It also makes it easier to include sensors and devices in places where you don't have mains - I'm hoping to add measurement of the gas meter sometime, and mine is outside in a box!

A second Arduino is also in the pipeline. I want to get the initial hardware finished first, but not everyone will have a server already on 24x7 to do the logging, so an Arduino + XBee shield + Ethernet shield would be a much more power efficient solution to act as the Zigbee <-> Internet gateway.

Hello Adrian Great work with

Hello Adrian

Great work with your energy monitor! Im also working on an energy monitor project at the moment, using what looks like a similar circuit to yours. Ive been following the cornell energy monitor design:
But using an Arduino. Ive written some software in java to do power logging and voltage/current waveform viewing.
Im interested in helping to create an open source collaborative website on energy monitoring, something similar to but for energy monitoring.
If you would like some help with creating something like this for Mazzini I would like to help.

Great Project!


Hi Colm... the one issue I

Hi Colm... the one issue I would have with your idea is that powerline-ethernet is a huge generator of Radio Frequency Interference. Powerlines generally (in fact, almost always) have no shielding of any sort, and why should they? The problem arises when you impose an RF signal (which ethernet is, being in the high HF to VHF part of the spectrum). This signal causes your entire house wiring to act as a broadcast antenna, and often, quite an efficient one.
The state of the airwaves currently is in bad enough shape, with the likes of Plasma TVs, poor quality switching power supplies and the mire that is the 2.4GHz band. Any form of powerline networking will make things much much worse, and I would implore you, and anyone else looking at powerline networking as a solution, to look elsewhere.

Great... love it. Can't wait

Great... love it. Can't wait for a publicly available version, or better yet, plans.

Well, with the second

Well, with the second prototype up and running I'm getting much closer to having units available. I'll be sure to post more news to the blog once there is some :-)

Have you seen the

Have you seen the plogg?

I've got one and it works great
(I'm not paid to say this!)



Hi Finn, Would it be

Hi Finn,
Would it be possible to share your configuration using Plogg? I am doing a project on studying human behavior in response to such measurements.


I'm sure it works extremely

I'm sure it works extremely well, however, I'd bet that the reason this project was started was as much to learn about arduino and embedded design as it was to actually monitor a powerline.
Consumer products do little to teach us, but building your own... that's an education that no institute can match.

Hehe. I think you're both

Hehe. I think you're both right. When I started I hadn't heard of the Plogg, but it was also a great (if a bit like throwing yourself in at the deep end!) way to learn about Arduino.

Sorry for my very bad

Sorry for my very bad english, but I have to say that: arduino is "opensource" if you use it you have to share HW & SW before starting your to-sell production.

Anyway the project looks really great, continue to implement!
I'm making something similar for my 12V (motorhome) caravan :)

From my understanding of the

From my understanding of the licencing of Arduino and the libraries, it isn't strictly true that any project using it has to share the HW and SW. The libraries are released under LGPL, which means that they can be used by closed-source projects. That said, I'm still starting from the position that an open-source approach is best and there'll need to be good arguments to prevent that being the case when the Mazzini stuff is finished.

First off, apologies for the

First off, apologies for the time it's taken me to reply to some of the comments - I wasn't getting any notifications that the comments had been posted, and so have only just seen them all.

Peter: At present I'm using the Maxstream XBee modules because there's a readily available "shield" to add it to the Arduino. The XBee module is only used for communication, the actual sensing is done by the hardware I've built and the calculations of the power usage, etc. is done by the Arduino board.

Ken: After attending Homecamp at the end of last year, I have thought about measuring the mains frequency but haven't tried to do so just yet. Once I get the next prototype up and running (which has the ability to turn the power on or off) I want to try measuring the mains frequency and turning the attached device on or off automatically based on the load on the National Grid.

Robert: It would be perfectly possible to measure the power per minute with Mazzini. At present it reports the consumption every five minutes, but it would be a trivial change to measure make the reporting every minute instead.

Al: Thanks. I see you're planning on going to the next Homecamp, so I'll see you there if not before.

Brian: An Arduino would be a perfect match for your needs. It's got enough inputs and outputs, and you could easily hook it up to a Linux box via either USB or something like the XBee boards I'm using here. In fact the Mazzini prototype talks to a Linux box which then uploads the data into a database and to Pachube.

We are interested in such a

We are interested in such a device. It would need simple software to monitor 4-6 analog signals (incl. pulses from energy meters), and 6-8 digital outputs. Ideally, it would run on a Linux machine and feed data into SQL type of applications.

thank you,

Hi Adrian This is really

Hi Adrian

This is really cool work, I would love to get together and talk about it some time soon.

I am working on similar projects for the low powered DC end, I'm sure we could help each other out.

P.S. you might also want to check out one of my other projects

lets talk


I am very interested in this

I am very interested in this project. I am doing an MSc in Advanced Environmental and Energy Studies at the Centre for Alternative Technology in Wales, and for my thesis I want to investigate the factors affecting the energy consumption of domestic refrigerators, which consume about 23% of UK household elecricity, and 7% of overall UK electricity. I want to monitor EVERY MINUTE for 24 hours temperatures inside and outside a refrigerator, door openings, and energy usage. I think I can manage all of this, using the Arduino, except for the energy monitoring. I was looking into using an ADE7757 energy monitoring chip which gives a pulsed output. I then came across your system which is working with an Arduino.

Can you give me any information on the accuracy of your energy readings? Is it possible to use you circuit for monitoring the energy used in each minute over a 24 hour period?

Many thanks


Great Project! Have you

Great Project!

Have you thought about adding a frequency measurement input to monitor the national grid frequency?

This tells you how hard the UK grid is working or struggling to keep up with demand.

>50.00 Hz means spare electricity available, <50.00 Hz means grid is struggling with demand.

See "Dynamic Demand" website.


I'd be really keen to find

I'd be really keen to find out more about this, in perticular how it works with Zigbee, and the Zigbee sensor you are using