Saturday, November 20, 2010

Navitrino goes MEGA


For some time I have been developing a central heating controller as the first application under the Navitrino banner.

Whilst it's never going to be the smartest or neatest heating controller, the knowledge gained in doing this relatively straight forward project will boost my experience of programming embedded hardware in C, and give me a whole set of new devices to play with, such as an SD card interfaced using the SPI bus, real time clocks, one-wire devices, ethernet controller interfacing and writing to modern displays such as those found in mobile phones. Navitrino is essentiallly a navigation exercise through the world of modern consumer electronic devices.

One of the problems I have found, is that it it is difficult to develop new code, whilst your one and only Arduino is busy runing a central heating controller. Obviously the solution was to get another Arduino - but it would be a shame not to take the opportunity to go for a massive hardware upgrade - which meant buying an Arduino Mega.

The Mega has been widely copied in China, and a look on TaoBao.com - the Chinese equivalent of Ebay, turned up loads of examples, including bare boards and other interesting shields. Whilst you can buy a Mega for as little as £17 from Hong Kong, I decided that I couldn't wait 3 weeks, so in a rash move, splashed some cash to CoolComponents and bought a brand new Mega 2560.

The Mega 2560 is the latest offering from the Arduino stable - and it is an Italian born throroughbred. It uses the Atmel ATmega2560 processor which is a 100 pin quad flatpack - bristling with I/O. No more would I be restricted to the 19 I/Os on the standard Arduino - now I would have 3 extra comm-ports, 10 more analogue inputs, 32 additional digital I/O lines plus the I2C port brought out to its own connector.

In terms of memory, the ATmega2560 has 256K of flash, 8K of RAM and 4K of E2. That should be more than enough for the largest of projects. The Mega 2560 is still quite costly - in fact you could buy two Chinese import Mega 1280's for the same price. Once the Navitrino application code is stable - I expect that it will fit into 128K - so the cheaper Mega 1280 will be the preferred option as the starting platform.


I've also bought the Nokia 3310 LCD shield from NuElectronics, which at £10 is good value for money. It can be set up as a 5 line x 16 character display, but can also display bitmaps and larger font texts. Andrew Lindsay has written an improved library to give better graphic functions and fonts compared to that supplied by NuElectronics. The Nokia shield also has a 5 axis miniature joystick with a tact switch action. This is connected to a resistor divider chain such that it produces an analogue value for each of the 5 axes.

I have modified the shield so that the reset switch can be used as a "hot water boost" button. This was done simply by removing the reset pin from the shield, clipping off the remaining plastic header which held the reset pin, and connecting a resistor from the exposed "reset" pad to the adjacent via which connects to the end of R14. I used a couple of 0603 resistors (8K2, 3K9 in series) but a 12K 1206 would fit. Pressing the reset button then generates an analogue value - just like the other switches on the joystick. For my choice of resistors it gave an analogue value of 916.


I also modified the board so that the power LED can be driven from digital output 2. In this way the LED on the shield can be driven independently from code to signal when the water is hot - flashing when the water is heating and staying on full time when the water has exceeded the 45C comfort temperature. These two new features allow the Nokia 3310 shield to form the basis of a simple user interface for the central heating controller.


The plan is to use the mega initiallly to develop a user/programming interface based on the Nokia 3310 shield and then the mega will eventually become the master or hub device with the ethernet connection which talks to a number of slaves. I'm also interested in seeing how the Mega can be adapted to present a series of identical ports - just like JeeNodes so that any device can be plugged into any port.

I've also bought some DS18B20 temperature sensors which I'm going to use to extend my temperature sensing network to allow four more rooms of the house to be monitored. It's an important addition to the basic controller - and there is a lot of interest in using one-wire sensors which use considerably less I/O pins than the equivalent thermistors.

1 comment:

  1. Were you able to get the Nokia LCD shield working on the Mega without having to hardware mod the shield? It should be possible to use soft spi but I just cliped a few pins, wired it to the spi pins on the mega, and changed the pins/ports in the 3310 library. Would be interested in a soft spi solution if you come up with one.

    ReplyDelete