Posts Tagged ‘Raspberry Pi’

I’ve been exploring the world of linux containers a bit lately and so I thought I’d write a quick tutorial on how to set up the Raspberry Pi (my go to remote embedded build machine) to build Docker from source. If you don’t know what Docker is then you should do yourself a favour and read up about it from their site. It’s a truly amazing piece of software and I’m hoping to use it for instances of node applications as well as embedded build instances in the future. For now lets just build it. As a forewarning I have built my own 3.12 kernel for this particular Raspberry Pi so if something doesn’t work on the default Raspbian image that could be why.

First up install the userspace tools for linux containers. You could of course install the ‘lxc’ package from the repositories but at this time it is on version 0.8.0-rc1 and as I’m building everything bleeding edge I’m sure you’ll need the latest version.

sudo apt-get install libcap-dev
cd /opt
sudo git clone https://github.com/lxc/lxc.git
cd lxc
sudo ./autogen.sh && sudo ./configure && sudo make && sudo make install
lxc-version
lxc version: 1.0.0.beta1

Next we need to get go. Again we could install the ‘golang’ package but this is the 1.0.2 version and 1.1 version contains many improvements for ARM. So I’ve chosen to get a precompiled version.

cd /opt
sudo wget -c http://dave.cheney.net/paste/go1.2rc1.linux-arm~multiarch-armv6-1.tar.gz
sudo tar -C /usr/local -xzf go1.2rc1.linux-arm~multiarch-armv6-1.tar.gz
Add export PATH=$PATH:/usr/local/go/bin to your ~/.profile or /etc/profile
go version
go version devel +5b367120d592 Thu Sep 19 17:12:00 2013 +1000 linux/arm

Building from source is also pretty easy

curl https://go.googlecode.com/files/go1.2.src.tar.gz | tar xz -C /usr/local
cd /usr/local/go/src
./make.bash
go version go1.2 linux/arm

I have included the AUFS patches from here into my kernel but from docker version 0.7 you do not explicitly need them. Patching is done by compying in the new sources and then running the patches from the root of your kernel source tree.

AUFS-Utils is also useful if you plan on using this feature.

cd /opt
sudo git clone git://git.code.sf.net/p/aufs/aufs-util
cd aufs-util
sudo git checkout aufs3.x-rcN
sudo make && sudo make install

The most difficult part of this whole process is the fact that the docker build system uses docker containers to build itself so you need to have docker to build docker. The guys at resin.io have made things a whole lot easier by publishing a raspberry pi built docker binary. This can be found here, extracted and used.

docker -v
Docker version 0.7.2, build 28b162e-dirty

Building from source can then be completed using the standard installation instructions from the docker website.

RFM12B Linux Module

Posted: July 8, 2013 in Uncategorized
Tags: , , ,

RFM12B Linux Module

I found this great project the other day. I’ve been meaning to write something like this for ages. It will really help expand my home projects. I will integrate it into my EVE Raspberry Pi as soon as I get some time to play. SO helpful!

I was asked recently by our mechanical team at work to help them with a little project that involved building a pneumatic test rig to stress test our product. It was designed to do things like electrical stress tests like powering the device on and off a million times, mechanical tests like plugging and unplugging a USB cable and touching the touch screen. They had me a pneumatic.

The rig is powered by a raspberry pi with a PiFace for the relays and I/O. The interface is written in Node.JS with Angular for the frontend. It was a really great project (simple as it may be) and has been a great excuse to dive into node properly. It’s power continues to astound me and Angular’s bidirectional bindings really makes it easy to give powerful embedded projects a UI. It scales up really well to so you don’t have to worry about changing technologies later. The code is available on my github as usual.

I know this video is not very exciting but I think it’s cool. I’m also working on getting the low level SPI bindings working properly. More on that in a future post but node-gyp is incredible and node-ffi is so incredibly powerful for quick external library bindings.

I had a little time to play around this weekend so I got out some toys I’ve been meaning to play with and got a few things up and running. My EVE board has been lying around collecting dust so I assembled the RFM12B and the Ciseco SRF modules along with a TMP100 on board temperature sensor. The EVE board has 2 locations where the SRF module can be fitted but I put it on the 868MHz location as that’s the frequency I am using. The PCB is routed such that the Pi can communicate with it via SPI on SS0 but it also has pads for the serial connection which is a blessing as the firmware that the module is shipped with uses serial and not SPI. Although you can OTA program these devices since I don’t have any radio modules that can easily connect to a PC I just hooked up an FTDI adapter to the serial port and programmed them using their XCM tool. The firmware image can be found here.

RFu328

I also have one of their Arduino compatible boards with a footprint for the same SFR module on the Pi so I programmed that up with the RFu328 code (I used the beta firmware) and put a small sketch on there which periodically reads the temperature and humidity values from a DHT22 sensor and sends them out to anyone listening. The protocol used to send these packets is LLAP which is really basic but gets the job done. CRC and other such things are handled in hardware so that is not required in the protocol. After that it was easy enough write a python script on the Raspberry Pi to read the values and for now just posts them to COSM.

Next phase I’m going to set up some web sockets and have a play around with some HTML5. All in all it was a fun little weekend project and I am most happy with how far it’s come.

I would also like to change this so that the sensors do no just present the data but rather are polled. While I’m at it I’d also like to build in standard inputs and outputs so I don’t have to change the code if I want to add a few basics later.