Author Archives: Robert

The Things Network Nijmegen – LoRaWAN module

Next Tuesday we will meet with the core team of the TTN Nijmegen in a small workshop to get things moving. There are some gateways now in Nijmegen (see the coverage map here), so we can and should get started with prototypes and trying to build the local community!

Preparing for next weeks meeting, I ordered a HopeRF RFM95W module at IdeeTron that is compatible with LoRaWAN. Since the hole spacing is 2 mm, making it incompatible with standard headers and a breadboard, I soldered short wires to each of the pads.

RFM95W module

This allows me to plug it into a standard breadboard with a little bit of bending of the “legs”.


Note that – compared to the layout in the data sheet – I soldered it upside-down. This allows me to still read the silk screen labels on each of the connections.

Raspberry Pi – getting the RFM12b to work

Now that I know how to blink a LED, it is time to move to slightly more interesting applications of the GPIO interface on the Raspberry Pi. I have a few Arduino modules in and around the house monitoring the climate and various other measures. They are all battery operated and send their information to a relay that forwards all data to Thingsspeak.

My current relay module consists of an Arduino Uno with an Ethershield, connected over i2c to another Arduino pro mini. The second Arduino is connected to a RFM12b module and uses JeeLib to receive data from the sensing modules. Would it not be nice to receive that data on a slightly more powerful platform and be able to do more with it than just forwarding it elsewhere…

Raspberry Pi with RFM12b

Raspberry Pi with RFM12b

I decided to give the rfm12b-linux kernel driver a try, as it explicitly supports the JeeLib format. I followed the instructions from rbi-source without problems. After changing the board type (RFM12B_BOARD) and group (RFM12B_DEFAULT_GROUP_ID) in rfm12b_config.h, the module compiled without problems. However, it would initially not load, showing errors in the dmesg output.

Following some suggestions here and here, I used rasps-config to disable the SPI, I2C and the Device Tree. After that, it did load and dmesg showed

[ 478.278166] rfm12b: added RFM12(B) transceiver rfm12b.0.1
[ 478.278391] rfm12b : driver loaded.

I compiled the example applications and used this

pi@hackpi:~/rfm12b-linux/examples/bin $ sudo ./rfm12b_read 

successfully opened /dev/rfm12b.0.1 as fd 3, entering read loop...

Fri Apr 29 20:07:50 2016
	32 bytes read
		4 0 0 0 115 24 0 0 87 14 109 64 102 230 11 65 41 44 124 68 
		0 0 192 127 0 0 192 127 115 162 189 253 
Fri Apr 29 20:08:14 2016
	32 bytes read
		2 0 0 0 59 77 2 0 122 233 110 64 210 225 148 65 0 0 192 127
		0 0 192 127 0 0 192 127 93 112 175 32 

showing two messages from two modules. I recognise the pattern as

typedef struct payload_t {
  unsigned long id;
  unsigned long counter;
  float value1;
  float value2;
  float value3;
  float value4;
  float value5;
  unsigned long crc;

belonging to the lm35 and bpm085 modules that are sending their data approximately every minute.



Raspberry Pi – first steps to blink a LED with Python

I already purchased my first Raspberry Pi in 2011, but have been postponing connecting any electronics to its GPIO interface. Instead, I have been using it for more general computing applications (media center, web server, remote ssh access and tunnel, etc.). Rather than using the Raspberry Pi for in refacing with hardware and IOT, I have been using a bunch of Arduino’s to implement sensors and actuators for home automation.

Since I recently have been brushing off my Python programming skills for the EEGsynth project and been teaching myself Node JS, I was triggered to revisit the Raspberry Pi for GPIO electronics. With the Raspberry Pi it will be easier to implement my own web server and to use webhooks to integrate my home automation hardware projects with online platforms such as IFTTT.

I decided to try Python first and after browsing the web decided to use the WiringPi interface, as it supports C programming in the same style as on the Arduino, but also has wrappers for more high-level languages (Python, PHP, Ruby and Perl).

I started with installing the WiringPi library as per instructions

git clone git://
cd wiringPi/

and tested it with a LED in series with a 680 Ohm resistor attached to the first GPIO pin, aka pin 17 on the Pi cobbler. I still have to wrap my head around the pin numbering, but understand that there are different numbering schemes.

Subsequently I ran the test from

cd examples/
make blink
sudo ./blink

and also tried out this on the Linux command line

gpio write 0 1
gpio write 0 0
gpio write 0 1
gpio write 0 0

This all worked as expected and the LED would nicely blink. I subsequently moved on with Python. Instead of following the detailed installation instructions, I simply tried

sudo pip install wiringpi

which worked like a charm. The following Python code

#### this is #### 

import wiringpi
import time



while True:

works with sudo, i.e.

sudo python

As with the pin numbering, it is still a bit of a puzzle to me when super user rights are needed and when not. But the following worked for me without sudo

#### this is #### 

import wiringpi
import time
import os


os.system('gpio export 17 out')


while True:

and then on the Linux command line


It is already rewarding to see a simple LED blink. Next challenges will include combining it with a RFM12B or RFM69CW module to have the Rasperry Pi receive the messages from the (battery operated) Arduino’s for which I use the RFM12B for communication.

Furthermore, Adafruit has a nice tutorial showing how to use Node JS with a Raspberry Pi. That is also something to explore…

Raspberry Pi as Eurorack synthesizer module

Processing realtime EEG data from the OpenBCI system requires software running on a computer. For the EEGSynth project we do the rapid application development using the platforms that we are most familiar with, i.e. standard laptops and the FieldTrip toolbox, which is based on MATLAB. However, in the end we want to implement as much as possible using affordable and open hardware and software. Hence we opted for the Raspberry Pi, a credit card–sized single-board computer. It runs Linux, which makes it easy to use standard programming platforms and interfaces such as Python and Redis to implement the software stack.

In the first EEGSynth studio performance you can see Stephen in the middle, operating the MATLAB-based GUI for the EMG/EEG processing, and Jean-Louis at the back operating the synthesizer. The goal of the technological development is to put Jean-Louis completely in control and to make the interface of the EEG synthesizer as similar as his other modular synthesizer modules. Hence the need for fitting the Raspberry Pi into a Eurorack synthesizer case.

Here you can see some photo’s from the construction of the front panel.

2015-11-14 15.32.52 2015-11-14 16.30.57

The front plate has holes for the various interface ports to interface with the Raspberry Pi. For a sturdy mount I glued a section of L-profile rails to the front plate.

2015-11-14 21.36.36

After mounting the Raspberry Pi, I connected the HDMI and audio port with a short cable to the front panel.


Here you can see the Raspberry Pi in the Eurorack case, next to the power supply.


Eurorack power supply

I am working on fitting a Raspberry Pi as a Eurorack module in the EEGSynth. A previous post shows the completed case. Besides the Raspberry Pi which needs 5V, it will also hold a CV/Gate controller and some other modules for interfacing between the digital and analog parts of the synthesizer. The operational amplifiers and some other ICs on those modules require a symmetric positive and negative rails.

As I am not planing any critical parts that require an very stable voltage (such as a VCO) in my enclosure, I decided not to go for an expensive linear power supply, but rather construct one myself on the basis of two 12V switching power supply that I salvaged from some old wall-warts that once served some external 3.5 inch USB hard disks. The AC-DC converters have the 220V side isolated from the 12V side. This allows to connect the positive DC rails of one to the negative DC rails of the other, resulting in +12V and -12V from either converter relative to the common ground.

The Raspberry Pi requires quite a bit of current compared to most synthesizer modules, hence converting the 12V into 5V with a voltage regulator such as the L7805 would not be very efficient. Therefore I also added a 5V 2A AC-DC converter.



For safety I made a small plexiglass enclosure using the laser cutter at the Techlab Nijmegen. All electronics, except for the connector, switch and three LEDs are completely enclosed behind the aluminum front panel.


The connector with the synthesizer modules consists of a flat cable, wired according to the A-100 system bus.

The LEDs show the status for each of the three voltage levels. Surprising is to see that it takes a good 10 seconds for the capacitors of the +12V and -12V to completely drain when switching the power off.

USB to CV/Gate converter: Schematics and Bill-of-Materials

This is a copy of my post on the EEGSynth homepage, the original can be found here.

To link the digital signal processing on a laptop or Raspberry Pi to the analog synthesizer, I have made two usb-to-cvgate converters. The first one I designed and implemented was a one channel version that is able to output up to (approximately) 5 Volt. The second one is an improved version with four channels that can be controlled from 0 to 10 Volt.

Using the EAGLE PCB design software, I have drawn the schematics which should allow others to copy them. Also included below is the bill of materials (BOM) with links to component vendors. I have mainly been shopping on Ebay, you can also get it elsewhere of course.

Details of the one-channel USB-to-CV/Gate converter.

2015-10-03 16.35.52
Details of the four-channel USB-to-CV/Gate converter.

2015-10-18 13.11.43

The Nike EEG headband

Together with Stephen Whitmarsh and friends I have embarked on the EEGSynth project, which aims to bridge science, technology and art by making an EEG-based synthesizer. The EEGSynth project relies on the realtime functionality in our FieldTrip toolbox, although it will probably also be linked to other software platforms.

I am lucky to have one of the first Jinga-Hi JAGA16 wireless EEG systems, which I think is the the smallest and most portable EEG system in existence at the moment. Although the primary application of that system is not for human EEG, it actually is perfectly suited for wireless BCI and neurofeedback applications as well. I am combining this system with standard (clinical and research) EEG cup electrodes. Using a glob of Ten20 electrode paste you can stick them to the scalp. Having some of these electrodes on my head and trying to connect this bunch of long wires to the tiny JAGA16 wireless EEG amplifier resulted in the question how to make a comfortable and robust system for electrode attachment.

I came up with the idea to use an elastic sports headband. This allows to attach the wireless amplifier to the head, and consequently the electrode wires would be channeled along the headband. Here you can see the components that I started with (minus the EEG amplifier):

2015-05-19 21.09.54

The headband is one that I picked up in a local sports shop. It consists of a sleeve of flexible fabric that  is relatively thin. At the placed where the fabric needed puncturing, I used some iron-on interfacing to strengthen it and prevent the holes from further tearing.

2015-05-19 21.51.46

This is the end result, which includes 8 electrodes for the EEG and 2 for the ground and reference.

2015-05-19 23.53.52

Soldering the electrode leads to the miniature connector was the hardest task. The 18 pin (arranged as 9×2) connector is only 12 mm wide, which means that for each pin there is only about 1.2 mm space.

Note that the PCB board with the yellow wrapping is actually  the full 16 channel wireless amplifier. It is powered by a (cell-phone type) LiPo battery, which is as large as the EEG system. Data is transmitted over Wifi and can be streamed and analysed in MATLAB or Python using  FieldTrip.

2015-05-19 23.54.20

Here I am, wearing the first prototype electrode headband. Two electrodes (ground and reference) go behind the ears, the other eight electrodes are approximately placed at F3, F4, C3, C4, P3, P4, FCz and CPz. The wifi EEG amplifier and the battery can conveniently be tucked away in the two flaps at the back.

2015-05-20 16.16.22

Monitoring the central heating with an Arduino and two DS18B20 sensors

This post is part of a series on Arduino-based energy and climate monitoring.

About 40% of our energy bill is spent on electricity and 60% on gas, which we use to heat our house and for hot water. Although we do have a relatively recent HR central heating installation, I don’t think that it has been tweaked for efficiency. After reading this post on optimising the yield of the central heating installation, I decided it would be worthwhile to try and acquire some data.


I wired up a Arduino pro mini (3.3V) with a RFM12b and a pair of DS18B20 temperature sensors to measure the temperature of the outgoing and returning water of our central heating system.


Power is provided by connecting a rechargeable 18650 LiPo battery to VCC on the programming header of the Arduino. This battery provides nominally 3.7V, which in my experience is close enough for the board to work fine. The whole module is mounted in a battery holder for two 18650 batteries.

Every 66 seconds a temperature reading of both sensors is performed and transmitted it to the central relay module. The central module forwards it to ThingSpeak to acquire a long-term log of the behaviour of our central heating system.

You can find the sketch for the Arduino here.