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:
lua: error loading module 'jeenodeApplet' from file '/etc/plugboard/jeenodeApplet.lua':
/etc/plugboard/jeenodeApplet.lua:4: unexpected symbol near '?'
[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
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:
Bit of a stab in the dark… but let’s trying bringing that down considerably:
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/