X10 and Home Easy with Node-RED

Some X10 and Home Easy modules

Some X10 and Home Easy modules

This is part of a series of posts I am doing describing some of the things I have been doing as part of the revamp of my home automation system.

When I started on the home automation road in 2002 I began with a kit of 3 X10 modules and a CM12U PC interface which I controlled via the command line X10 application Heyu and some DIY scripts, shortly afterwards I switched to the Perl based MisterHouse package which I heavily customised over the years and continued to use until recently.

Many more X10 modules were added over time giving me control of most lights in the house as well as several appliances. X10 has always had a few issues though, the modules are fairly costly although the clones available these days have improved that somewhat but the biggest issue has always been that it is susceptible to noise or interference on the mains line causing things to not turn on/off when asked or to turn on/off erroneously. As more and more electrical devices have been added around the house and with nearly every wall socket having a 4, 6, 8 or more gang adapter plugged into it these problems have only got worse.

With this in mind I’ve been gradually adding more and more Home Easy modules to replace the X10 modules that were causing problems and have now switched almost exclusively to Home Easy. Unlike X10 these modules work via RF so don’t have the same communication problems and they are very cheap, 3 appliance modules can be had for around £20 with a remote control, less if you pick them up second hand on eBay and being controlled via 433MHz OOK signals they can easily be controlled using an Arduino etc.

Continue reading X10 and Home Easy with Node-RED

TinyTX & Tiny328 Sensors with Node-RED



Node-RED is currently taking the IoT world by storm, described as “A visual tool for wiring the Internet of Things” it is built on top of Node.js and is an open source project developed by IBM employees. It makes it easy to link various inputs and outputs adding simple or not so simple processing in between, just drop your various parts into a workspace and link them up. It also makes a great way to map MQTT topics to each other.

It comes with a whole host of input and output nodes, MQTT, http, websockets, serial, tcp/udp and it can read logs, write to files, call external programs, connect to databases etc. which make it possible to connect with just about anything you can think of. There is also built in support for services like email, Twitter, irc, Pushbullet and Twillio SMS.

To bring the data from my sensors into Node-RED I am using one of my Tiny328 boards running the Jeelib RF12demo sketch which is connected to a cheap FTDI adapter plugged directly into my server but this could just as easily be done with a JeeLink, a TinyTX or any Arduino compatible with an RFM12B radio. If using a Raspberry Pi then the RFM12Pi could also be used.

Continue reading TinyTX & Tiny328 Sensors with Node-RED

Wireless Sensor Battery Life 2 Years On

2 Years and still going strong

2 Years and still going strong

Back in November 2011 when I made my first ATmega328 based wireless temperature sensor node I did a rough calculation estimating that it would last 2 years or more on a couple of AA batteries. That first node was decommissioned after a few months but the second version, also based on an ATmega328 is still running and on the original set of batteries since 29 December 2011, exactly 2 years ago today.

That’s with an ATmega328P running at 16MHz with a RFM12B radio and DS18B20 temperature sensor powered from 2 x Energizer alkaline AA batteries (essentially the same as the new SMD Tiny328 nodes but built on stripboard) and is transmitting once a minute. The battery voltage is now down to 2.71V which is well out if spec for a 328 running at 16MHz but the datasheet specs seem to be very conservative and it is still ticking along fine. Previous tests showed that it should be good down to around 2.6V with the DS18B20, below that the sensor’s readings start to become erratic. Again, that’s a good margin less than the minimum of 3V stated in the data sheet.

Two plus years is inline with my original predictions but it is good to see it actually happen in the real world, particularly as this node started out on code that wasn’t quite as optimised for low power use and since I enabled ACKs at the end of August 2012 it makes quite a few retries (it is the furthest from the base station) so in reality it often sends more than once a minute.

Continue reading Wireless Sensor Battery Life 2 Years On

Wicked Device WildFire Arduino Compatible with ATMega1284P and WiFi

Wicked Device WildFire

Wicked Device WildFire

Vic at Wicked Device kindly sent me one of their new WildFire Arduino compatible boards to try out. The WildFire uses the ATMega1284P microprocessor clocked at 16MHz and has an onboard Texas Instruments CC3000 WiFi module and a MicroSD card slot all on a board the same size as a standard Arduino Uno or Duemilanove.

Followers of this blog will know I’m a big fan of the ATMega1284P and it was what I used in my own OSWIN Arduino compatible board although that was with the huge 40 pin DIP version, the WildFire uses the 44 pin TQFP package making a much smaller board possible.

The ATMega1284P has quite a few advantages over the ATMega328 used in the Uno and Duemilanove, more RAM (16KB v 2KB), more Flash (128KB v 32KB) and more EEPROM (4KB v 1KB), things which really make a difference when doing web server type applications. There is also more I/O, on top of the usual array of pins found on the Uno/Duemilanove etc. the WildFire has 2 more analogue pins squeezed in next to the usual 6 and an extra 6 pin header provides 4 more digital pins as well as duplicates of the I2C pins and there is also a JTAG programming/debug header.  You also gain a second UART on D2 and D3 and an extra interrupt that means two are still available for use (INT0 on D2 and INT1 on D3) even though INT2 on D8 is in use for the CC3000 IRQ. All the available pins on the WildFire are at a 5V logic level with a couple of buffer chips handling the high/low conversions to the 3V3 parts (CC3000 and uSD slot).

Some of the pins are used for communication with the built in peripherals, namely D4 for the uSD slot CS, D7 for the MAC chip data, D8, D9, D10 for the CC3000 and of course D11,D12,D13 are the SPI pins used for the uSD slot and CC3000. The WildFire library allows you to easily create an object to make sure these pins are initialised in a safe state.

Continue reading Wicked Device WildFire Arduino Compatible with ATMega1284P and WiFi

Ikea Oleby Motion Activated Light Hacking with the TinyTX

Reassembled Oleby

Reassembled Oleby

Nick was kind enough to send me one of these little Ikea cupboard lights that he had the great idea of adding one of my TinyTX sensors to. These motion controlled LED lights are only £5 for two and are available in a range of colours, they are only 7.5 x 6.5 x 1.8 cm with 4 LEDs, a PIR detector and run from 3 x AAA batteries.

This is an excellent find and the size is spot on for the TinyTX, by removing the four LEDs (or just three of them) the TinyTX 2 or 3 will fit in nicely (with the ATtiny84 soldered directly to the board for a reduced profile) and the PIR control board will happily run on only two AAA batteries so we can bridge the third one leaving space for the antenna and maybe a sensor or two. It makes for a much neater and more compact occupancy sensor or room node than the Airwick iMotion Freshmatic that is commonly hacked for this purpose.

Comparison with Airwick

Comparison with Airwick

Continue reading Ikea Oleby Motion Activated Light Hacking with the TinyTX

Tiny328 – A mini wireless Arduino clone


The first Tiny328 successfully reflow soldered

So here is the reason for the last couple of blog posts.

This is my first venture into designing an SMT board and apart from the practice run I did with some breakout boards it is the first time I’ve attempted to solder anything as small as a TQFP package or the tiny 0603 passives (1.6 x 0.8mm) used here. It’s something I’ve been wanting to try for a while and I’m happy to report that it all went well and yes, you can definitely solder these things at home with a minimal outlay.

ATmega328 + RFM12B * TinyTX = Tiny328

The original TinyTX wireless sensors were named as such due to the use of the ATtiny microcontroller rather than because they were tiny, this one uses the ATmega328P but the Tiny name still seems to fit as at only 23 x 36 mm its actually slightly smaller than both the previous TinyTX PCBs. So Tiny328 it is.

The idea behind the Tiny328 (apart from the intro to SMT) was to make something that is as small as the TinyTX but with a lot more I/O and full Arduino compatibility without any messing around with different cores or USI implementations of SPI/I2C. I went through several design iterations with this board, originally starting with a square board with the I/O pins around all four edges but eventually decided on something more like the Arduino mini, Teensy or Moteino designs with the I/O pins down the long edges spaced so that it is breadboard and stripboard friendly which makes it a lot more universal. Other than a (to me) more sensible pinout than the mini the other main differences are the use of an external FTDI adapter instead of an on board FTDi chip (keeps it simple and low cost) and on the bottom side of the board is a footprint for an optional RFM12B/Alpha TRX433S or Ciseco SRF transceiver. With those decisions made the final size sort of dictated itself and it couldn’t really be any smaller than it is without making compromises somewhere.

Apart from the requirement for a separate FTDI programmer the Tiny328 can pretty much do everything that an Arduino Duemilanove or Uno can do as all the pins are broken out to the standard 0.1″ spaced headers and by using the standard Uno bootloader it is fully compatible with the an unmodified Arduino IDE.

Continue reading Tiny328 – A mini wireless Arduino clone

OSWIN Gateway with RFM12B, SRF and OOK Support

OSWIN with RFM12B, XRF and OOK receiver.

OSWIN with RFM12B, XRF and OOK receiver.

So after getting an SRF based TinyTX and an OOK based one running I thought I should update the gateway code for my OSWIN gateway to support both types of sensors as well as the RFM12B.

To receive the SRF node I’m using a Ciseco XRF in the Xbee socket and the OOK receiver is plugged in across four of the analogue pins (only 3 are used).

The updated code is available on Github here, there are some defines near the top to enable or disable which type of radios are to be used and a few settings to configure which pins the OOK radio is connected to. ACKs and the NTP time transmit function are only supported with the RFM12B for now but I may add them to the SRF/XRF combo later.

This shows the serial debug mode showing the three different types of nodes coming in, an RFM12B based node, an OOK node and an SRF node.

Continue reading OSWIN Gateway with RFM12B, SRF and OOK Support

Using a cheap OOK radio with the TinyTX

TinyTX with OOK radio

TinyTX with OOK radio

Going the opposite way to the last post this is a version of the TinyTX wireless sensor node using a very cheap radio setup. I first experimented with this 433MHz OOK/ASK radio pair a few years ago with an ATmega328 and the VirtualWire library but I never did much with it beyond a simple demo and when I started using the RFM12B it got shoved in a drawer and forgotten about. At some point I dug it out and botched it onto the TinyTX V2 board you see here but it seems that the internal oscillator on the ATtiny84 isn’t accurate enough for the timing required for VirtualWire and I couldn’t get it to work so it languished in a drawer for a while longer.

After a recent discussion reminded me about it I thought I’d give it another try with this Manchester encoding library which is supposed to be a lot less timing critical and it does indeed work perfectly and makes it very easy to use a struct to send the data back to the gateway just like with the RFM12B and SRF versions.

The eBay listing I bought mine on is long gone but there are loads of similar ones on there for as little as £3 for the pair. My transmitter is a AU-T01 and the receiver AU-RM-5V but  I’ve seen identical looking ones sporting different part numbers, these look identical for example. I can’t find a datasheet for either but the notes I have from when I bought it says the transmitter should work on anything between 3 and 12V (consuming 9mA at 3v) but the receiver is specified at 5V (as the part no. suggests), however I’ve tested it on 3V3 and it seems to work fine.

Continue reading Using a cheap OOK radio with the TinyTX

Using the Ciseco SRF with the TinyTX

TinyTX3 with Ciseco SRF radio

TinyTX3 with Ciseco SRF radio

I’ve been meaning to get round to this for a while. I bought one of Ciseco’s SRF transceivers when they first came out in October last year but didn’t get round to trying it until a couple of months ago when there were rumours of the RFM12B being discontinued and while that isn’t the case just yet (it is still in production just not recommended for new designs) there are a few reasons why you might want to use the Ciseco SRF in place of the RFM12B on the TinyTX wireless sensor node.

The first nice thing about the SRF is it uses the same footprint as the RFM12B so it will fit in nicely on the TinyTX. It is supposed to have a better range although I’ve not had chance to do any proper long range tests with it against the 433MHz RFM12Bs that I used but 300M range in open space and penetration through 3-5 walls is claimed on the product page and that is with the built in chip antenna, replacing this with a wire one (as is necessary with the TinyTX) gets you a better range. Someone got as far as 3Km with the compatible XRF and wire antennas although it was at a very low data rate.

The SRF is also compatible with several other Ciseco modules such as the XBee form factor XRF, the USB connected URF and the Raspberry Pi “Slice of Radio” module which might make linking up with other systems easier.

Continue reading Using the Ciseco SRF with the TinyTX

Introducing OSWIN, the Open Source Wireless IoT Node


OSWIN with ethernet and RFM12B and XRF radios

OSWIN is the only slightly contrived acronym for my new Arduino compatible Open Source Wireless IoT Node based on the ATmega1284P AVR microcontroller.

I blogged about using the ATmega1284P with the WIZ820io ethernet module last year and was subsequently sent two prototypes based on the same combo to evaluate, the MAX1284 and the Air Sensor Hub. For the last 6 months I’ve been running the MAX1284 prototype as a replacement for my Nanode emoncms gateway, uploading data from my TinyTX sensors to my emoncms installation and it has been rock solid. Inspired by this and with another $10 Seeed Studio PCB voucher burning a hole in my pocket I decided what the world needed was yet another open source Arduino compatible.

If nothing else this will now allow me to point people asking what I am currently using on the receiving end of the TinyTX sensors towards something they can duplicate for themselves and as it has all the standard Arduino features and more it can also be used as an “Arduino on steroids”. The extra resources will certainly come in handy in many projects, including use with some of the RAM heavy GLCD displays and it would help with the RAM problems I ran into with my Nanode based IR web remote control. As well as being Arduino shield compatible and having options for the RFM12B transceiver and ethernet module there is also an Xbee compatible socket allowing use of Xbee or Ciseco XRF radios or a wi-fi version can be created by fitting a Roving Networks RN-XV.

Continue reading Introducing OSWIN, the Open Source Wireless IoT Node