Tag Archive: Jeenode


Despite still having a handful of unfinished projects I decided to take the plunge and have some solar panels installed. I found a local MCS accredited installer MAH Solar Solutions and in no time had the kit up and running. My house faces east/west so I have 8 panels on each side.

Image

The panels are Canadian Solar 250W, total 16 to form a 4KW system fed into a Aurora ONE/PVI 3.6 inverter in the loft.

Image

The solar install was the perfect opportunity to finally replace my ancient fusewire consumer unit. Which got me to thinking of ways I may be able to better monitor my energy consumption. I hoped to find “a magical fuse box” but hours, days, weeks of research and the best solution I could come up with were DIN rail mount KWH meters.

Unfortunately no amount of searching could find a single image of the KWH meters in use or a diagram of how to wire them in a consumer unit. Instinct told me to have each meter mounted alongside each breaker, but this would prevent me from using the busbar. Then I thought about mounting them upside down, but this would cause similar issues and mean running the neutral far too close to the busbar! The next idea was to either mount 2 consumer units side by side, having the breakers in one and the meters in the other… Then I found some information about twin/dual rail consumer units which seemed like a winning idea.

MAH Solar Solutions were to be installing the new consumer unit and despite having never seen or used the KWH meters before they were more than happy to install them. They came up with the idea of mounting the meters at the end of each block of breakers. With a big enough consumer unit this meant the busbar could still be used. I will try and add some diagrams and more images at a later date.

Image

I’m still working the best way to read so many pulse counters simultaneously and log/process the data. Currently http://openenergymonitor.org/emon/buildingblocks/12-input-pulse-counting looks like one of the most promising, but I will need to start from scratch with a way to count, store, transmit etc. So for the time being I decided on the fluksometer which can handle 4 pulse inputs- which will do for now: mains, solar, oven & gas meter.

Image

The flukso service itself provides quite nice graphing- you can see here my mains consumption (blue), oven consumption (green), solar pv generation (red) and gas consumption (orange).

Image

Which feeds nicely to pvoutput.org.

Image

You can see the rj11 cable coming out of the gas meter (to the fluksometer). The purple cable runs from the RS485 port on the inverter in the loft. I am waiting on a USB to RS485 device so I can start pulling some detailed data using Aurora Monitor or similar.

Image

I understand the fluksometer has an onboard RFM12B configured on the 868Mhz band to understand communication from jeelabs devices- which is ideal as I meter my water using jeenodes.

Image

I just don’t know how to get them talking… yet!

An update on my latest project

Further to: https://tickett.wordpress.com/2012/12/31/a-new-year-a-new-project/ I have discovered quite a few things, and it looks like I’m not going to have to start from scratch (although I may still be designing some form of hardware, it’s hard to tell at this point).

Existing projects/products set out to do something similar:

NPlug- http://www.indiegogo.com/projects/283102/x/2060579

  • Consumption measuring (believed to be more accurate than existing devices)
  • Remote switching
  • WiFi connected (requires no bridge/gateway device)
  • Zigbee 802.15.4 for connecting to other devices
  • USB option (add 3G dongle, additional RF interface etc)
  • SoC running OpenWRT Linux
  • Open source
  • Lots more…
  • £100 (estimate)

This is really meant as a single device and not to be used with every appliance in the home. The device acts like a gateway itself and aims to connect to existing consumption/switching devices such as the IRIS / AlertMe suite.
I have pledged as a sponsor for this project, and hope to get my hands on a prototype- however, the funding has been a bit slow, so please help out :)

AlertMe (IRIS)- https://www.alertme.com/shopping

  • Consumption measuring
  • Remote switching
  • Zigbee
  • Requires the SmartEnergy pack as a bridge/gateway to the internet
  • £25

Ubiquiti mFi mPower- http://www.ubnt.com/mfi#m-Power

  • Consumption measuring
  • Remote switching
  • WiFi connected (requires no bridge/gateway device)
  • Comes in 3 flavours: Single, 3 socket extension cord and 8 socket extension cord
  • Only currently available with US / EU plugs
  • No EU stock currently available (when it is, I will try one with a UK plug adapter)

Belkin WeMo Switch- http://www.belkin.com/uk/c/WSWH

  • Switching only by the look of it
  • WiFi connected (requires no bridge/gateway device)
  • £40

Meter Polug- http://www.indiegogo.com/meterplug/x/2060579

  • Consumption measuring
  • Remote switching
  • Bluetooth only- so unless you’re within range and carrying a bluetooth equipped device, it’s not much good. This being said, the project has been fully funded, so there is clearly demand for such a device.
  • I have asked whether they’ve considered building a gateway device to enable internet connectivity but yet to hear back. Fingers crossed.

Other

  • I have purchased a USB Zigbee packet sniffer in the hope that I can make sense of some of the traffic floating around my house from various “smart” gadgets.
  • Still waiting on delivery of my EVE Alpha board- http://www.kickstarter.com/projects/ciseco/eve-alpha-raspberry-pi-wireless-development-hardwa this should allow me to start doing some cool stuff with a raspberry pi using the gpio pins rather than dozens of USB sticks!
  • The guys over at flukso have confirmed that they will be continuing work on their enhanced hexabus plug once they have another project out of the way: https://www.flukso.net/content/hexabus-plug
  • I sent some details to a few companies in an attempt to understand costings for PCB design, production and assembly. Just one company has responded to date: http://www.newburyelectronics.co.uk/ – for something like the Hexabus plug they’re suggesting (rough figures): £1,000 PCB design (£500 each of the 2), £80 PCB production (£40 each of the 2), £60 parts (excluding several parts they can’t source), £130 assembly & inspection. Bringing the total in at about £270/device (forgetting PCB design)- ouch!

That’ll likely be my last update for a few weeks, as I’m off to Thailand shortly :)

L

A new year, a new project

*EDIT*: Update on this project https://tickett.wordpress.com/2013/01/10/an-update-on-my-latest-project/

So I realise I have been a little quiet on here lately, and so will make it my new year’s resolution to get back in the habit of blogging regularly.

I would like to share some details of a project I’m assessing for feasibility. It is yet to be named but in essence I’m looking at building an Automated Mains Plug / Socket, let’s call it aPlug.

What do you mean by automated?

  • Remotely switchable / “programmable”
  • Monitor / log power / energy consumption

Don’t these already exist?

  • A lot of rf controllable plugs exist but there are a number of limitations- # cannot integrate with other equipment, # cannot operate from outside of the home, # cannot operate without the supplied remote, # cannot determine current state
  • Some power / energy consumption monitoring plugs exist but again, bare limitations- # cannot integrate with other equipment, # require a gateway device to post data to the internet
  • A few devices even exist which address both requirements but- # cannot integrate with other equipment, # cannot operate from outside the home, # require a gateway device (possibly even an entire pc to post data to the internet), # are expensive, # are closed source

There is however, one possible hope! The hexabus plug: http://signup.hexabus.net/ – I am trying to make contact with the guys behind the hexabus plug to determine where the project is currently, where it’s headed etc. Regardless, the great thing about the project, it is open source- which means the schematic / parts list (BOM) have been published: https://github.com/mysmartgrid/hexabus – unfortunately the PCB layout doesn’t appear to’ve been, but again, I’m hoping it will be shortly.

This project has also sparked the interest of the guys over at flukso, and became the center of a talk at one of their meetings: https://www.flukso.net/files/presentations/flukso.20121026.hack_hexaplug.pdf – where they have suggested a minor tweak to enable interconnectivity with jee labs devices (they include a PCB layout, which suggests they likely have them- I am trying to make contact with them too!)

Even if I manage to make contact and get details of the existing device I still have a lot to tackle…

Network connectivity
I’m currently looking at options, but it makes sense to try and learn from the lessons the guys behind LIFX: http://www.kickstarter.com/projects/limemouse/lifx-the-light-bulb-reinvented
They have essentially gone down the route of creating a mesh network with “slave” devices, then using a “master” device to bridge to the local area network (LAN) and essentially the internet. This ultimate is a gateway device but “in disguise”- and unless I can miraculously find a way of driving down the cost I can’t see any other approach being feasible?

Prototyping
I am making contact with a number of companies who design, produce and assemble printed circuit boards (PCBs) as a number of the components involved in the device cannot be soldered by hand nor can the circuit(s) likely be built using a simple breadboard. I imagine this is going to be a real challenge as the cost for “one-off” or very limited production runs is likely to be extremely high.

Software / Firmware
I have coded some simple arduino / atmega programs in the past, and worked with some of the jeelabs devices but I will certainly be needing assistance to build something as complex as this if it’s going to be robust enough to put “out in the field”. My hope is that developers will show a keen enough interest and we can build something as a community. The devices will be reprogrammable so new firmware can be flashed with relative ease. The problems will come when a hardware change is required…

Certification
Regardless of whether a device is faced with mains voltages or whether a device is aimed at developers I anticipate some form of certification being required- this could be tricky (especially on an evolving device).

Funding
To gauge interest, boost funding, promote the project and hopefully attract some developers, testers and contributors I would like to run a kickstarter project- unfortunately it’s a little chicken & egg as I need at least some form of prototype before I can reach out to the community. I have however drafted a project so I am prepared if I do get that far: http://www.kickstarter.com/projects/tickett/736265394?token=98a4e52f (so far just some notes, and the reward levels are pure guesswork).

I just knocked the artwork up from a few google images:

I have asked someone to design some artwork for a t-shirt, so I will see if they can come up with a cool concept :)

Where Next?
Yes, it’s far too early to be thinking about that, but I can’t help it!

  • Multi socket extension lead type device with individual socket switching and consumption monitoring
  • aSocket, essentially a mains socket with the device inside so no “plug” is required
  • Other plug types (I am based in the UK so this is where I intend to initially focus)

At this stage I’d appreciate any feedback, or expressions of interest etc

Happy new year to all

Lee

Thanks to ADH Heating Services I now have jeenodes counting pulses from my mains cold water supply:


Boiler hot water outlet:


And gas meter:


The pulses are being pulled into DomotiGa:

Which allows me to graph with RRDTool:

I also created my own module for DomotiGa to hook up to my custom 433Mhz RF receiving jeenode- I now have my window/door sensors (along with a bunch of rogue devices?) appearing:


I’m not best sure how to tackle the fact that the devices don’t issue an idle command when the alert has finished (i.e. when the door is closed or the fire is put out?). I’m considering trying out the built in DomotiGa feature to revert the values after 1minute or so (the smoke alarm should continue to send data whilst the alarm is being sounded so this shouldn’t be a problem).

I’m still troubleshooting a few problems- for example USB serial ports failing to open with error: "Cannot open serial port (#5)":

And some jeenodes going offline. Hopefully I will have more time to look into this later in the week.

L

Home Automation Update

Not a lot to say- just a quick update. I’ve ordered a few more bits to add to the home automation project. These have already come:

-RFXCom 433Mhz transceiver
-Byron 433Mhz switch, pir, remote plug/socket & "in ceiling switching module".
-Linksys SPA3102

And I’m still waiting for (or haven’t ordered):

-433Mhz smoke alarms
-433Mhz doorbell
-433Mhz door/window open/close sensors
-Wifi or 433Mhz bathroom scales

Here’s a quick shot of one of the raspberry pis hooked into a little portable LCD, the RFXCOM transceiver, the CurrentCost EnviR and a Jeelabs Jeenode:

The next step I decided to tackle was getting a few real basics pieces of information from my Enigma2 digital satellite receiver into DomitiGa. I decided to use the nifty little shell script module to execute:

#!/bin/bash
rm current
wget -q http://192.168.0.222/ajax/current
cat current | grep "Name:" | sed 's/.*: (.*)<.*/1/'
cat current | grep "Title:" | sed 's/.*: (.*)<.*/1/'
cat current | grep "Recording Status:" | sed 's/.*: (.*)<.*/1/'

Which returns three lines with: The current channel, programme and whether a recording is in progress. I hope to take this a lot further and start capturing stats from my VDSL & ADSL modems, fileserver etc. You can see the satellite details below "Sky: Lounge":

I have been meaning to get my gas meter, hot & cold water monitored for a long time. The gas meter is relatively straight forward as it provides a convenient RJ11 socket with pulses- I just needed a sketch to load onto a jeenode to catch and report these pulses. I decided to try the sketch from the OpenEnergyMonitor project (http://openenergymonitor.org/emon/emontx) found here: https://github.com/openenergymonitor/emonTxFirmware/tree/master/emonTx_Pulse

I made some changes:

-Set freq to 868Mhz
-Set nodeID and networkGroup
-Unset UNO

I think that’s it:

/*
EmonTx Pulse example

An example sketch for the emontx module for
CT only electricity monitoring.

Part of the openenergymonitor.org project
Licence: GNU GPL V3

Authors: Glyn Hudson, Trystan Lea
Builds upon JeeLabs RF12 library and Arduino

*/

#define freq RF12_868MHZ // Frequency of RF12B module can be RF12_433MHZ, RF12_868MHZ or RF12_915MHZ. You should use the one matching the module you have.433MHZ, RF12_868MHZ or RF12_915MHZ. You should use the one matching the module you have.
const int nodeID = 2; // emonTx RFM12B node ID
const int networkGroup = 212; // emonTx RFM12B wireless network group - needs to be same as emonBase and emonGLCD needs to be same as emonBase and emonGLCD

const int UNO = 0; // Set to 0 if your not using the UNO bootloader (i.e using Duemilanove) - All Atmega's shipped from OpenEnergyMonitor come with Arduino Uno bootloader
#include <avr/wdt.h> // the UNO bootloader

#include <JeeLib.h> // Download JeeLib: http://github.com/jcw/jeelib
ISR(WDT_vect) { Sleepy::watchdogEvent(); }

typedef struct { int power, pulse, misc1, misc2; } PayloadTX;
PayloadTX emontx; // neat way of packaging data for RF comms

const int LEDpin = 9;

// Pulse counting settings
long pulseCount = 0; // Number of pulses, used to measure energy.
unsigned long pulseTime,lastTime; // Used to measure power.
double power, elapsedWh; // power and energy
int ppwh = 1; // 1000 pulses/kwh = 1 pulse per wh - Number of pulses per wh - found or set on the meter.

void setup()
{
Serial.begin(57600);
Serial.println("emonTX Pulse example");

rf12_initialize(nodeID, freq, networkGroup); // initialize RF
rf12_sleep(RF12_SLEEP);

pinMode(LEDpin, OUTPUT); // Setup indicator LED
digitalWrite(LEDpin, HIGH);

attachInterrupt(1, onPulse, FALLING); // KWH interrupt attached to IRQ 1 = pin3 - hardwired to emonTx pulse jackplug. For connections see: http://openenergymonitor.org/emon/node/208

if (UNO) wdt_enable(WDTO_8S);
}

void loop()
{
emontx.pulse = pulseCount;
pulseCount = 0;
//Serial.println(pulseCount);
send_rf_data(); // *SEND RF DATA* - see emontx_lib
emontx_sleep(10); // sleep or delay in seconds - see emontx_lib
digitalWrite(LEDpin, HIGH); delay(2); digitalWrite(LEDpin, LOW); // flash LED
}

// The interrupt routine - runs each time a falling edge of a pulse is detected
void onPulse()
{
lastTime = pulseTime; //used to measure time between pulses.
pulseTime = micros();
pulseCount++; //pulseCounter
//Serial.println("Pulse!");
emontx.power = int((3600000000.0 / (pulseTime - lastTime))/ppwh); //Calculate power
}

void send_rf_data()
{
rf12_sleep(RF12_WAKEUP);
// if ready to send + exit loop if it gets stuck as it seems too
int i = 0; while (!rf12_canSend() && i<10) {rf12_recvDone(); i++;}
rf12_sendStart(0, &emontx, sizeof emontx);
// set the sync mode to 2 if the fuses are still the Arduino default
// mode 3 (full powerdown) can only be used with 258 CK startup fuses
rf12_sendWait(2);
rf12_sleep(RF12_SLEEP);
}

void emontx_sleep(int seconds) {
for (int i=0; i<seconds; i++) {
delay(1000);
if (UNO) wdt_reset();
}
}

L

Last post today, I promise!

After my breakthrough earlier getting gambas2 working in debian on one of my Raspberry Pis, then getting DomotiGa running I’ve managed to hook a jeenode up to the pi running the rf12demo sketch and it’s automatically picked up my jeenode running the roomnode.3 sketch:

So much to do, so little time!

The great thing is the data is now being stored in mysql hopefully in just the right way to allow the sort of querying & reporting I want to be able to do (and the main reason I ditched home automation hub).

L

Now my 2nd Raspberry Pi has turned up I can (re)start work on my home automation project.

Previously I’ve setup a wireless sensor network (WSN) comprised of a number of jeenodes (http://www.jeelabs.org) using the RFM12B to connect back to central jeelink usb plugged into a repurposed orange livebox router (running http://www.homeautomationhub.com). Additionally I installed a number of CurrentCost individual appliance monitors (iams) and a EnviR energy monitor plugged into the home automation hub (hah) to monitor and log household and appliance level energy consumption. Refer to some old blog entries: https://tickett.wordpress.com/category/home-automation/. All of the data was being sent to pachube for logging.

I wasn’t too keen on the home automation hub as I didn’t really fully understand it and couldn’t push it where I wanted to go (although the community was really good and I imagine I will be seeking assistance from them in connection with the new project :)

In my new setup I intend to use a Raspberry Pi the "hub"- with a "full blown" linux distribution (debian?) I should hopefully be able to accomplish everything I am looking for. As python is the first language discussed in conjunction with the raspi I’ve started playing with that, but eventually may move to a LAMP solution (php with mysql backend for logging and apache web front end).

Here’s a high level summary of the steps I’ve covered:

The python example from the link above didn’t produce any output for me so I modified it slightly:

import serial, sys
ser = serial.Serial('/dev/ttyUSB0', 57600)
while 1 :
sys.stdout.write(ser.readline())

That’s all I have time for now- watch this space.

L

More Home Automation Chat

I’m away from home at the moment so not much to report. I’ve not had a chance to install the water meters with my friend yet nor connect the gas meter to the hah but I have taken delivery of a bunch more jeenodes and room plugs:

Starting to put one together:

I now have 3 nodes collection temperature, light and humidity data and posting to pachube along with my total household power consumption and appliance level detail for 6 devices:

Whole house power consumption:

An example of individual device consumption (this happens to be the boiler):

Room data:

I’ve tried to create a "naming convention" where the data stream id contains the nodeid (first digit) followed by 1 for temperature, 2 for light and 3 for humidy.

You can quite clearly see where the temperature rises in line with the boiler coming on. You can also see the light pattern during the day (wow- it’s getting dark real early!!!). Humidity isn’t really of much interest.

Interestingly I think node 2 is in the same room as the receiver/hahcentral/hub but seems to drop out every few hours. Node 3 in the room next door is rock solid. And node 5 in the room next to that is extremely flakey! Brett from over at hah has suggested lengthening the antenna on the nodes to resolve these issues- I will do some experiments when I have a little more time on my hands :)

And one final note- whilst on the topic of "home automation". I have replaced my sky boxes in recent months with the Clarke Tech ET9000: https://tickett.wordpress.com/2011/09/20/getting-started-with-clarke-tech-xtrend-et9000-and-sky-hd-uk/ and pipe the picture round the house from these and my home theatre pc (htpc) running xbmc with a cheap 4×4 HDMI matrix I picked up off eBay. I now have full control over these devices from my mobile phone (iPhone):

DreaMote Lite (for Enigma2 satellite receivers):

And XBMoteC (for XBMC):

All slow, but steady progress toward a completely integrated/automated home!

L

After getting my first few jeenodes flashed earlier: https://tickett.wordpress.com/2011/12/02/my-first-jeenodes/ it was time to get them to actually do something. With the sketches from the hah wiki http://www.dbzoo.com/livebox/hah_hahnode#flashing_from_the_hah I had hoped to start seeing traffic straight away but needed to know where to look.

I plugged the jeelink back into my laptop and fired up Arduino IDE- I’d hoped to use the serial monitor but serial port wasn’t listed. Fortunately Brett over on the hah forum quickly pointed me in the right direction of the usb/serial drivers: http://www.prolific.com.tw/eng/downloads.asp?ID=31 and I was up and running!

I could see the jeelink output: [HAHCentral.1] D i4 g212 @ 433 MHz

And knew that the frequency/band needed changing to 868 Mhz- so I issued the 8b command. Now it was time to check the jeenode- unfortunately serial output isn’t enabled using the default hah sketch. I flashed the RF12demo sketch and set the group and band to match that of my jeelink. I believe these configuration settings are stored in the EEPROM so after flashing the hah roomnode2.hex back the id, group and band will remain unchanged.

With the hahcentral plugged into the laptop and the serial monitor fired up I was starting to see some data coming in from the roomnode:

[HAHCentral.1] D i4 g212 @ 868 MHz
OK 2 0 0 0 0
OK 2 0 0 0 0

2 is the node id but for some reason the temperature, humidity and light values are all 0 (there is no PIR attached so I’d expect motion to return 0). Thanks again to Brett over on the hah forum for pointing out that the roomnode2 sketch support the DS18B20 temperature sensor and not the jeelabs room plug I was trying to use with the SHT11 temp sensor.

Meanwhile I tried to get the Serial SCHEMA service and plugboard scripting engine working on the hah. I created the jeenodeApplet.lua on my laptop and used wget to move it into /etc/plugboard but running top the xap-plugboard service didn’t appear to be running. I tried to launch it via ssh:

# xap-plugboard
lua: error loading module 'jeenodeApplet' from file '/etc/plugboard/jeenodeApplet.lua':
/etc/plugboard/jeenodeApplet.lua:4: unexpected symbol near '?'
stack traceback:
[C]: ?
[C]: in function 'require'
/etc_ro_fs/plugboard/plugboard.lua:23: in function 'fun'
/usr/share/lua/5.1/pl/tablex.lua:365: in function 'foreach'
/etc_ro_fs/plugboard/plugboard.lua:71: in main chunk
[C]: ?
Loading /etc/plugboard/jeenodeApplet.lua #

So it looks like a problem with the jeenodeApplet.lua. I spent quite some time puzzling over it till messing around with VI I noticed a few vanishing/invisible question marks ? In the file. I guess this is something to do with the various character sets and binary/ascii conversions that took place moving the file from my laptop (osx) to my webserver (some flavour of linux) and then to the hah! Now the file was fixed I was able to get the service up and running! Excellent- what next?

I tried using xFXviewer to pickup the xAP broadcasts but all I could see was local feedback:

Again- a lot of playing, checking firewalls etc but to no avail. Eventually I installed xFXviewer on another virtual machine and picked up the broadcasts:

Now with Brett’s help I’d flashed the jeelabs roomnode3 sketch onto the roomnode and was getting "a bit more" data back for temperature, humidity and light: ROOM 0 0 0 -396 0 but something’s still not right! This time after fiddling I tried another jeenode with the room plug and bingo:

[roomNode.3] B i2 g212 @ 868 Mhz
ROOM 7 0 51 228 0
ROOM 64 0 59 230 0

Now to try building my graphics board :)

Seemed pretty painlesss- now let’s get the glcd_demo onto the board and give it a go:

Doh- yet another "not gone according to plan"- but as ever, I will persist :) Thanks to a suggestion from martynj on the jeelabs forum I decided the contrast was the problem and as pointed out, this is controlled by the software so I had a look at the code:

glcd.st7565_set_brightness(0x15);

Bit of a stab in the dark… but let’s trying bringing that down considerably:

glcd.st7565_set_brightness(0x05);

Hallelujah!

One last task before I call it a day: Get some data posting to pachube. Luckily the hah web interface allows this to be configured relatively easily: http://www.dbzoo.com/livebox/hah?s[]=pachube#xap_pachube but as expected I ran into technical difficulties. I forgot to take a note of the message but it was because of a blank row in the config:

The trash can doesn’t seem to work to delete the record so I had to manually fix the /etc/xap-livebox.ini via ssh (see the count=X setting under the [pachube] section). And after a few hours running:

Voila! I’m not quite sure what’s responsible for the drop-outs but I will get to that later. Hopefully I’ve learnt the basics whilst troubleshooting the various problems and as I find the time to get additional hardware/software up and running it’ll all go a lot more according to plan!

Here’s some ideas of what I’d like to do in a rough order (some of it is unrealistic):

  • Hookup a node in the main rooms of the house for monitoring temperature, humidity, light and in some also motion
  • Hookup a pulse counter to my gas meter (Schlumberger R5 which fortunately already has an RJ11 or RJ12 socket)
  • Hookup flow meters to my mains water supply and central heating output from the boiler (I’ve already ordered the parts for this)
  • Hookup some rf sockets/mains switching (to remotely turn lights and some other mains devices on/off- currently investigating solutions: plugwise seems to be one of the only 2-way solutions but the reliability is reportedly flakey unless you have a lot of devices)
  • Retire my CurrentCost bridge/netsmart in favour of directly connecting the EnviR CC128 to the hah (there’s no real urgency for this as the data is already being sent to pachube)
  • Attempt to interface with smoke alarms (it’d be nice to house the roomnode for measuring temperature, light, humidity and motion all in one neat package)
  • Collect data from other areas of my network to send to pachube (bandwidth stats from my pfSense virtual appliance, disk usage from my fileserver etc)
  • Build a database to house additional info & potential some of the existing data (depending on how easily I can query pachube)
  • Build a website to display the various information housed by pachube & my custom database
  • Add "security" devices: A few high resolution outdoor cameras and a few devices to detect open/close doors.
  • I’m sure I’ve missed some stuff off…

Some inspiration from these ideas has come from: http://bwired.nl/ and http://www.hekkers.net/domotica/

L

My first Jeenode(s)!

My order was delivered today and I found time to solder one of the jeenodes and a room board (yes- another poor camera phone photo):

I then plugged it into my livebox flashed as a home automation hub: https://tickett.wordpress.com/2011/11/27/orange-livebox-flashed-with-home-automation-hub-firmware/

And followed the instructions on the hah site to flash the room node program: http://www.dbzoo.com/livebox/hah_hahnode#flashing_from_the_hah

# /etc/init.d/xap stop serial
# cd /root
# ls
HAHcentral.hex roomnode2.hex
# stty -F /dev/ttyUSB0 hupcl
# avrdude -v -c arduino -p m328p -P /dev/ttyUSB0 -b 57600 -Uflash:w:roomnode2.he
x

avrdude: Version 5.10, compiled on Nov 25 2011 at 11:22:59
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "/etc_ro_fs/avrdude.conf"
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/ttyUSB0
Using Programmer : arduino
Overriding Baud Rate : 57600
avrdude: stk500_recv(): programmer is not responding

avrdude done. Thank you.

Damn- what does that mean? I googled a little and found some articles suggesting other services may already be using the USB port. One such service is gpsd- let’s try stopping it:

# service gpsd stop
-ash: service: not found

Doh- no service command. Let’s try top to see if gpsd is running:

Mem: 11992K used, 1888K free, 0K shrd, 2224K buff, 4428K cached
CPU:   0% usr   1% sys   0% nice  97% idle   0% io   0% irq   0% softirq
Load average: 0.05 0.23 0.12
  PID  PPID USER     STAT   VSZ %MEM %CPU COMMAND
  193   184 root     R     2248  16%   1% top 
  183   110 root     S     1740  13%   1% dropbear -p 22 
  178     1 root     S     3552  26%   0% lua /etc_ro_fs/plugboard/plugboard.lua 
  145   140 root     S     5012  36%   0% /usr/bin/kloned 
  156   140 root     S     5012  36%   0% /usr/bin/kloned 
  140     1 root     S     5000  36%   0% /usr/bin/kloned 
  142     1 root     S     2584  19%   0% /usr/bin/xap-currentcost -s /dev/ttyUSB0 -i br0
  184   183 root     S     2268  16%   0% -ash 
    1     0 root     S     2256  16%   0% init 
   95     1 root     S     2248  16%   0% udhcpc -T 10 -i br0 
  123     1 root     S     2240  16%   0% inetd 
  110     1 root     S     1668  12%   0% dropbear -p 22 
  132     1 root     S     1068   8%   0% /usr/bin/xap-livebox -s /dev/ttyS0 -i br0 
  129     1 root     S     1028   7%   0% /usr/bin/xap-hub -i br0 
    7     1 root     SW       0   0%   0% [mtdblockd]
    3     0 root     SWN      0   0%   0% [ksoftirqd_CPU0]
    8     1 root     SW       0   0%   0% [khubd]
    2     1 root     SW       0   0%   0% [keventd]
    5     0 root     SW       0   0%   0% [bdflush]
    6     0 root     SW       0   0%   0% [kupdated]

Ah hah! CurrentCost is enabled and configured on the same USB port:

So I disabled it and tried again:

# stty -F /dev/ttyUSB0 hupcl
# avrdude -v -c arduino -p m328p -P /dev/ttyUSB0 -b 57600 -Uflash:w:roomnode2.hex

avrdude: Version 5.10, compiled on Nov 25 2011 at 11:22:59
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc_ro_fs/avrdude.conf"
         User configuration file is "/root/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 2
         Firmware Version: 1.16
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "roomnode2.hex"
avrdude: input file roomnode2.hex auto detected as Intel Hex
avrdude: writing flash (10600 bytes):

Writing | ################################################## | 100% 3.45s

avrdude: 10600 bytes of flash written
avrdude: verifying flash memory against roomnode2.hex:
avrdude: load data flash data from input file roomnode2.hex:
avrdude: input file roomnode2.hex auto detected as Intel Hex
avrdude: input file roomnode2.hex contains 10600 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.69s

avrdude: verifying ...
avrdude: 10600 bytes of flash verified

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Voila!

Now let’s try flashing the hahcentral program onto the jeelink usb v3:

# stty -F /dev/ttyUSB0 hupcl
# avrdude -v -c arduino -p m328p -P /dev/ttyUSB0 -b 57600 -Uflash:w:HAHcentral.hex

avrdude: Version 5.10, compiled on Nov 25 2011 at 11:22:59
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc_ro_fs/avrdude.conf"
         User configuration file is "/root/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
avrdude: stk500_getsync(): not in sync: resp=0x20

avrdude done.  Thank you.

Doh! Google time again… this time it looks like the settings for the flasher are incorrect (i.e. the chip isn’t m328p?). I double checked the jeenode usb v3 spec and confirmed the chip is ATMEGA 328. But noticed a comment about the OptiBoot loader. With a little more research I confirmed that the baud rate has increased from 57600 to 115200. Let’s try again:

# avrdude -v -c arduino -p m328p -P /dev/ttyUSB0 -b 115200 -Uflash:w:HAHcentral.hex

avrdude: Version 5.10, compiled on Nov 25 2011 at 11:22:59
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc_ro_fs/avrdude.conf"
         User configuration file is "/root/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 3.3
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "HAHcentral.hex"
avrdude: input file HAHcentral.hex auto detected as Intel Hex
avrdude: writing flash (6668 bytes):

Writing | ################################################## | 100% 2.57s

avrdude: 6668 bytes of flash written
avrdude: verifying flash memory against HAHcentral.hex:
avrdude: load data flash data from input file HAHcentral.hex:
avrdude: input file HAHcentral.hex auto detected as Intel Hex
avrdude: input file HAHcentral.hex contains 6668 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.34s

avrdude: verifying ...
avrdude: 6668 bytes of flash verified

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Sorted. Hopefully another update later tonight :)

L