Code Blog

Displaying 1-2 of 2 results.
2016/09/25 Raspberry-Pi

The new Raspberry Pi 3

As I wrote in a previous post my Raspberry Pi 2 stopped working. So I ordered a new one, but this time the newer Raspberry Pi 3 model. I posted some photos below of the new board and comparing it with Raspberry Pi 2. One new feature is that Raspberry Pi 3 comes with wifi and bluetooth built-in. The Raspberry Pi 3 has a 1.2 GHz quad-core 64-bits CPU compared with Pi 2's 900 MHz quad-core 32-bits CPU. The GPU is also faster for the Raspberry Pi 3 (400 MHz compared to 250 MHz). Both have 1 GB RAM. Overall the Pi 3 is quite a bit faster than its previous model.

Photos of the Raspberry Pi 2 Model B (bottom) and my new Raspberry Pi 3 Model B (top). As can be seen from the photo the form factor is exactly the same between rpi2 and rpi3, so the old case can be reused if needed.

I didn't know before buying the new Pi 3 but it seems that Raspberry Pi 3 is known for running even hotter than Raspberry Pi 2 (makes sense with higher clock speeds). So I will need to take some precaution to not let it run too hot this time.

I made a surprising discovery when taking the rpi2 out of it's case: The heat sink had moved off the CPU! Maybe it had came loose when falling down some time? This for sure didn't help it stay cool .. Maybe this is an issue with really really cheap heat sinks from China ..

So I got some new (cheap) heat sinks for the Raspberry Pi 3.

Installed the heat sinks on the new board


I got a new SD-card and reinstalled Volumio. There are a lot of good articles online describing how to set up Volumio, for example 

Quick breakdown of what Volumio is:

Volumio = Raspbian + Media Player Daemon (MPD) + samba web server + support for a large list of USB digital audio codecs (DACs)

Where Raspbian is a Debian-based OS for the Raspberry Pi. Raspbian is now official provided by the Raspberry Pi Foundation as the primary OS for the Raspberry Pi.

Downloaded a new version of Volumio from 

Version: 0.979 (Release date 20-08-2016) - 286 MB

The version numbers are a bit confusing to say the least. I had Volumio version 1.55 installed on my Raspberry Pi 2 before. It doesn't really say so on their website but this version that I've downloaded is version 0.979 of "Volumio 2". So "Volumio" and "Volumio 2" is not the same thing. I think it would have been more logical and a lot less confusing to call it version 1.979 instead.

The Volumio website has step-by-step user instructions for installing it. Its all very easy, just download the image file and write it to the SD card. Then insert the SD into Raspberry Pi board and boot it up. Volumio recommends using to write the SD card. I had PiWriter installed since before but it doesn't seem to work that well with Mac OS X El Capitan so I'll use etcher instead.

To connect to volumio type volumio.local in web browser (on same physical network) and you get a UI for controlling the music. I have an iOS app installed on my phone called MPoD that can connect to volumio so I usually use that to control the music.

For the parts from my old Raspberry Pi 2 it turns out both the SD card was corrupt and worse - the audio I2S card was broken too. So the I2S card needs to be replaced as well. I have to test the Raspberry 2 Pi board later, maybe its still ok with a new SD card. 

I2S is a communication protocol specifically designed for digital audio data. From Wikipedia:

I2S, also known as Inter-IC Sound, Integrated Interchip Sound, or IIS, is an electrical serial bus interface standard used for connecting digital audio devices together. It is used to communicate PCM audio data between integrated circuits in an electronic device. The I2S bus separates clock and serial data signals, resulting in a lower jitter than is typical of communications systems that recover the clock from the data stream.

I2S is used in for example CD players, connecting the reading mechanism to the DAC and/or the S\PDIF output. I2S is also used on every standalone DAC.

There's a good article about advantages for using a I2S card at As my I2S card was broken I tried to connect speakers directly to the built-in stereo plug of the Raspberry Pi but the sound volume was extremely low, so couldn't really use that at all.

ssh volumio.local
username: volumio password: volumio
sudo nano /etc/modules
uname -a
Linux volumio 4.4.9-v7+ #884 SMP Fri May 6 17:28:59 BST 2016 armv7l GNU/Linux

System update

It is a good idea to run upgrade your system after initial setup using the following commands:

sudo apt-get update
sudo apt-get -y upgrade

This will update components of the Rasbian OS even if you have picked up the latest release of volumio. The "-y" flag means answer automatic yes for all prompts when installing the detected updates.

Backup SD card

Its recommended to make a backup of the SD card once the Pi is finished configuring. This will save you a lot of time if your image gets corrupt (tends to happen with the Pi). Remove the SD card from the device and connect it to your PC. Use the Win32DiskImager tool to create a backup. Use the read option to create an image from the SD card.




2016/07/31 Raspberry-Pi

Had been thinking about how to stream music at home in a convenient way, the Sonos products look quite nice, but also quite expensive. Started to look for alternatives and found out this can be done on a Raspberry Pi board. This also has the advantage I can keep using my old speaker. Seemed like a fun project so I went ahead and bought the following:

  • HIFI DAC+ sound card I2S interface (for Raspberry Pi B+/2B )
  • Raspberry Pi 2 model B (900 MHz quad-core ARM CPU, 1GB RAM) (it replaced Raspberry Pi 1 Model B+ in February 2015)
  • Power adapter (Mitsumi, 5.0V 1.8A) with USB cable
  • Black plastic box for fitting the HIFI DAC board
  • Heat sinks for the Raspberry board (for CPU and GPU)

I put the Volumio OS ( on the microSD card. Volumio is built on Linux and is open-source/free software. Another alternative is using RuneAudio. At the time I installed it I choose Volumio for better support of the hardware (I2S DAC support). Volumio is developed from RaspyFi but is supporting more embedded platforms than RaspFi did (UDOO, CuBox and Beaglebone Black and Raspberry PI).

Raspberry Pi also can do audio output via USB, but for good reliable sound output using a DAC connected to the internal I2S bus (a specialized chip-to-chip audio bus available on the board) is much better.

Volumio supports AirPlay and it can also be remotely controlled via MPoD iOS app to play locally stored music (I connect a USB-stick with music to the Raspberry Pi).

I have been running it 24/7 from Nov 2015 to July 2016, and it has been working without any problems all this time, but it just died at the end of July. Wonder if it got overheated in the Shanghai summer heat ..

Debugging steps:

  • Check incoming voltage on micro-usb
  • Change SD card (seems SD card can easily become damaged during power breaks etc)

So I will probably upgrade to Raspberry 3 now. The I2S DAC board is compatible with Raspberry Pi 3. One good thing is that Raspberry 3 looks the same as Raspbery 2 so the same case can still be used. Raspberry 3 comes with Wifi and bluetooth builtin which Raspberry 2 lacked.

Below is a script to monitor CPU and GPU temperatures on the Raspberry Pi Linux OS. Might be good to improve this and send an email or other warning if the temperature gets too high. I think I should also fit a small fan for active cooling the next time.

cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp) 
cpuTempM=$(($cpuTemp2 % $cpuTemp1)) 
gpuTemp0=$(/opt/vc/bin/vcgencmd measure_temp) 
echo CPU Temp: $cpuTemp1"."$cpuTempM"ºC" 
echo GPU Temp: $gpuTemp0

The output comes out as following:

$ ./temp 
CPU Temp: 56.2ºC 
GPU Temp: 56.2ºC 

(Script from