Category Archives: Raspberry Pi

Getting started with Pine64

UPDATE: see at the end for some problems that I encountered after the initial install.

The Pine64 is a single board computer that resembles the Raspberry Pi, but with a 64-bit CPU, up to 2GB of RAM and available for $15-$29. It was introduced with a Kickstarter campaign which I supported. My 2GB Pine64 has been lying on a shelf for quite some time, as I was waiting for the kernel, distribution and documentation to mature.

My first installation yesterday went fine (some slight troubles to get WiFi connected), but while updating the kernel, the root disk partition completely filled up and borked the installation. Hence I have to start again. Let me now document it, as I might need to repeat the installation more than a second time.

I primarily followed the instructions from with some additional information from I am working off an Apple MacBook Pro computer.

After downloading the Debian Base disk image, I used 7z to unzip it:

mbp> brew install p7zip
mbp> 7z x pine64-image-debianbase-310102bsp-2.img.xz

I inserted an empty Samsung 16 GB EVO UHS-I Class 10 micro SD card and followed up with:

mbp> diskutil unmountDisk /dev/disk1
mbp> sudo dd if=pine64-image-debianbase-310102bsp-2.img of=/dev/disk1 bs=1024k

and I unmounted it again:

mbp> diskutil unmountDisk /dev/disk1

In order to configure the WiFi connection of the Pine64, I connected it to a keyboard and to my LCD TV screen and powered it up with a 5V 2A micro USB power supply. I noticed that the HDMI connection is a bit flakey, the TV repeatedly reports “no connection”; wiggling the HDMI connector brought the boot sequence back on screen. I also connected the wired ethernet connection, which – without configuration changes- obtained an IP address using DHCP from my router.

I added the following to /etc/network/interfaces

auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface wlan1 inet manual

and the following to /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

which I read-protected with

root@pine64# chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf

Then I restarted the wifi network

ifdown wlan0
ifup wlan0

and checked for the network:

root@pine64:~# ifconfig 
eth0      Link encap:Ethernet  HWaddr 36:c9:e3:f1:b8:05  
          inet addr:  Bcast:  Mask:
          inet6 addr: fdeb:a2d5:862:0:34c9:e3ff:fef1:b805/64 Scope:Global
          inet6 addr: fe80::34c9:e3ff:fef1:b805/64 Scope:Link
          RX packets:2607 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1127 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:200040 (195.3 KiB)  TX bytes:236261 (230.7 KiB)

lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 34:c3:d2:71:90:16  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::36c3:d2ff:fe71:9016/64 Scope:Link
          inet6 addr: fdeb:a2d5:862:0:36c3:d2ff:fe71:9016/64 Scope:Global
          RX packets:505 errors:0 dropped:1 overruns:0 frame:0
          TX packets:12 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:99440 (97.1 KiB)  TX bytes:1969 (1.9 KiB)

As I ran into disk space problems yesterday – perhaps because I had done apt-get update && apt-get upgrade – I ran the update commands as follows:

followed by


and finally

apt-get update
apt-get upgrade
timedatectl set-timezone Europe/Amsterdam

UPDATE (11 Feb 2017): My Pine64 board turns out to be quite unstable. Depending on how I plug in the HDMI cable, I get an image on my screen or not. Wiggling the HDMI connector sometimes helps, sometimes not.  Furthermore (and more serious, since I wanted to use it as headless server), if there is some serious network traffic, it crashes. Not once, but quite consistently. I read elsewhere that the build quality of the Pine64 is not very good. It might also be that the problem is in powering the board: I am using a 2A power adapter (which works fine on all my Raspberry Pi’s).

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…