Meet the WattMote (Moteino based Tweet-A-Watt)

Python graph showing a cycle on my refrigerator (spikes are fridge light when door is opened)I assembled my Moteino circuit inside the KillAWatt. Everything fits very nicely and the LED blinks every ~2 seconds, and data finds its way to my RaspberryPi where EmonCMS records and graphs it nicely. At the last minute I found a leftover TMP36 analog temperature sensor that I had around, and thought – why not add it to the Moteino and report temperature along with power readings?

I feared the TMP36 sensor alone would draw too much power (even an extra constant 2mA is too much for my KAW!). But it turns out it’s a very low power sensor (just 0.05mA). Since Adafruit has a very nice demo and code for TMP36, I won’t replicate the details here, you can check them out at Adafruit’s learning system.

Now I’m getting temperature, voltage and current waveform readings from my KAW. Sweet! Some assembly photos:

For a first run, I let my WattMote report my refrigerator power overnight. The KAW was reading 1.19kWh when I checked the next day, in EmonCMS it was showing 1.18kWh, I think I’m happy with this accuracy:

1.18kwh

Here is the schematic of a WattMote node:

How does it all work?

The receiving end of the WattMote network is a Moteino that you can attach to a regular computer (boring…) or to a RaspberryPi (oh yeah). In my case I’m using a RaspberryPi with a python script that runs as a long running process (that lives after logoff). The script posts the incoming data to the EMONCMS instance running on the Pi. See details at their site on how to install EMONCMS.

The python script has a bunch of options which you can learn about by invoking the help command (python WattMote.py -h). You will need to either edit the script with your default settings or provide them through the command line. For the script to run properly you will need to tell it what to do and what not, and supply information such as the EMOCMS apiKey. Since not all KillAWatts are the same, you may tweak the incoming voltage/current data by altering these 2 parameters in the WattMote.py file:

On the RaspberryPi, you will connect the receiver (gateway) Moteino using 4 pins:

  • Pin2(5V)                    to Moteino-VIN
  • Pin6(GROUND)        to Moteino-GND
  • Pin8(UART_TXD)     to Moteino-RX
  • Pin10(UART_RXD)   to Moteino-TX.

RaspberryPi-gpio-pinout

Then, if you haven’t done this yet, you will need to free your serial port. The serial port by default is used by a getty process which allows you to log into your RPi using the hardware serial interface (kinda cool). To disable that run these commands:

  • Make backup first, then edit the original cmdline.txt file and remove parameters that contain “ttyAMA0″:
  • Then comment out the line that spawns a getty on ttyAMA0:
  • Restart the Pi
  •  To test the ttyAMA0 serial port, install minicom and run it. You should see the raw data coming from the WattMote(s):
  • At this point you should be able to start the WattMote.py script. To start it in long running process mode just add a ampersand at the end of the command.
  • To later kill this script you can use “ps aux” to find the script’s ID, then kill it:

See my GitHub WattMote repository on how to setup the Moteinos inside your KillAWatts as transmitting WattMotes, and how to flash your central receiving Moteino.

Some/all parts are now available in the LowPowerLab store.

13 thoughts on “Meet the WattMote (Moteino based Tweet-A-Watt)

  1. Pingback: Meet the WattMote (Moteino based Tweet-A-Watt)#piday #raspberrypi @Raspberry_Pi « adafruit industries blog

  2. … and I’m liking the idea to use a Moteino with the Pi. I was planning to use an RFM12B module directly for my Pi based central receiver and web server. But having an intelligent receiver running a sketch makes a lot of sense, versus making the Pi deal with RFM12B and the various nodes…

  3. Felix,

    Do you offer “kits” allowing someone to order all the little parts posted projects?

    I already have a Kill-A-Watt and would like to copy your project. I’d like to order parts for your other projects as well.

    Ryan

    • Ryan, good idea. I will look into putting together a kit-of-parts for this project.
      It would probably include just the discrete parts (resistors, cap, diode, LED), since the users can buy Moteinos separately with their options (depending if they already have a receiver or not).

  4. Hi
    Really like the solution and the logging ability, But I’m european based
    and would like to be able to deploy on a 220-240 volt. Do you know if the
    Kill a watt device is available for non us/110 voltage. Beest regards Sc

    • A basic search reveals other simiar devices for EU but I don’t think the KillAWatt is available. As long as the device uses an opamp similar to the one in the KillAWatt (for sampling A/V) you should be able to replicate the solution.

      • Hi,
        live in Austria (->230V) and I just openend my Voltcraft Energy Check 3000 Wattmeter ( about 20Euros) and it looks like it uses the same chips as the Kill-a Watts. Even the layout of the parts is very similar. Unfortunately the labeling is unreadable. I’m pretty sure it’s a LM 2909 in the small version. Good luck!

  5. Hi, I just started looking into microcontrollers so my knowledge is very limited. I am currently working on a project that requires controlling a relay and I was wondering if the Moteino is able to receive the signal from the Raspberry Pi to control the relay ?

      • Great!, so is there a limit of how many moteinos can the receiver/sender communicate with ? does the WattMote.py script need to be loaded to the Raspberry pi or to the moteino and what would be the code that enables communication between the receiver and sender ? Sorry for asking so many questions. Thanks

        • There is no limit per se, but the more RF traffic you have the more collisions you have. Also there’s a theoretical limit for how much traffic you can have in the unlicensed radio bands (I don’t have numbers).
          Having said that, if 1 Moteino transmits every 2 or 5 or 10 seconds for a few milliseconds that will be well within the limits and allow for a lot more Moteinos to talk to the main Moteino. Moteinos are transceivers, they can act as a sender or as a receiver. Python scripts run on the Pi. The code on the receiver Moteino is what receives the sender messages and passes it along to the Python script through the serial interface of the Pi. Read the article more carefully for the details on how to get it working.

Leave a Reply

Your email address will not be published. Required fields are marked *


eight − = 1

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">