Wednesday, November 16, 2011

A good time had by all

Breakfast time, Janet's Birthday
We all had a splendid time and the weather was perfect and very warm for November, 18° or more with bright sunshine. The stovepipe is at a bit of rakish angle in the tent owing to putting things up in the dark ... we cooked fresh pineapples in the fire and flambéed them in Jamaican rum for dessert; it turned out to be surprisingly smooth and drinkable resulting in some short term memory loss during the latter part of the evening. Sallie was pessimistic about cooking a casserole over the coals on arrival but thanks to much valiant stirring by Anna, it all turned out very flavoursome. The Barnett's birthday cake for Janet was fittingly decorated with a chocolate button molecular model of salyclic acid. After breakfast we all climbed Leith Hill, the highest point in the South East of England, for tea and cake at the Tower. Lovely!

Wednesday, November 09, 2011

Janet's Jumbo Birthday Jamboree


This year Janet would like us to help re-create the happy, carefree days of her youth with an evening around a campfire in woodland in the Surrey Hills, after a spot of bowling at the Spectrum Leisure in Guildford.

The bowling is booked from 15:00 on Saturday 12th November.

We'll be leaving from our house at about 14:30 for the Leisure Centre, it's just a short distance away - but if you're arriving by car, parking at the Spectrum is easier than on our street. If you're coming by public transport, come to ours first and we'll give you a lift over (we're close to the bus and train stations).

Tentipi with chimney plume
Because it's November, we thought it best to book spots for any tent you may wish to bring plus two tentipis, one with a wood stove, at a farm site about 25 minutes by car from us. The site is close to Leith Hill, is surrounded by woodland, and has great walks nearby. It has a small wash block and no problem with fires being lit by campers. We have been told by the owner that there will be one other group on the 1.5 acre field with us, doing their Duke of Edinburgh Award - the site is otherwise closed to the public from the end of October. If it has been raining heavily, it is best not to bring your car onto the field, which can get quite muddy - there is parking in a small carpark next to the site.

The aim of the evening event is "glamping" rather than survival - but you might want to bring:-
  • A warm duvet or sleeping bag
  • A pillow
  • Warm clothing and headgear (points will be awarded)
  • Something to keep you off the floor of the tent when you are asleep, like a Thermarest or Karrimat
  • Boots or wellies for a walk up Leith Hill on Sunday
  • Slip-on footwear for trips to the washblock
  • A hot water bottle
  • A torch
  • Your own tent, if you want to sleep alone. Or earplugs maybe.
We'll bring supper and breakfast things - we're planning to cook something with lamb or beef on Saturday night, and porridge with a cooked breakfast on Sunday before a walk up to Leith Hill, the highest point in South East England, which has fine views and does tea and cakes/sandwiches for lunch on Sunday. We'll pitch the tipi tents and set things up before the bowling on Saturday. Lifts back to the train station/bus station available at about 1400 on Sunday. Any questions or dietary requests, drop me a line!

(Last update: 15:45 11-11/11)


Wednesday, October 12, 2011

Gotcha! Sam The Slug on film



Sam the Slug has been more active of late, leaving slime trails on the carpet near the lamp stand. He rises pretty late, it's very difficult to find him before midnight usually, so we've had a camera with an Arduino triggering pictures of the area he patrols. This is one of the better shots we got - unfortunately we still haven't found his home in our home.

Labels:

Tuesday, February 08, 2011

Setting up an XBee Serial 2 module as an AT Co-Ordinator - Part 1

Above: XBee Serial 2 module on Sparkfun XBee Explorer board

Programming a module as an AT Co-Ordinator is explained in the steps below. Each mesh radio network created using XBee modules needs one module configured with Co-Ordinator firmware settings. One or more modules in the radio network will be configured in "AT End Device" mode. The End Devices typically host sensors or actuators while the co-ordinator manages the network, and typically bridges network traffic to the Internet. The Co-Ordinator module may be mains powered, and in Arduino based projects may be sited on an Arduino XBee shield. Each XBee chip is programmed with firmware updates using X-CTU (available as a download from the Digi website). The "AT" in the name refers to the fact that once installed, the module can be switched from normal transmit/receive mode into command mode by sending it a modem AT command if AT command set firmware has been loaded into the module, which is useful for debugging purposes and running diagnostics.
The module is programmed by seating it on an XBee Explorer board connected by a USB cable to a PC with X-CTU and the FTDI driver software for the USB port installed.
Note that changing the firmware settings for a module to program it in Co-Ordinator mode may change its behaviour when connected to a host Windows PC running X-CTU depending on whether you pick the right versions of the module and firmware required using the user interface before you upload code to the module - it took several attempts for me to select the correct firmware versions despite this seemingly being an easy thing to do, you need to check settings carefully.
Incidentally, if you find that somehow you've got a firmware upgrade failure as a result of using X-CTU, and that you can't talk to your module any more, there's an excellent chance of recovering the situation by powering the module up with the reset pin connected to the GND pin on the XBee Explorer board using a breadboard jumper wire, then using X-CTU to write the default firmware settings back to the board. This is explained in a video linked to from the Digi support forum with the topic "recovering from a bad configuration"; there's a more XBee Explorer focused video from Robert Jacobs here, which explains the procedure if you don't already have a reset button to press. Once I had seen this, it all fell into place for me.

The screenshot above shows the first of two property sheet settings needed to configure an XBee 1mW Module in AT Co-Ordinator mode - see below though before copying the settings blindly.

Note the following settings (each numbered item corresponds to a red box over the group of settings in the screenshot above):
  1. The XBee module appears as a high-numbered serial port on the PC when connected; you will need to start X-CTU after connecting the XBee Explorer to your PC by the USB cable, allowing a moment or two for the device to be enabled. Each XBee Explorer seems to get allocated a different serial port number.
  2. Hardware settings are 9600-NONE-8-NONE-1
  3. The "Enable API" should not be checked; it is erroneously checked in this screenshot because I selected "API Co-Ordinator" firmware instead of "AT Co-Ordinator" firmware the first couple of times I tried to set the module up, and any "API" firmware prevents the modem from understanding AT commands, meaning that this box has to be checked in order to get the modem to respond to any X-CTU commands until the module has been reset.
The screen shot below shows the "Modem Configuration" tab of X-CTU at the point of configuring a module as an AT Co-Ordinator. Note the following fields:-
  1. You have to choose the module type, be sure to select XB24-B if your module matches the image at the top of this post.
  2. Once XB24-B has been selected, you can choose the correct function set - make sure you choose ZIGBEE COORDINATOR AT (should be firmware version 1020).
  3. Select "Show Defaults" to load the default settings from your PC hard drive for this firmware combination. This sets all fields on the module to the correct values, very important (if you forget this step, you may inherit some values from a previous firmware upload when the module had a different function, which causes strange behaviour). Once the defaults have been loaded, pick a number for the PAN ID - here I've chosen 234; this has to be noted because it will be shared between modules in the mesh network as a common identifier. All other settings can be left as the defaults.
Once these settings have been adjusted, select the "Write"button to upload the firmware settings to the module. If you get a message asking you to press the reset button after this, you'll need to connect the RST pin and the GND pin on the Zigbee Explorer breadboard with a jumper wire for a moment, then disconnect the wire, and the X-CTU application will begin the write operation. You can just about see the messages from a successful write in the pane in the bottom of the screen shot.

If you see these messages, you've successfully configured your AT Co-Ordinator.



Sunday, January 30, 2011

How Zigbee got its name

This question puzzles many of us, I've just found the answer in a very useful book called "Zigbee Wireless Networks" which I've just added to my Safari bookshelf.

Author Drew Gislason starts the book with this explanation:-

"Before I delve into ZigBee in detail, I'd like to address one question that seems to come up every time I speak about ZigBee in public. Where did the name ZigBee come from?

Well, the way I first heard it was at the ZigBee Open House in Seattle, back in 2004.

This story was told during a time when ZigBee was often confused with Bluetooth™. Just so you don't confuse the two: Bluetooth™ is great at point-to-point (as seen in many headsets and cell phones). ZigBee is great at wireless control, where anywhere from two to thousands of nodes are all connected together, in multi-hop mesh network.

Bob Heile, Chairman of the ZigBee Alliance explained the origin of ZigBee something like this:

A Norwegian legend speaks of a little troll by the name of ZigBee, who lived in the village of Vik far inland on the fjord of Sogn. Now, Norwegian trolls aren't the big, nasty and smelly, hard-as-rock variety often told of in other tales, at least not always. ZigBee was a kindly, quiet little troll, who didn't speak much, but when he did speak it was always reliable. A person could count on ZigBee.

One time, ZigBee sensed that a decomposing pile of hay stacked up against a barn had become too hot and had begun to smolder. ZigBee, in no time at all, sounded the alarm to every house in the village, and the villagers were able to put out the fire before the barn was lost.

Another day, a grandfather left the port of Vik i Sogn in his small fishing boat to catch Salmon with his granddaughter Brita. This day, unlike other days, Brita was not being careful. Bestefar (that is the name Norwegians give to their grandfathers) didn't notice when Brita fell overboard as he was busy hauling in a net full of fish off the stern of the little boat. ZigBee, sensing immediately that Brita had fallen, alerted Bestefar who was able to save her from drowning.

Yet another time ZigBee saved the whole village of Vik. And the way I heard it was this. A local villager by the name of Haarold Bluetooth, was far up in the snow-capped mountains, tending his flock of sheep in the early spring. It had been a warm spring that year, following a particularly hard winter.

The shepherd, Bluetooth, brought his flock to a stream he knew well, but this year he couldn't approach it. The steam had turned into a flooding river from the rapidly melting snow. Alarmed, Bluetooth now wished he could let the villagers know about the flood before it reached the village, but the village was too far away for him to be heard. Bluetooth simply didn't have the range to help the village.

ZigBee, sensing there was trouble, saw the flood as well. And ZigBee, like Bluetooth, realized he was too far away for a single shout to be heard. So he immediately began to hop down the mountain, ledge by ledge until he reached the village. He automatically opened the dam and the flood passed through without harm to the village.

It was a very lucky thing for Vik i Sogn that they had ZigBee, and that ZigBee knew how to multi-hop."

Sunday, January 23, 2011

Temperature monitoring, TMP36 (LM35), Arduino and Xbee Shield


Components for heating sensor network
I'm using an XBee mesh radio network and Arduino boards to measure the efficiency of the way we use our central heating system at home. We've done a similar thing with power consumption previously using an MQTT feed and graphs at http://www.taoma.co.uk to reduce power consumption by around 15% through better awareness of which behaviours in appliance use are most expensive - the next step is to do the same for natural gas use, which is rising in cost with every quarterly bill.

Initially I planned to measure gas consumption by fitting a modern meter I could read using an Arduino board or gas company web service. I may still go down this route, but since I don't know the sampling interval here, and since nearly all the gas is used by the central heating system, it looks easier just to identify when the boiler fires up and shuts down by putting a temperature sensor in the exhaust manifold. A quick test with a measuring probe indicates this reaches 147°C when the burner has been running for a few seconds. The LM35 temperature sensor conveniently reads to 150°C, which would be an ideal sensor package, however what I've got in stock are TMP36 ICs which read to around 124°C, so we'll have to cheat a little with the readings. The flue is at head hight at the back of the house, making it straightforward to mount a sensor in the exhaust gas flow.

The remainder of this post describes tools, the bill of materials, an overview of the project, and the steps required to build it.

Tools
* Stanley knife and cutting board
* Wire stripper
* Soldering iron and solder
* Glue gun
* Hack saw for cutting sensor mount
* Electric drill and 5mm drill bit for securing the sensor mount to the house

Bill of Materials (I'm in the UK, so some component suppliers are UK-specific)
* 2x XBee Series 2 mesh network devices (www.digi.com, coolcomponents)
* 2x ArduinoXBee v1.1 shields ( see the ArduinoXbee page at www.arduino.cc for an overview)
* 2x Arduino Duemilanove boards (coolcomponents or oomlout)
* 1x XBee Micro USB Explorer breakout board (www.sparkfun.com)
* 5x TMP36 temperature sensors from oomlout.com (www.tinyurl.com/lcwul5)
* 4 metres Cat-5 patch cable
* 2x Power supply (part 00569 at (coolcomponents)
* short length of threaded rod for sensor mount arm (hardware store)
* 4x cable ties to secure sensor to sensor mount arm (hardware store)
* 6x patch-cable sized cable clips, 5mm, to secure patch cable to the wall (hardware store)
* 2x Lock&Lock Arduino-sized plastic food containers to act as enclosures for boards. CoolComponents sells an ABS enclosure for the Arduino, but the ZigBee shield is just a bit too wide for this.

Project Overview

The wiring for the probe is CAT.5 patch cable, which given that it wraps eight wires, provides for six sensors (two of the wires are reserved for common +5v and GND, six are free for connection to the middle pin of each LM35 sensor at one end, and to analogue pins 0 to 5 on the Arduino Duemilanove board at the other).

The XBee Series 2 mesh radio chips are used because it's not convenient to connect the Arduino board measuring the sensor inputs to the Internet - it's in a fairly inaccessible position on the inside of the house in what used to be the kitchen larder, near an air brick that provides a convenient hole to thread the patch cable through. So the sensor unit board has an on-board ArduinoXBee v1.1 shield mounted on it, with a XBee transmitter/receiver configured in "ROUTER/END DEVICE AT" firmware mode. The sensor unit board is responsible for polling each sensor, smoothing out readings, and sending network packets to the remote Monitor Unit board.

The Monitor Unit board is connected via a USB cable to the low-power 8-watt Ubuntu PC in the workshop that monitors power consumption and handles home automation. The Monitor Unit is another Arduino with an ArduinoXBee v1.1 shield and XBee configured in "COORDINATOR AT" firmware mode. This establishes the mesh radio network, and receives messages from the sensor board, which is physically located about 15 metres away and on the floor above the workshop. The USB cable powers the board and interfaces it to the PC using the Arduino Serial library, so that messages from the remote sensor board can be processed, logged in an RRD database , and sent over the Internet using MQTT.

Step by Step
1. Attach sensors at various points on the patch cable after establishing a colour coding convention for each wire - I used blue for Ground, orange for +5v, and green for the signal from the flue sensor, sensor 0. Then it's blue/white for sensor 1 (outside the house for ambient outside temperature), green/white for sensor 2 (zone A), orange/white for sensor 3 (zone B), and brown for sensor 4 (zone C). Tin the ends of the wires; you could solder each wire to header pins at this stage for easy insertion into the sensor board but consider how you're going to thread the cable through the building first.
2. Set the XBee firmware for the sensor board to ROUTER/AT END DEVICE using X-CTU on a Windows PC with the radio chip mounted on the Sparkfun Explorer board; make sure you set the PAN identifier to a number unique to your new network (I chose "254").
3. Set the XBee firmware for the monitor board to "COORDINATOR AT" and set the PAN identifier to match the ID chosen for the other XBee.
3. With the sensor Arduino board disconnected from the XBee Shield, download code to read each sensor ,average the values, and print them using the Serial library with a delay of 1000 milliseconds between each set of readings. Example source for monitoring temperature and writing values to the serial port (which the ZigBee relays data from) is available from a number of helpful Arduino suppliers. I chose to start with http://oomlout.com/TMP36/TMP36-Guide.pdf, which contains a link to an easily adapted source code listing.
4. Attach the XBee shield and ROUTER/AT END DEVICE XBee chip to the Arduino sensor board, connect it to your computer, and use the Arduino IDE Serial Monitor function to check for messages from the sensor program running on the Arduino.
5. I'm working out the details of the monitor board software as I write this, update due when I've cracked it.


Labels:

Saturday, October 24, 2009

Notes from TinkerIt course by Matt Bidulph

I'm rapidly approaching the end of the daybook I was using when I went to #DConstruct09. The following notes need to be transferred out to somewhere more findable before the book goes on the pile of full notebooks, though they won't make much sense unless you have Daniel and Matt's course notes for the afternoon session, I'm afraid.

When using the Zigbee radio shields Daniel supplied, you need to choose XB2NET 2.5 CO-ORDINATOR from the drop down menu and select ZIGBEE ROUTER/END DEV as the device type. The PAD ID should default to 234. You may need to choose 1220 (I circled in in the notes) and you should choose a nodeId of something like "Jerry".

In terms of optocouplers, look at the 4025. And use a back EMF protection diode if your circuit has a motor or inductive coil in it. The silver stripe on the diode must be on the positive side of the circuit!