What’s this about?
This is Peter and Maureen Scargill's Spanish website. We live in Galera in Andalusia (for clarity, that is the English spelling - Mid-Spain they spell it Andalucia and pronounce it "And-a-loo-thee-a").

We've had a home in Spain for more than 14 years and it is now our permanent base though we retain a small home in the UK.

Find out more about this by reading through the blog entries, menu-accessible pages and archives if you're interested! Welcome to Peter and Maureen's Spanish website.

Get in touch via Facebook Peter's Facebook Page
Please follow Peter on Twitter Follow Peter on Twitter
Join Peter's LinkedIn network Join Peter on LinkedIn

NRF24L01, Arduino and Interrupts

Another one for the techies: Here in Spain I’ve been putting serious time into developing the home control – with a view to leaving something here when we return to the UK. It all works, I have a system which can turn stuff on and off and even calculate lighting up times to override manual controls – but I’m still not happy with the radio.

The NRF24L01 modules are dirt-cheap radio modules found on EBay for barely over £1 each – and they are very tempting to use as the nearest competition costs several pounds per unit and this simply shoves up the cost of come control modules beyond what some might consider practical.

These small transceivers can reliably transmit back and forth thanks to the free RF24 library and can even function in a kind of network thanks to the RF24Network library. The problem is – they only transmit over very short distances – frighteningly short. In a straight line outside you might well get 100ft or more – but thick walls absolutely crucify the signals – worse, they operate in the same frequency band as WIFI, microwave ovens and a ton of other stuff. Add all of this together and you’re looking at as little as 15ft or less depending on wall structures.

The RF24Network tries to get around this by allowing any unit to talk to 5 other units which in turn can talk to 5 more units. This generally works fine as long as you remember this is NOT a general mesh network. These boards CANNOT listen and talk at the same time so it is important that you plan for this – the turning point in implementing the home control system which is still a work in progress, detailed elsewhere in this blog, was ensuring only the master generally initiates conversations and waits for a response before moving on. Not ideal AT ALL but it works.

That and the limitations of the ATMEGA328 are beginning to get on my nerves now. The master unit is able to talk to slaves all over the building and keeps track of time thanks to the Internet – the problem is that the Internet library takes up a third of available space. Add to that the drivers for the radios and time server software and you’re almost out of space and that’s despite much optimising of code (or time wasting). I now have light-up and dusk software for lighting and I’ve so little room left in the master that I’ve had to put this in each of the slave units – hardly ideal and a maintenance nightmare.

So two things are on the horizon for this project. If we can get the 256 cheap enough, the master board will move from 32K of memory to 256k of memory – or worse case I plan to use the 1284 which has 128k. With that kind of memory I can add the ability to email or Tweet my mobile in the event of problems with slave boards which will add to peace of mind. It also means the ability to add in a whole rule engine for which there is simply no space right now, possibly stores in SD memory – which again – there is no WAY to add with the current chip.

Another possibility for the future which we’re looking at is to use a relatively new ATMEL chip which has radio functions on-board – there is a a library for this for a “proper” mesh radio network which will allow any arbitrary unit to talk to another without potential collision issues. That would just open up so much. The problem right now is getting the Atmel Studio to compile Arduino projects – as it is necessary to use that (free) software to add their precompiled libraries – Arduino cannot do this directly (for now). In addition, the chip is one of the smaller surface mount units which makes it impossible for amateur use without a reflow oven so it might be that we produce a semi-populated board using something like KickStarter to fund this. Time will tell.

For now the 1284 chip will allow continued development of the master unit. I need tools I have in the UK only so expect more on the subject in here in a matter of weeks.

Comments are closed.