Node-Red on Raspberry Pi with RFM12B support

Raspberry Pi with rfm12b radio
Raspberry Pi with rfm12b radio

You can find these rfm12b modules on sale on ebay – I paid about £10 with delivery and it arrived promptly, the seller chacal_zoom seems to have a number of interesting little circuits, specialising in minimum parts and tiny boards! (avoid the bedini circuit tho he he he!!!)

After seemingly endless weird problems getting the rfmb12 driver working and loaded automatically as well as re-installs, imaging mishaps etc. I’m now getting both more expert at configuring raspian and somewhat bored. Also I’m now convinced that we’ll always be going wireless from now on, so the rfm12b driver is a must. Plus Wiring-Pi and a couple of other nodes added into node-red for completeness, giving a ‘base-system’ setup.

So I’ve decided to go scriptomatic and as a first step I’ll list some commands that you can just paste into the terminal and go away and have a light meal while stuff installs. At the moment you will have to come back after the starter because there is a reboot early on to start using the new kernel.

So, having created an SD card with raspian on it I expand the file-system now rather than later, to make sure I leave a couple of hundred MB for SD block failures. On boot, login with the default username of pi and password raspberry. Run sudo raspi-config to enter the easy config. Change password and then in advanced – change hostname, ensure that the graphics split is 16MB, enable SPI and reboot.
Now you can log back in with your new password and then paste the commands below.

EDIT – NOT YET WORKING ON PI 2!! But you can install headers by replacing the ‘rpi’ with ‘rpi2’ if you are using a Raspberry Pi 2 – and either way don’t forget to update the version numbers in my example e.g. “3.12-1-rpi” with the ones you actually downloaded in /boot – e.g. “3.18.0-trunk-rpi2”.

1st – Kernel with headers – 8 min

echo 'Europe/London' | sudo tee /etc/timezone
sudo dpkg-reconfigure -f noninteractice tzdata
sudo aptitude update
sudo aptitude install -y linux-image-rpi-rpfv linux-headers-rpi-rpfv
echo -e "kernel=vmlinuz-3.12-1-rpi\ninitramfs initrd.img-3.12-1-rpi followkernel" | sudo tee -a /boot/config.txt
sudo reboot

The next set of commands do some config as well as installation of the radio driver, so edit them if you want a different node id by default for example.

2nd – RFM12b driver installation – 1 min

git clone https://github.com/gkaindl/rfm12b-linux.git
cd rfm12b-linux
sed -i rfm12b_config.h -e 's/#define\ RFM12B_BOARD[[:space:]]*0/#define\ RFM12B_BOARD\ 1/g'
sed -i rfm12b_config.h -e 's/#define\ RFM12B_DEFAULT_GROUP_ID[[:space:]]*211/#define\ RFM12B_DEFAULT_GROUP_ID\ 101/g'
sed -i rfm12b_config.h -e 's/#define\ RFM12B_DEFAULT_JEE_ID[[:space:]]*0/#define\ RFM12B_DEFAULT_JEE_ID\ 1/g'
make
sudo cp rfm12b.ko /lib/modules/$(uname -r)/
echo -e "rfm12b" | sudo tee -a /etc/modules
sudo depmod -a
cd examples
make
cd ~

Edit – if you have errors at the make stage then recently I found that there was a test at line 25 of the Makefile that was erroring – as we are past version 3.7 we can remove the test and just always execute the line after it. So delete line 25 from the Makefile – it starts with if [ -f /lib/….

Now to prepare for the big update/install of everything else we install Gordon’s excellent Wiring-pi library.

3rd – Installing wiring-pi – 1 min

git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
cd ~

And finally, for something completely different. Some more installation stuff, this time you shouldn’t rush back …

4th – Main update & installation of packages ~ 30 min

sudo aptitude upgrade -y
sudo aptitude install bootlogd mosquitto
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb
rm node_latest_armhf.deb
sudo adduser --system node-red --ingroup pi
sudo chmod 775 /home/node-red
cd /home/node-red
npm install node-red
cd node_modules/node-red
npm install serialport stately wiring-pi

And just add in the startup script from here, edit the init script to use the node-red user and you’re golden.
sudo wget -O /tmp/download https://gist.github.com/Belphemur/cf91100f81f2b37b3e94/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod +x /etc/init.d/node-red && sudo update-rc.d node-red defaults

2 Comments

 Add your comment
  1. Hi there,
    here’s the problem I have on reboot after ” 1st – Kernel with headers ” the Pi locks up and hangs, and I end having to re install a new sd and start again .
    any clues on how to fix it is appreciated.
    Thanks

Leave a Comment Cancel reply

Your email address will not be published.

37 − = 34