Most of the things I do on a day to day basis are in relation to building websites and looking at ways to code interesting online actions – one thing I’m interested in however is the idea of the internet of things – smart, connected objects that bridge the gap between the online and actual world. Perhaps one day I’ll even find an ecampaigning application for this.
I just had a go connecting up a Nerdkit with the Raspberry Pi. Nerdkits are similar in some ways to the Arduino boards, although they’re a bit more hands on. Whereas the Arduino is nicely assembled and can be just plugged into a USB port, the Nerdkit comes as a pile of parts, a bit of breadboard and some instructions. What’s exciting about Nerdkits, Arduinos and microcontrollers (MCUs) in general is that they provide a flexible, re-programmable set of ‘brains’ with lots of interesting uses. Think of them as lego for electronics.
The ultra cheap Raspberry Pi makes a nice partner to the Nerdkit, as I’m still slightly nervous about attaching something I’ve put together myself to my shiny Mac. Along with the instructions come a set of makefiles which you compile and upload to the MCU via the USB to serial adapter.
The Nerdkit is based around an Atmel AVR ATmega168 microcontroller which has it’s own bootloader. Also included are the crystal, various resistors, voltage regulators and a variety of input sensors and output electronics. Putting the whole thing together is very satisfying and has given me a bit more insight into how microcontroller based kits work (and what all the bits on the Arduino board do). One really nice additional feature of the Nerdkit is the lcd display panel, which provides feedback in the form of messages, poetry or temperature readouts – depending on what you program it to do. The example below shows it running as a thermometer (one of the included tutorials). Mounting the whole thing on a bit of board is highly recommended.
Installing the software as in the user guide works fine -it’s all done in the command line, so there’s no Java based application to worry about –
sudo apt-get install avrdude sudo apt-get install gcc-avr sudo apt-get install avr-libc
You can edit the makefiles using Leafpad which is part of the default Raspbian operating system. Connecting the Nerdkit cable to the Pi’s USB port presented no problems either.
I did however run into a small snag – although programs would compile and upload successfully, the display on the Nerdkit was showing just on the top line:
A quick hunt through the forums later and I came across the fix – open the Makefile (in the example above it’s the one in the tempsensor directory and the one in the libnerdkit directory), look for the GCCFLAGS line and change the “-Os” flag to “-O0” (letter O, number 0). Then delete the .hex and .o files in both the directory your Makefile is in and the libnerdkit directory. That last bit is vital, I kept missing it.
Then it should work fine:
So there you go – my first steps in getting my Raspberry Pi to do a bit more than web surfing. I thought I’d highlight that the Raspberry Pi and Nerdkit work together happily, in case anyone else wants to try it out.