petRockBlog Fun stuff for technics enthusiasts Sun, 21 May 2017 20:15:54 +0000 en-US hourly 1 Quick Installation Script for the ControlBlock Sun, 21 May 2017 20:12:06 +0000 We realized that the installation of the ControlBlock driver could be simplified. Therefore, we created an installation script that does all the needed steps for compiling, installing the binary, and configuring the ControlBlock service for you!

To install the driver and service for the ControlBlock, this is now all that ou have to do:

git clone git://
cd ControlBlockService2
sudo ./

Also, there is a Youtube video that shows you a typical run of that quick installation script:

You can also find all these information in the README within the ControlBlock repository.

We hope you find that helpful and wish you good luck with your project!

]]> 0
Update for the ControlBlock Driver Sun, 19 Feb 2017 15:02:19 +0000 ControlBlock Update

The driver of the ControlBlock got updated! What does this mean for you? More functionalities!

More specifically, the updates contain:

  1. 4-player support
    Multiple ControlBlocks can be stacked on top of each other. With this functionality you can now create your 4-player arcade machine with two ControlBlocks. Each ControlBlock can be configured with its own controller type. That means for example that you could provide two full sets of arcade controllers and two, say, SNES controllers – you can choose!

  2. Genesis/Megadrive controller support
    The driver now support Genesis / Megadrive controllers. Both types, the three as well as the six button controllers, are supported. To use Genesis controllers with the ControlBlock simply set “genesis” as gamepad type in the driver config file.
    Sega Genesis / Megadrive (TM) Controllers are now supported by the ControlBlock

  3. Custom shutdown script
    We got several requests from users who want to execute their own scripts when the power switch is switched to “off”. The whole shutdown actions are now defined in the file /etc/ You can add anything you want to be executed on switch off to that script now.

  4. Reset button for SNES gamepad mode
    SNES mode now also provides a reset button functionality. If you want to build your personal retro-gaming machine within a SNES or NES case you can now also connect the reset button to the ControlBlock. The reset button is mapped to the ESC key, which in turn exits for example a running emulator.
    ControlBlock Connected with Nintendo SNES (TM) Reset Button

All configuration settings and detailed information about the other functions are described at the Github site of the driver.

Besides updates of the ControlBlock driver there are now driver modules for the ControlBlock (and the PowerBlock as well) in RetroPie. That makes it even easier for you to install the PowerBlock or ControlBlock driver for your RetroPie project. You find the drivers in the RetroPie-Setup menu at “Manage packages” –> “Manage driver packages” –> “controlblock”. From there, you can easily install or remove the driver from within the RetroPie Setup.

We hope you enjoy these new features!

If you are missing any functionality or support for different controllers feel free to comment below.

]]> 7
New Revision of the PowerBlock: Increased Flexibility Fri, 20 May 2016 20:15:15 +0000 The PowerBlock is a small support shield for the Raspberry Pi that provides a power switch functionality. Recently, we have updated the design of the PowerBlock such that it now offers an even greater flexibility regarding the connections with the Raspberry Pi.

Here is an image of the new PowerBlock Revision 1.1:


Besides some fine tunings in the board layout, these are the major differences to the previous revision of the PowerBlock:

Additional signal breakouts so that input voltage, output voltage, and control signals
All the signal above can now be attached to the Raspberry Pi without using the 2×6 pin connector. As you can see on the image below, there are individual pin outs for the 5V input voltage, the 5V output voltage, as well as for the control signals S1, and S2.


The pin out is as following:

5V IN, +,-: supply voltage
S1: pin 12
S2: pin 11
5V OUT +: pin 2 or pin 4
5V OUT -: pin 6 or pin 9

Additional mounting hole for attaching a Raspberry Pi Zero
This addition makes it possible to not only mount the PowerBlock to the Raspberry Pi model A and B, but also to the Raspberry Pi Zero. Here are some exemplary images for the various models:

RPi Model A RPi Model B RPi Zero
IMG_2912  IMG_2911  IMG_2909 

Together with a toggle switch the PowerBlock provides a reliable and safe power switch functionality for the Raspberry Pi. An optional LED can also be attached to the PowerBlock that serves as a power status indicator.


You can find more details and a comprehensive installation and configuration description on the description site of the PowerBlock.

]]> 46
Python module for MCP23S17 for use with the Raspberry Pi Sun, 15 May 2016 13:50:14 +0000 IMG_2906_FotorSome time ago I revised the hardware design of the ControlBlock and added test points for all major signals. The overall aim was to build a device for doing final system tests that are done before any single ControlBlock leaves for shipping. These system tests are written in Python. This post is about a Python module for the MCP23S17 to be used on a Raspbbery Pi.

Basically, the tests set various input signal lines to logical high and low values in a specific order and test if certain output signals have the correct level. To do this, another manually tested ControlBlock is used. Since revision 2.X the ControlBlock uses MCP23S17 GPIO expanders to provide 32 input/output lines for arbitrary usage. I did not find any Python abstraction that would allow me to easily access the MCP23S17 from a Raspberry Pi, so I decided to write a Python module myself.

The result is a publicly available Python module, available via PyPI, that you can install with pip.

Installing the Module

If not already done, you need to install PIP via::

sudo apt-get install python-dev python-pip

Then you can install the module from PyPI via

pip install RPiMCP23S17

That’s it!

Interface of the Module

So, how do you use the module. How does its interface look like? Here is a list of the public methods of the module together with brief descriptions:

  • Constructor – Initializes an instance given the SPI bus number, the chip-enable (CE) number, and the device ID of the MCP23S17 component.
  • open – Opens the configured SPI-bus with hardware-address access and sequential operations mode.
  • close – Closes the SPI connection that the MCP23S17 component is using.
  • setPullupMode – Enables or disables the pull-up mode for a given input pin.
  • setDirection – Sets the direction for a given pin.
  • digitalRead – Reads the level of a given pin.
  • digitalWrite – Sets the level of a given pin.
  • writeGPIO – Sets the 16-bit data port value for all pins.
  • readGPIO – Reads the 16-bit data port value of all pins.

You can find a detailed documentation in the Python docstrings of the module.

Exemplary Usage

Here is some demo code that also comes with the module sources. The demo periodically toggles all pins of two MCP23S17 expanders:

mcp1 = MCP23S17(deviceID=0x00)
mcp2 = MCP23S17(deviceID=0x01)

for x in range(0, 16):
    mcp1.setDirection(x, mcp1.DIR_OUTPUT)
    mcp2.setDirection(x, mcp1.DIR_OUTPUT)

while (True):
    for x in range(0, 16):
        mcp1.digitalWrite(x, MCP23S17.LEVEL_HIGH)
        mcp2.digitalWrite(x, MCP23S17.LEVEL_HIGH)

    for x in range(0, 16):
        mcp1.digitalWrite(x, MCP23S17.LEVEL_LOW)
        mcp2.digitalWrite(x, MCP23S17.LEVEL_LOW)

So, if you are tinkering with MCP23S17 components and Python on a Raspberry Pi, you might find this module to be helpful for you.

You can find the module on PyPi here.

By the way, here is an image of the testing station for the ControlBlocks, which we are using to do the final system tests before shipping:

System Test Station for the ControlBlock using the MCP23S17 and test scripts written in Python
]]> 2
RetroPie 3.6 is Released Wed, 02 Mar 2016 06:29:40 +0000 Pixel-ArtRetroPie on Raspberry Pi 3? Get RetroPie 3.6!

This version is released a little earlier than originally planned, due to the release of the fantastic Raspberry Pi 3 – which our previous 3.5 will not boot on due to having out of date firmware. Along with Raspberry Pi 3 compatibility this release brings a bunch of interesting experimental emulators such as Daphne for emulation of classic LaserDisc arcade games, a myriad of libretro cores, and a few game engines. We’ve also worked around the pesky insert coin bug that has plagued the arcade emulators.

You can find the links for the SD-card images as usual in the Downloads Sections.
Installation Instructions can be found at Github:

Changes since 3.5:

Added Support for the Raspberry Pi 3

  • Added new experimental modules:
    • Daphne (Laserdisc Emulator)
    • Libretro-QuickNES
    • Libretro-Beetle PSX (x86 only)
    • Libretro-Beetle Lynx
    • GemRB engine (Baldur’s Gate, Icewind Dale, Planescape)
    • ResidualVM (Engine for Grim Fandango and Escape from Monkey Island)
    • Libretro-MESS (based on the most recent version of MAME)
    • Libretro-MAME (based on the most recent version of MAME)
  • Added EmulationStation theme Simpler Turtle Pi to the theme installer from Omnija.
  • Added version details and uninstall option to the RetroPie Setup Script.
  • Fixed insert coin not working on arcade based emulators.
  • Various other bugfixes and improvements.
]]> 47
RetroPie 3.5 is Released Sat, 06 Feb 2016 16:00:30 +0000 Pixel-ArtWe are pleased to announce the release of RetroPie 3.5.

After taking into consideration the feedback from the vibrant RetroPie community, we have provided a few more functions to simplify the user experience such as automatic expansion of the filesystem on boot, less terminal text, and more configuration options for the runcommand launch menu. We have also fixed up some bugs with Raspbian Jessie such as the USB ROM service and have added two new experimental modules – the Löve game engine and a ColecoVision emulator (CoolCV).

You can find the links for the SD-card images as usual in the Downloads Sections.
Installation Instructions can be found at Github:

Changes since 3.4:

  • Added new experimental modules, Lӧve 2D Game Engine, Colecovision (CoolCV).
  • Debian usbmount package fixed up for systemd udev compatibility, making the USB ROM service work properly again without being killed after 30 seconds. Also added ntfs support by default.
  • Added an arcade rom folder option where all arcade games can be placed.
  • Improvements to EmulationStation (Fix crash on rom delete, direct launch, symlink support, and other bug fixes).
  • Improvements to the Runcommand Launch Menu: Cleaner dialog on launch, ability to show game artwork on launch, ability to disable joystick support as well as the ability to disable the entire runcommand launch menu.
  • PS3 Controller improvements – Add multiple gasia and shanwan controller support.
  • Updated lr-mgba emulator binaries (new upstream release of mgba 0.4.0)
  • Improvements on pre-built image – disabled screen blanking, quieter boot, and filesystem automatically expanded on first boot.
  • Various other bug fixes.
]]> 25
RetroPie 3.4 is Released Thu, 21 Jan 2016 20:36:25 +0000 Mostly fixes and improvements rather than new stuff this time folks.

There were some problems with our RetroArch configuration defaults in RetroPie 3.3 which should be sorted now, and we have fixed up a few things that didn’t work correctly with Raspbian Jessie. We also have added early support for using the RetroPie-Setup script on a X86/X11 desktop setup, as well as some basic support for building EmulationStation & RetroArch + cores on the ODroid-C1. For more information regarding installation on x86 see

We are now using Raspbian Jessie as the base for the RetroPie image. Those using Wheezy can update RetroPie-Setup and emulators by following the instructions at – however moving to Jessie is recommended. As it takes time to pre-build binaries, in the future we will only be providing pre-built binaries for Raspbian Jessie.

You can find the links for the SD-card images as usual in the Downloads Sections.
Installation Instructions can be found at Github:

Changes since 3.3

  • Now using Raspbian Jessie for the RetroPie image.
  • Fixes for controller input issues with RetroArch including improved config generation to work around problems with 8bitdo controllers.
  • Fixed up Bluetooth pairing module on Jessie.
  • Improvements to the Xbox userspace driver (xboxdrv) including partial support of Xbox One controller.
  • Can now choose to exit or restart Emulation Station. Metadata will no longer be lost if choosing to shutdown or reboot.
  • Preliminary support for using the RetroPie-Setup script on x86 + X11 on Debian/Ubuntu and Ubuntu on the Odroid-C1 (building from source only).
  • $HOME/.emulationstation has relocated to /opt/retropie/configs/all/emulationstation – but is symlinked from the original location. The USB Rom Service script will backup all of /opt/retropie/configs to USB. Previously it only backed up /$HOME/.emulationstation.
  • Support for choosing RetroArch shaders and overlays from the RetroPie-Setup configuration editor.
  • Added pixel theme from Rookervik to theme installer.
  • Wonderswan and NeoGeo Pocket separated into Wonderswan/Wonderswan Colour, NeoGeo Pocket/NeoGeo Pocket Colour.
  • Various other bugfixes and improvements.
]]> 3
MEAN adventures continued: An UML Online Editor for PlantUML Wed, 23 Dec 2015 09:56:06 +0000 Some weeks ago I wrote about my recent journeys into the world of web application development and the MEAN stack. While writing that blog post I realized that I would like to insert a certain UML diagram. So I first started to draw an UML diagram for a better explanation of the use cases that my learning project should implement. I did that with a tool that was locally installed on my machine and things did not work out as fast as I expected. I started to think about an alternative … the resulting UML editor and sharing platform can be found at


I realized that I did not really want to install a specific UML editor on my machine or spend too much time to look for another UML service. Instead, I would like to use an online UML editor that would let me edit, manage, and share the UML diagrams for my articles. Of course, there already exist other online UML editors, but I did not exactly find what I was looking for and I also liked the idea to implement something like that myself — what a great opportunity to continue my experiments with the MEAN stack and, specifically, getting to know user management concepts with Angular.js and Node.js! So, I decided to create the UML editor as an addition to the tool site that I wrote about some weeks ago.

So, here it is: An online UML editor based on PlantUML. What is PlantUML? PlantUML is an application-specific language for describing UML diagrams. It allows you to create UML diagrams just by describing it in text form. It is well-formed and human-readable. I like the idea of a textual UML diagram representation, because it the user to describe exactly those elements and only those elements that are important and the user does not have to care for the layout or arrangement of the elements in the first place.


So, what does the UML editor do? The following figure gives an overview about the use cases of the editor. It is actually a use-case diagram that was created and is hosted with the presented UML editor:

The platform offers the functionalities

  • (of course) to edit UML diagrams with the help of PlantUML syntax,
  • to generate the diagram images in various file formats,
  • to embed and share diagrams with other users or websites,
  • to load PlantUML templates for different types of UML diagrams.

Further more, I have added functionalities for managing user accounts and documents that can be associated to individual users.

A more detailed (and slightly overloaded) version of the overview about the use-cases is given in the following diagram. That diagram was the used for guiding the work on this editor:

Use cases, more detailed

The editing view is split into two parts: The left side contains the editor, and diagram configurations. The right part shows the actual diagram:

Editing view

One feature that turned out to be very helpful is an auto-update function: If the textual diagram description has changed the diagram preview is updated automatically. This allows for a seamless work flow when editing a diagram.

In order to use the document management functions, you need to sign up a free user account,

User profile view

The document management functions are located within a sidebar,

UML document management in the sidebar

Also, the platform at is intended to be used for hosting the diagram image files. This makes sharing and embedding the diagrams into other websites easy. The diagrams that are shown in this article are already created and hosted with In order to embed a diagram you simply copy the link of the image format of your choice,

The sharing view

and insert the URL into your website, for example, via an image HTML tag

<img src="" alt="An exemplary diagram" />;

or via Markdown as

![An exemplary diagram](

Behind the Curtains: Some of the used Javascript Libraries

For those of you that are interested in some technical details, here are some Javascript libraries that I used for the implementation of the functionalities:


An Angular.js library for non-blocking visual notifications or toasts. It has a simple API, for example:

app.controller('foo', function($scope, toastr) {
    toastr.success('Hello world!', 'Toastr fun!');

yields this notification toast:


This library provides functions for handling JSON web tokes. A well-written tutorial about it can be found here. JWTs are used for user authentication on the server-side of Some exemplary code for generating a JSON Web Token might look like this:

function createJWT(user) {
    var payload = {
        sub: user._id,
        iat: moment().unix(),
        exp: moment().add(14, 'days').unix()
    return jwt.encode(payload, config.TOKEN_SECRET);


The library moment.js provides functions for parsing, validating, manipulating, and displaying dates in Javascript. An exemplary date manipulation looks like this:

var today = moment().startOf('day')
var aMonthAgo = moment(today).subtract(30, 'days')


The Winston library is designed to be a simple and universal logging library for Node.js. IT allows the configuration of multiple storage devices for the logs, for example, the console, files, or a database.


Gulp is not a Node.js library for direct inclusion into your application, but a task automation framework. I use it for linting the Javascript files, as well as for minifying the Javascript and HTML files.

Summary and Conclusions

In this project I implemented an online UML editor platform that allows to edit, collaborate and share UML diagrams. The platform makes use of PlantUML. This small project taught me how to do user management with Angular.js and Node.js. The UML service is available at Looking back, I realize how easy it was to add the PlantUML compiler to the Node.js server. Having implemented all the mentioned functionalities I can say that I enjoy creating and embedding diagrams with that platform now. I have ideas for optimization here and there, but the site is already working quite well.

]]> 0
RetroPie 3.3 Released Tue, 22 Dec 2015 10:42:51 +0000 After rolling new images, fixing bugs, re-rolling we are finally there: RetroPie 3.3.

Major features of this release include

  • Mupen64plus and Reicast controller configuration added to the EmulationStataion controller config setup.
  • Playstation Portable emulator ppsspp included by default now.
  • New exprimental module for OpenTTD
  • Jessie images as BETA releases.

And many smaller bug fixes and improvements. You can see details in the change log below. The Jessie images are to be considered BETA as there may be bugs in configuration modules or emulators that are not present on the Wheezy version.

We plan to move to Jessie only with the next release so that we can concentrate on maintaining only four instead of eight images. Everyone is invited to give feedback if you experience problems with your RetroPie Jessie setup.

Thanks to everyone who has contributed to this release!

You can find the SD-card images in the Downloads Sections.
Installation Instructions can be found at Github:

Change Log RetroPie 3.3

  • Mupen64plus controller configs (including hotkeys) and Reicast (Dreamcast) controller configs added to the autoconfiguration script in emulationstation. Mupen64plus is now the default n64 emulator due to compatibility.
  • AdvanceMAME 1.4 (replaces 1.2 – still based on MAME 0.106).
  • PlayStation Portable emulator ppsspp is included by default (libretro version is default, the standalone version is optional).
  • Removed cpc4rpi emulator, and added CapriceRPI which has many improvements over cpc4rpi.
  • Updated libretro binaries including lr-fba-next updated to v0.2.97.37, and an improved lr-caprice32 which is now moved out of experimental and is the default Amstrad CPC emulator.
  • Updates to Reicast emulator, which has been moved out of experimental.
  • New experimental modules: OpenTTD (open source simulation game based on Transport Tycoon Deluxe), Wolf4SDL (Port of Wolfenstein 3d), Zdoom (Enhanced Port of the official DOOM source)
  • PS3 controller improvements (added Gasia PS3 clone Support).
  • Updated OpenMSX emulator (to the dev version 0.12.0+).
  • Beta images based on Raspbian Jessie are included. They may have bugs that are not present in the Raspbian Wheezy release.
  • New themes added to the theme installer (Eudora from AmadhiX, Tronkyfran from Tronkyfran, and Retroplay Canela from InsecureSpike).
  • RetroArch joy-config tool removed (custom configs are now done through the RGUI or manually).
  • Various other bugfixes/improvements.
]]> 22
Supply Status of the ControlBlock Mon, 14 Dec 2015 07:06:34 +0000 This info post is interesting for you, if you were looking at the ControlBlock and wondering when it will be available again.

UPDATE 01/23/2016: A new batch of ControlBlock has arrived and is now available.
UPDATE 01/23/2016: All pre-ordered ControlBlock are shipped.
UPDATE 01/13/2016: Reworking the ControlBlock is in progress. Every unit that successfully went through rework and quality check is shipped a day later.

These are information from 12/14/2015. The production of a new batch of ControlBlocks was ordered about two months ago and they were expected to be delivered at the beginning of December. In the meantime the ControlBlocks arrived (good), but we realized that one of the components was not the correct one (bad). The wrong component affects the core functionality of the ControlBlock – to attach controllers – and makes it unusable. I do not want to repeat the words that followed right after finding that out here, but I was not amused to say the least. So, what now?

First of all, a new batch with the corrected component is already ordered. When that order arrives the supply of ControlBlocks will not be short anymore. Also, luckily, the existing ControlBlocks with the wrong component can be reworked – the wrong component can be replaced with the correct one. However, that takes some time and we still have to evaluate how long exactly it takes to do that. It is planned that as soon as a bunch of ControlBlocks is reworked they will be made available in the store. Would you be interested in a pre-order functionality? In that way, the orders could be fulfilled chronologically and we would know the exact demand … Please use the comments section below to give feedback about that idea. UPDATE 12/16/2015: We have added a pre-order option for the ControlBlock now.

Did I already mention that the new ControlBlock comes fully assembled, use the SPI interface (which is way faster than the previously used I2C interface), comes with a stackable pin header, and provides additional minor tweaks in its circuitry.


I am sorry for everyone who is waiting and looking forward to finish their project. I hope that this info post gives you some insights into the current status of the ControlBlock supply.

]]> 21