Posts

RetropieZero

During the last weeks I created a mobile game console with the help of a Raspberry Pi Zero and RetroPie.

The result of my mobile game console “RetroPieZero” is shown below:

The RetroPieZero consists of the following parts:

To use the Waveshare LCD you need to install the drivers from the wiki. Afterwards you can use FBCP to mirror the framebuffer of RetroPie to the display.

With the help of Hubs I printed a custom case for all the components. I designed the basic parts in Adobe Illustrator and exported them to SVG. The resulting layers are imported to 123D Design. Because the units are messed up after the export of Illustrator I needed to customize the SVGs and add a transform attribute to each SVG Group (see the corresponding reddit thread)

Gamepad2Keyboard Mapper for Dosbox on the Raspberry Pi

To play some old computer games with RetroPie I installed retrosmc on my Raspberry Pi running OSMC.

I was trying to play the retro game “Wacky Wheels” with DOSBox. Unfortunately my USB Gamepads were not able to handle the configuration of the input. So I wrote a small python script which maps gamepad inputs to keyboard inputs.

The script is shown below. It is executed with the start-script of “Wacky-Wheels” in “/home/osmc/RetroPie/roms/pc”:

#!/bin/bash
python /home/osmc/joystick.py &
JOYSTICK_PID=$!
/opt/retropie/emulators/dosbox/bin/dosbox -c "mount c /home/osmc/RetroPie/roms/pc" -c "c:" -c "cd WACKY" -c "WW.EXE" -c "exit"
kill $JOYSTICK_PID

Also it is important to have joysticktype=none in your dosbox-SVN.conf

OSMC with IR Remote and Hyperion

OSMC

Since Raspbmc is no longer under development I upgraded to the enhancement called OSMC.

IR-Remote

After installing OSMC on my SD card I tried to enable the device tree overlay for the GPIO IR Remote. This can be accomplished in the OSMC Settings Plugin or in the file /boot/config.txt by adding:

dtoverlay=lirc-rpi:gpio_out_pin=17,gpio_in_pin=18

Furthermore you need to delete the lircd.conf in /etc/lirc and store your version created for the remote at /home/osmc/lircd.conf. It is important to edit the “name” entry.

To enable the key functionality you need to add a Lircmap.xml to map the keys.
More information can be found in the entry on the OSMC forum: https://discourse.osmc.tv/t/rpi2-osmc-alpha-4-and-ir-gpio/483/12

You will need to configure a Lircmap.xml file and place it in /home/osmc/.kodi/userdata folder.
If there is none avaialable there, take the default one from here
/usr/share/xbmc/system/
and modify it.
Keep only one entry and make sure that the LIRC button names are correct (keep onet hat has KEY_LEFT, KEY_RIGHT, etc. in it).
Make sure you use the same name for the remote device name with the one configured in /etc/lirc/lircd.conf (if it’s generated, the name is the path where it was created. Feel free to rename it to something more handy, like ‘myremote’)
More info here:
http://kodi.wiki/view/Userdata/lircmap.xml27
Place the edited Lircmap.xml file in the /home/osmc/.kodi/userdata/Lircmap.xml and then restart kodi (or the RPi).

Ambilight with Hyperion

To enable the ambilight functionality I replaced Boblight with the lightweight Hyperion. The installation and configuration process is described in the wiki: https://github.com/tvdzwan/hyperion/wiki/Installation and https://github.com/tvdzwan/hyperion/wiki/Configuration.

Unfortunately the LEDs weren’t working in my setup. To debug the hyperion process you can start it with

sudo /usr/bin/hyperiond /etc/hyperion.config.json

While debugging I found a XBMC Connection Error (0) which is described in the forum: https://discourse.osmc.tv/t/rpi2-hyperion-osmc/449/43

The solution is to create a init script in /etc/systemd/system/multi-user.target.wants/hyperion.service

[Unit]
Description = hyperion
After = mediacenter.service

[Service]
User = osmc
Group = osmc
Type = simple
ExecStart= /usr/bin/hyperiond /etc/hyperion.config.json
Restart = always
RestartSec = 1

[Install]
WantedBy = multi-user.target

FBTFT and Device Tree

I’ve remounted my TFT touch display and connected it to another Raspberry Pi. During the installation process I realized, that the FBTFT Kernel is now Device Tree enabled, this makes the installation and configuration process a lot easier. (https://github.com/notro/fbtft/wiki#install)

Therefore you only need to install the FBTFT enabled Firmware (https://github.com/notro/rpi-firmware) and after that you can enable the TFT display HY-28B:

Add the following statement to /boot/config.txt to enable the hy28b overlay:

dtoverlay=hy28b, rotate=90

The overlays can be found on https://github.com/notro/rpi-firmware/tree/master/overlays.

To enable the console output on the display you had to add the following to the first line of /boot/cmdline.txt:

fbcon=map:10 fbcon=font:VGA8X8

After a reboot the display should be recognized and working. You can check it in dmesg.

To use the display with pygame you need to install the following packages and calibrate the touchpanel:

apt-get update
apt-get install libts-bin evtest xinput python-dev python-pip
pip install evdev
sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate

Update 1:
With the integration of the FBTFT drivers in the Raspberry Pi kernel (https://github.com/notro/fbtft/wiki) it is no longer neccessary to install notro’s FBTFT kernel.

Update 2:
I run in some problems with the display showing no content. The backlight was on but there were no image visible. I was able to fix the problem by setting the GPIO configuration fixed and not automatically:

dtoverlay=hy28b, rotate=90, resetgpio=25, ledgpio=18

TinyTX LDR Sensors

To monitor the control light of my cooker and oven I mounted two LDRs (light dependent resistor) on a TinyTX sender. The LDR recognizes changes of the light and the TinxTX sensor is redirecting this information to my Raspberry Pi. The Raspberry Pi is checking the local network for my mobile phone and notifies me with my android app when I am no longer at home and the cooker is still on.