JeeNode over-the-air firmware flashing?

Today I received a mail from Sebastian Wille.  He finally managed to release the code of his AmICA sensor nodes. A very, very interesting feature of these nodes is the ‘over-the-air’ firmware flashing feature. As the AmICA, like the JeeNode, is making use of the same RFM12B tranceiver, it might be possible to port this feature to JeeNode.

This might become a real timesaver. The complete JeeNode network could be reprogrammed wirelessly in contrast to the current situation: walking round the house, and manually flashing to each device.

We’ll see where this ends

The code is available on the AmICA website: http://amica-system.com/

The JeeNode and the Dragino

At this moment I have installed a number of JeeNodes in my house for energy monitoring and home automation purposes. At this time of writing I am using JeeNodes for:

  • Monitoring home electricity consumption based on a current (clamp) and voltage sensor (AC-AC transformer) using the recipe of the openenergymonitor project described here.
  • Monitoring gas consumption based on a hall-effect sensor, which is described here
  • Sending/Receiving OOK encoded signals for:
    • S555TH temperature/humity sensors
    • FHT80b wireless room thermostats
    • FS20 wireless relays
  • Controlling my central heating system (see a previous post on that topic)
  • Reading the status and controlling a washing machine (see this post)
  • Displaying status on a scrolling 8X128 led matrix (not yet documented)

For communication with the outside world (the Internet) I used a JeeNode USB attached to the USB port of a freetz’ed FritzBox 7170, and a dedicated serial to Internet proxy program on the FritzBox. While this setup worked fine, it was difficult to make changes (recompile new firmware etc.). This was the reason to switch over to the Dragino system.

After doing some experiments with a JeeNode attached to a Dragino, I installed a JeeNode SMD (very flat form factor) into the Dragino case.

The new JeeNode SMD

The JeeNode is connected to the dragino cable via a simple cable (details described here). The JeeNode itself attached with Velcro to the cover of the Dragino. The picture below shows the Dragino board and my JeeNode connector cable.

And the end result, a nice clean box

The JeeNode is programmed with a dumb tranceiver program. The only function of this program is to convert messages received over 868Mhz to a hex encoded message on the serial port, and vice versa: hex encoded messages arriving through the serial port are transmitted over 868Mhz.  The arduino sketch for this tranceiver program is here.

The dragino runs a lua script that talks to the serial port, decodes incoming messages, and encodes messages to be sent in my 868Mhz home network.

Internet connected washing machine

Before describing how I connected my washing machine to the Internet. Let’s start with the background.

The smart grid is expected to be the future intelligent energy network. In the smart grid, enabled with digital technology, it should become possible to control appliances at home depending on energy cost and the availabillity of renewable energy. A popular smart grid use case is doing the laundry. Within limits the washing machine can run at arbitrary hours, so that electricity demand is moved to a more ideal situation (low energy price for instance).

The term smart grid has been used since 2005, and since then a lot of information aboutthe grid and appliances have become available. While six years is relatively short for energy networks, it is very long for the Internet. From this perspective I find it rather strange that still no Internet ‘connected’ washing machines are available on the market today. Miele, one of the leading washing machine vendors in Europe, showcased a ‘smart grid’ capable washing machine in fall 2010. Still general availabillity seems to be far away.

And what to do with legacy washing machines? In the Netherlands, washing machines are expected to live longer than ten years. For me, this was the motivation to see if it is possible to turn my washing machine into a ‘smart’ appliance.

And now the details of my modification. From the EAI perspective it falls in the category ‘User Interface Integration’. Our washing machine, a Bosch 64800 is equiped with a control panel made up out of a rotary switch for selecting the wash program, a number of leds for reporting the state of the machine, and six push buttons for starting/stopping and additional functions (eco-mode, extra water, faster wash cycle, and spin dryer speed). A picture of the control panel is shown below.

And the bare control panel inside the machine looks like this

Interestingly the control panel on the inside of the machine is equiped with a lot more push buttons (9) than are exposed on the outside of the machine (6). Operating voltage of the board was measured to be 5VDC.

For my modification I used a JeeNode (a wireless Arduino compatible microcontroller board). The first step of was to solder two wires on the electronics board parrellel to the Start/Pause button. This button provides functionality to start/stop the washing process at any time. The other end of the cable is connected to a JeeNode with a Relay plug.

Next step is to glue three LDR’s on the perspex backside of the controlpanel. The LDR’s were glueed to the start/pause led, the ‘looptijd’ led (washing in progress), and the ‘einde’ led (washing done). The wires are connected to the JeeNode (with an additional 1M resistor). For more functionality, more LDR’s (and more buttons) can be connected to the JeeNode for more detailed state information (which part of the washing cycle, etc) and more control.

The funny thing is that after fitting the control board into the washing machine, no changes are visible from the outside of the washing machine. Also, normal usage is still the same as before.

As can be seen in the picture below, the state of the machine can be retrieved succesfully. In the picture the state is plotted as a function of time. The states of the washing machine are: 0 for off, 1 for ‘program set and ready to start’, 2 for ‘washing’ and 3 for ‘ready, washing done’.

The graph also show an improvement I wanted to make. Since the washing machine lacks a ‘delay start’ function, the freshly washed laundry remains lying in the machine for a couple of hours… Fortunately, It is now possible to add this functionality through the JeeNode. I started by adding a rule that starts the washing machine if the washing machine is in state ‘1’ (ready to start a wash), and the time is 6 o’clock in the morning (during off-peak hours).

Here the washing machine was filled with Laundry, waiting until six o’clock, when the machine was started. The spikes at the beginning of the graph are a number of testing cycles to test the relay.

Now my washing machine is ‘connected’, implementing of a number of features is trivial:

  • Reporting state on home automation display (done)
  • Reporting state via Twitter/SMS
  • Couple washing cycle to the energy price or the availabillity, renewable energy or reduce peak demand. This is not really necessary, but because all components are availble (solar panels, energy measurements) it is interesting enough to give it a try.

The arduino sketch is available here.

Dragino experiments

Last week Bart van der Meerssche sent me the newest version of the flukso. This new system consists of a motherboard (dragino). Most important feature for me are the connectors (2×8 and 2×7) for microcontrollers such as Arduino, or the JeeNode. For me, the dragino is an ideal host for my JeeNode home automation projects.

First of all I wondered if the enclosure of the dragino (MS12) is large enough to house a JeeNode. I did some testing with an experiment board and a JeeNode (v5). My conclusion is that fitting is possible within the MS12 enclosure. Today JeeLabs announced the availabillity of a JeeNode SMD. This ‘flat’ JeeNode would make inclusion in the dragino even better.

The other activity I started with is communication between the the dragino and a JeeNode. The following table lists the connections between the pins of the dragino 2×8 connector and the pins on the JeeNode.

Draguino pin JeeNode pin
5V PWR
GND GND
SIN RXD
SOUT TXD

Here is a picture of my setup. The JeeNode is inserted into a breadbord, and wirejumpers connect the breadboard to the dragino. Communication was tested with the following  ‘Hello World!’ sketch on the arduino:

void setup() {
Serial.begin(9600);
}

void loop() {
Serial.println("Hello World!");
delay(1000);
}

On the dragino, the flukso deamon was stopped (/etc/init.d/flusko). Also the crontab entry with a periodic reboot was removed. Serial communication (readonly) with the JeeNode was tested with a small, my first, Lua script.


serial=io.open("/dev/ttyS0","r")
while line==nil do
line=serial:read()
serial:flush()
end
print(line)

And, it worked! The ‘Hello World!’ was coming in line by line on the dragino.

World Wide Kap Week (eerste poging)

Dit jaar is de eerste week van mei de WWKW oftewel World Wide Kap Week. De week waarin zoveel mogelijk vlieger-lucht-fotografen (KAP wat staat voor Kite Aerial Photography) over de hele wereld hun best doen om nieuw materiaal te schieten en het KAPpen te promoten. Voor mij was dit de gelegenheid om mijn KAP-gereedschap weer in goede staat te brengen. De grootste uitdaging was om mijn nieuwe camera, een tweedehands canon S90, weer helemaal goed in te stellen, batterijen op te laden, vlieger controleren, etc. Voor het instellen van de camera maak ik gebruik van CHDK, een alternatieve firmware voor canon camera’s, met daarop een speciaal script dat besturing op afstand nodig maakt. CHDK wordt in de vorm van een aantal bestanden op de geheugenkaart van het fototoestel gezet.

Voor het maken van fotos was de groene cathedraal, een land-art object in de omgeving van Almere, als onderwerp gekozen. Het leek een ideale dag: helderblauwe hemel, goede wind. Dus ter plaatse aangekomen en de vlieger opgelaten. Camera aan de lijn gehangen en de Dunecam gestart. Dunecam, een afstandsbediening voor luchtfotografie, is voorzien van een klein schermpje zodat je kan zien wat er uiteindelijk op de foto komt. Ook is het mogelijk om instellingen (sluitertijden, iso-waardes, diafragma, zoom, etc.) te wijzigen zonder dat de camera weer naar beneden moet. Erg handig. Terwijl ik de vliegerlijn vier, en de vlieger met camera hoger en hoger klimt zegt mijn vrouw (die de Dunecam in haar hand had): “Hij zegt: ‘No memory card'”. Na het naar beneden brengen van de camera en vlieger blijkt dat er inderdaad geen geheugenkaart in het toestel zat. Gevolg: geen CHDK, geen fotos en de fotosessie dus mislukt. Geheugenkaartje bleek thuis (150 kilometer verderop) in mijn laptop te zitten.

Enfin, mijn spulllen staan nu in ieder geval nu weer klaar voor een volgende poging. Hopelijk nog deze WWKW.