Raspberry PI 2 B hands-on

The new Raspberry PI 2 Model B 1GB specs:

  • QUAD Core Broadcom BCM2836 CPU with 1GB RAM
  • 40pin extended GPIO
  • Micro SD slot
  • Multiple Ports: 4 USB ports, Full Size HDMI, 4 pole Stereo output and Composite video port, CSI camera port & DSI display port
  • Micro USB power source

Today (5.2.2015) the new model Raspberry PI 2 B 1GB arrived and I would like to share my first hands-on experience. In the package purchased at pollin.de for € 38,90 incl. VAT. Included is a quick-guide with references to the element14 website for OS download.

I attached the portapow USB current/voltage meter to measure the used current. From raspberrypi.org tried out the snappy-ubuntu core alpha-02. It booted into a shell without system information during the boot-up. Login with ubuntu/ubuntu. startx didn’t work here. Having a powerful fanless ubuntu system was the intention to get the new raspi model in the first place.

The current was between 0.2 and 0.4 amps – of course without a graphical interface. A USB source with at least 0.6 amps is highly recommended in the specs – you better take one with 2 amps to provide enough current for peripherals.

I wanted to try out a graphical OS and so prepared my 16GB micro SDHC-card with the NOOBS package (Version: 1.3.12 Release date: 2015-02-02). Snappy-Ubuntu isn’t included here, and the offered openELEC is the old 4.x version.

The raspbian (kernel 3.18.5-v7+) still includes a free Mathematica. I was curious what it is capable to perform on the new engine, but according to the cpu-load graph it just runs on one v7 core. Check it out yourself with this nice 3D plot:

Glow[RGBColor[1, 0, 0]],
EdgeForm[White], Lighting ->
None, PolyhedronData["Echidnahedron", "Faces"]}]

The raspi-config tool offers overclocking up-to 1000MHz. Raspbian Openbox is initially running with a resolution of 1776×952 pixels on my FullHD screen leaving a big black bezel. I hope to be able to change it soon.


The new model runs with low power consumption. Distributions aren’t yet ready to utilize the QUAD core ARMv7.
I am a little disappointed that there is still the useless DSI display port (no available devices so far). There’s still the fragile Micro USB power-in and no reset button. And you can barely find Linux distributions for 2GB SD cards.

If you want to tinker with sensors and LCD-Displays, motors and RGB-LEDs you should give the new model a chance. It is still at least as good as the previous Model B+

For those who like a low power consuming graphical linux system with reasonable power, I suggest the odroid U3 from hardkernel.com with

  • SAMSUNG Exynos4412 Prime Cortex-A9 Quad Core 1,7 Ghz
  • 2GB DDR2 880
  • Mali-400 Quad Core 440 MHz for up-to 1080p
  • 3 USB ports and ethernet
  • optional eMMC flash drive (8 times faster than micro sdhc)
  • Linux Xubuntu or Android 4.x

It also runs a very smooth XBMC in 1080p

Conways Game of Life in a 8×8 LED Matrix

So, I wrote some python functions and brought them together in the “Game of Life”-Animation running on the small SPI-interfaced 8 by 8 LED matrix with max7219 controler. My set of python functions can easily be used to create further funny code.
The basic libraries were already written Richard Hull and reused.

Have fun.

#!/usr/bin/env python

import max7219.led as led
import max7219.canvas as canvas
# import max7219.transitions as transitions
import time
from random import randrange

initgol = [0, 0b100, 0b100, 0b110, 0, 0b01110011, 0b00010101, 0b110]

def buf2mat(buffer):
    matrix = [[0 for i in range(8)] for j in range(len(buffer))]
    for col in range(len(buffer)): 
        for row in range(8):
            matrix[col][row] = buffer[col] & pow(2, row) # bitwise eval
    return matrix

def mat2buf(matrix):
    buffer = [0 for i in range(len(matrix))] 
    for col in range(len(matrix)):
        for row in range(len(matrix[col])):
            buffer[col] = buffer[col] | (pow(2, row) * matrix[col][row])
    return buffer

def countneighbors(matrix, wrap):
    neighbors = [[0 for i in range(len(matrix[0]))] for j in range(len(matrix))]
    for col in range(len(matrix)):
    for row in range(len(matrix[col])):
        for c, r in [[-1, -1], [0, -1], [1, -1], [-1, 0], [1, 0], [-1, 1], [0, 1], [1, 1]]:
            if wrap:
                neighbors[col][row] += matrix[(col + c) % len(matrix)][(row + r) % len(matrix[col])]
            if not wrap:
                if not ( (col + c) < 0 or (row + r) < 0 or (col + c) >= len(matrix) or (row + r) >= len(matrix[col]) ):
                neighbors[col][row] += matrix[col + c][row + r]
    return neighbors

def randbit(probability):
    if randrange(100) < probability:
        return 1
        return 0

def randmatrix(probability, rows, cols):
    matrix = [[0 for i in range(rows)] for j in range(cols)]
    for col in range(cols):
        for row in range(rows):
            matrix[col][row] = randbit(probability)
    return matrix

def golrules(matrix):
    neighbors = countneighbors(matrix, 0)
    nextgen = [[0 for i in range(len(matrix[0]))] for j in range(len(matrix))]

    for col in range(len(matrix)):
        for row in range(len(matrix[0])):
            if matrix[col][row] == 0:
                if neighbors[col][row] == 3:
                    nextgen[col][row] = 1
                    nextgen[col][row] = 0
            elif matrix[col][row] == 1:
                                if neighbors[col][row] < 2:
                                        nextgen[col][row] = 0
                                elif neighbors[col][row] > 3:
                                        nextgen[col][row] = 0
                    nextgen[col][row] = 1
        return nextgen

def text2buf(text):
    buffer = []
    for i in range(len(text)):
        if text[i].upper() in font5x3:
            buffer = buffer + font5x3[text[i].upper()]
        buffer = buffer + [0]
    return buffer

def drawbuf(buf, up, left):
    buffer = [0,0,0,0,0,0,0,0]
    for i in range(8):
        buffer[i] = buf[(i + left) % len(buf)] >> abs(up)
    canvas.gfxbuf = buffer
    return buffer

horz = 0
vert = 0
speed = 4
i = 0

while True: 
    m = randmatrix(20, 8, 8)
    for cycle in range(15):
        drawbuf(mat2buf(m), 0, 0)
        time.sleep( 1.0 / speed )
        m = golrules(m)

spidev is broken

Since the today’s Raspbian upudate, the spi interface not working anymore.

uname -a
Linux raspberrypi1 3.18.5+ #746 PREEMPT Mon Feb 2 13:57:16 GMT 2015 armv6l GNU/Linux

All commands below and numberous rebooting show, that the support for spi is simply voided.

dmesg | grep spi
ls -l /dev/spi*
ls /sys/bus/spi/devices
insmod spi
modprobe spidev
modinfo spidev

I also took care of the blacklist

sudo nano /etc/modprobe.d/raspi-blacklist.conf

nothing worked out so far 😦

I may have found an official explaination for the SPI problems…

All that’s to be done is adding the following lines into /boot/config.txt as super user


An easy approach to solve the issue with 1-wire sensors DS18B20 etc. is described here .

You just add the following line at the end of file /boot/config.txt to use PIN 7 (GPIO=4) as w1-DATA

# 1wire bus for DS18B20

reboot and check your result with

ls /sys/bus/w1/devices/
cat /sys/devices/w1_bus_master1/28*/w1_slave | grep t=

if you have an installed 1-wire sensor, such as the DS18B20