Hey Raspberry Pi Foundation!

4 12 2016


I thought I would put together all the Pi’s I’ve collected so far just to list them and the projects I’ve done with them.


From left to right and top to bottom you can see:

  • the official 7″ Touchscreen Monitor for Raspberry Pi assembled into the SmartiPi Touch for which I was a backer on Kickstarter; this one is running a brand new Pi 3 – the intent here is to run kivy on it and to build a cheap house monitoring / automation system;
  • a Pi 2 with Adafruit RGB Matrix HAT + RTC for Raspberry Pi and Adafruit 64×32 RGB LED Matrix – 4mm pitch which I am using to send messages to my kids (I’ll have to post on this soon);
  • a very fist KANO kit with a Pi 1 which I had participate to fund on Kickstarter as well; I had hoped my kids would enjoy building their computer but being French the language has been a show stopper (hey Kano team, if you haven’t done this already, I could help translating the tutorials Smile.. in French!);
  • one of the very first Adafruit Cupcade units – a little bit customized with stickers from arcadestickers – my kids just live this one!
  • going back left, second row: one of the very first Adafruit PiTFT 320×240 2.8" TFT+Touchscreen for Raspberry Pi assembled into its Enclosure for PiTFT;
  • just in front of this one we have an Adafruit PiTFT 2.2" HAT Mini Kit – 320×240 2.2" TFT – No Touch which can be used easily inside a Short Crust Plus case; I used it recently when building a RetroPie console – see this post;
  • on the right of the PiTFT there’s a now pretty old Pi 1 with Adafruit RGB Negative 16×2 LCD+Keypad Kit for Raspberry Pi: I used this one for my piGarage garage door controller (see my earlier post here) – for now it is mounted in a very neat crystal case – this one is pretty cool for teaching python to the kids
  • in front of this one you can see another Pi 1 which I am now using also for python learning sessions, this one with a Pibrella card inserted;
  • then we can see a RaspiRobot from sparkfun (too bad it’s retired) – well the chassis is equiped with a Pi 1, version 2 of the RaspiRobot board by Monk Makes, an Adjustable Pi Camera Mount from Adafruit, a Bluetooth 4.0 Console Adapter for Rapsberry Pi from openelectrons.com and an HC-SR04 Ultrasonic Range Sensor (pretty good tutorial here if you’d like to use it without the RaspiRobot board) – adding to this one of my fav’s TP-LINK WN725N wifi dongle, I could drive the car wireless and see videos with VLC Smile; power is being provided by a TeckNet powerbank;
  • front row you can see a Pi 2 with a Hybrid Tube Amp – this one is SWEET! I am so happy I helped funding this project;
  • then we have a pi Zero with a pHAT DAC from pimoroni; haven’t used this one much yet because of the above Hybrid Tube Amp Smile
  • to its right, another Pi 2 running RuneAudio with HiFiBerry’s AMP+ hat which I wired to an old pair of Celestion Ditton 44 – the case is yet another Short Crust Plus in which I drilled a few holes – this thing has literally resurrected my old speakers;
  • the last one on the picture is one I am also quite happy with: this one is a Pi 2 running RetroPie inside a NesPi LEGO case from RaspiPC.es – the controler is a NES30 from 8bitdo – if you want to build one for yourself, just go there;


I almost forgot this one: a PI 2 with a Pi 2 Design 502SSD – mSATA Solid State Drive Shield inside a custom acrylic case by Yours Truly.

Two more are missing now that I am thinking of: two Pi 2 running motionEyeOS (a Linux distribution that turns your single board computer into a video surveillance system): one is using a Pi Camera and is turned into a fast-mpeg cheap IP camera and the other is used to control the video streams from the fast-mpeg and from 2 other IP webcams.

Alright so net net this makes me the happy owner of a good bunch of Raspberry Pi’s with a fair amount of hats, accessories and more…this thing is really really good for building home projects Smile

Retrogaming part2: RetroPie on PiTFT

3 02 2016

20160202_225146In an earlier post (in French only, sorry folks) I documented in great details the making of my personal home arcade bartop thanks to Arcademy. You really want to check out Jérome’s latest projects – these are just amazing.

Another way of looking at retrogaming is by utilizing rather portable systems such as the Raspberry Pi. Phillip Burgess posted an amazing instructable at Adafruit on Running OpenGL-based Games & Emulators on Adafruit PiTFT Displays – unfortunately as he pointed out, recent updates to the Pi kernel & bootloader are incompatible with his guide.

We could not just wait till a fix, could we? So I decided I would try and give it a shot… and managed to get RetroPie 3.0 working on my Raspberry Pi B 2+ with Adafruit’s PiTFT 2.2”. I also added some additional features to facilitate the usage.

For the record, uname -a gives Linux raspberrypi 4.1.6-v7+ #2 SMP PREEMPT Fri Sep 4 16:49:07 UTC 2015 armv7l GNU/Linux.

Most of the work here is based on the article by Philippe Burgess on Adafruit: I cannot but recommend that you would read it carefully from A to Z before starting. You can also read http://www.averagemanvsraspberrypi.com/2014/07/how-to-set-up-adafruit-pitft-for.html for another perspective. Very similar in content but good to read as background.

PiTFT setup

Compared to Phillip Burgess’ approach, we are going to change a little bit the steps and start with the installation of the PiTFT screen. So we won’t be using the RetroPie distribution but rather start with a fresh Raspbian and run the RetroPie installation script at a later stage.

Attach your PiTFT hat to the Raspberry Pi and fetch the latest Raspian distribution. I’ll assume you know how to install Raspbian from the image. Once you’ve done this, follow the recommendations at https://learn.adafruit.com/running-opengl-based-games-and-emulators-on-adafruit-pitft-displays/retropie-setup. Specifically,
– Expand Filesystem
– Under “Advanced Options,” disable Overscan, enable the Device Tree, SPI (load SPI kernel module by default), and force audio through 3.5mm jack (since HDMI will be disconnected later).

Next is installing the required kernel changes for the display. We are going to run most of the steps described at https://learn.adafruit.com/running-opengl-based-games-and-emulators-on-adafruit-pitft-displays/pitft-setup.

$ curl -SLs https://apt.adafruit.com/add-pin | sudo bash 
$ sudo apt-get -y install raspberrypi-bootloader 
$ sudo apt-get update 
$ sudo apt-get upgrade 
$ sudo apt-get -y install raspberrypi-bootloader 
$ sudo apt-get -y install adafruit-pitft-helper

I am using a 2.2″ HAT hence to run the configuration script,

$ sudo adafruit-pitft-helper -t 22

Same here, just go with Phillip Burgess’ recommendations, all good. Then we install the live framebuffer mirroring tool.

$ sudo apt-get install cmake 
$ git clone https://github.com/tasanakorn/rpi-fbcp 
$ cd rpi-fbcp/ 
$ mkdir build 
$ cd build/ 
$ cmake .. 
$ make 
$ sudo install fbcp /usr/local/bin/fbcp

To launch fbcp fairly early in the startup sequence we need to edit /etc/rc.local. As we are not working (yet) with RetroPie we want to add the command /usr/local/bin/fbcp & to /etc/rc.local, just before the final “exit 0” line, and not in /etc/init.d/asplashscreen (which is quite obviously not yet here…)

Next is setting up the console with

$ sudo dpkg-reconfigure console-setup

(here again, follow the guide from P. Burgess) and editing the boot/config.txt file by adding at the end

hdmi_cvt=320 240 60 1 0 0 0 

Good! Let’s reboot.

$ sudo reboot

RetroPie setup

The next step is to install RetroPie. For doing this we are NOT going to use the distribution files (…) but the installation script as described here: http://blog.petrockblock.com/2012/07/22/retropie-setup-an-initialization-script-for-retroarch-on-the-raspberry-pi/.

$ sudo apt-get install -y git dialog 
$ git clone git://github.com/petrockblog/RetroPie-Setup.git 
$ cd RetroPie-Setup 
$ chmod +x retropie_setup.sh 
$ sudo ./retropie_setup.sh

At this stage we should have all working good, so we can spend some time on doing some tuning.

Startup tuning


The script below and its usage is largely inspired by http://framboisepi.fr/informations-sur-le-raspberry-pi-apres-la-connexion/. You can store this under /home/pi/info.sh:


echo "*** RETROPIE WITH PITFT ***"
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)" 
let secs=$((${upSeconds}%60)) 
let mins=$((${upSeconds}/60%60)) 
let hours=$((${upSeconds}/3600%24)) 
let days=$((${upSeconds}/86400)) 
UPTIME=`printf "%dd %02dh %02dm %02ds" "$days" "$hours" "$mins" "$secs"` 
# get the load averages 
read one five fifteen rest < /proc/loadavg
echo "$(tput setaf 2) 
`date +"%A %e %B %Y %R"` 
`uname -srmo` 
$(tput setaf 1) 
Uptime  : ${UPTIME} 
Memory  : $(tput setaf 2)$((`cat /proc/meminfo | grep MemFree | awk {'print $2'}`/1024)) mo $(tput setaf 1)/ $((`cat /proc/meminfo | grep MemTotal | awk {'print $2'}`/1024)) mo 
Load    : ${one}, ${five}, ${fifteen} (1, 5, 15 min) 
Process : `ps ax | wc -l | tr -d " "` 
IP@     : 
$(tput setaf 2)`/sbin/ifconfig | /bin/grep "Bcast:" | /usr/bin/cut -d ":" -f 2 | /usr/bin/cut -d " " -f 1` 
$(tput setaf 1)`wget -q -O - http://icanhazip.com/ | tail` 
Temp    : `vcgencmd measure_temp | sed "s/temp=//"` 
$(tput sgr0)"

echo "$(tput setaf 5)Press #27 to start EmulationStation. 
Press #23 to initiate immediate Shutdown. 

Once done, we just need to make it executable and to ensure it is executed on logging (did I say that you want to auto-log as user “pi”? go back to raspi-config!):

$ chmod 755 info.sh
$ vi .bashrc

add at the end of the file

# informations 

# buttons control 
sudo python buttons.py

then test it with

$ source .bashrc

Oops! missed to share the /home/pi/buttons.py script for handling GPIO #27 (remember #23 is directly configured in /etc/modprobe.d/adafruit.conf – which we did select during the PiTFT installation, right ?)

import RPi.GPIO as GPIO 
import time 
from subprocess import call

GPIO.setup(27,GPIO.IN, pull_up_down=GPIO.PUD_UP) 
while True:         GPIO.wait_for_edge(27, GPIO.RISING)         call(["/home/pi/ttyecho", "-n", "/dev/tty1", "emulationstation"])         quit()

Alright, now to the…

ROMs installation

Samba can ease the process (although RetroPie already adds some shares for ROMs and BIOSes)

$ sudo apt-get install samba samba-common-bin
$ smbpasswd -a pi 
$ smbpasswd -a pi
$ sudo smbpasswd -a pi
$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.orig
$ sudo vi /etc/samba/smb.conf

Ensure you have the following at the end of the file

[pihome]     comment= Pi Home     path=/home/pi     browseable=Yes     writeable=Yes     only guest=no     create mask=0777     directory mask=0777     public=no


$ sudo /etc/init.d/samba restart
$ sudo reboot

One thing I almost forgot: in order to issue the emulationstation command when hitting GPIO #27, I needed to echo the command on the correct tty. Tried a number of things…

$ su -c emulationstation pi
$ echo -e "emulationstation\n" (notice the carriage return...)
$ runuser -l pi -c emulationstation
$ sudo runuser -l pi -c emulationstation
$ eval `echo -e emulationstation`

… and more.

Then I found ttyecho, an Utility to Send Commands or Data to Other Terminals (tty/pts).

This one is simply a blast. Go for it:

$ vi ttyecho.c
$ make ttyecho

Test it:

$ sudo ./ttyecho -n /dev/tty1 emulationstation

Works like a charm -> let’s use this! 🙂

Extra: Wifi configuration

I am using my favorite TP-Link TL-WN725N dongle for this. You can either use the wpa_supplicant or manually edit the interfaces file. If required, you can find drivers here.

What’s missing?

20160126_213531Hope you found this guide useful. The last piece of it it that I have not yet found a way to get Bluetooth connectivity up & running with the excellent 8Bitdo NES30 GamePad. If anyone knows… ping me!

Retrogaming partie 1: arcademy

14 04 2015

borneEn français cette fois-ci! Cela faisait longtemps que je m’étais promis (à moi-même entre autres…) de blogguer sur le montage d’une borne d’arcade. Je n’ai bien sûr pas la prétention de tout couvrir, tant le nombre de solutions et de produits autour du Retro-gaming est important. J’en suis à ce jour à mon troisième montage sur cette thématique puisqu’en dehors du bartop Arcademy dont nous allons parler dans ce post j’ai également passé un peu de temps sur

  • la mini-borne Cupcade de Philipp Burgess à base de Raspberry Pi + MAME et disponible sur Adafruit.
  • le projet RetroPie qui lui aussi utilise un Pi et permet d’avoir entres autres une console NES sur sa télé très rapidement.

Ces deux derniers sont également de formidables projets, j’aurai l’occasion d’en reparler.

Pour en revenir au sujet du jour, Jérome Boulinguez via son site http://arcademy.fr propose un kit complet permettant de monter soi-même son bartop arcade. Comprenez borne d’arcade mi-hauteur,  complètement intégrée, à poser sur un meuble pour profiter de parties mémorables avec les amis… ou les enfants (qui adorent l’idée de jouer aux jeux de leur vieux papa).  A noter que Jérome a d’autres produits à son catalogue comme un flipper virtuel ou un mini-bartop – deux autres magnifiques réalisations.

Le kit bartop 2 joueurs vise à réutiliser un PC pour y faire tourner un certain nombre d’émulateurs dont MAME. Ré-utilisation éhontée du schéma du site puisqu’il est si bien fait:


Le kit propose l’ensemble des éléments bois pour monter la structure, toute la quincaillerie requise et pléthore d’options à commander directement ou encore à aller chercher dans son magasin de bricolage favori. La liste d’achat permet de se faire une idée et de comprendre ce qu’il faudra également se procurer en sus (comme par exemple les boutons et joysticks – ce qui permet un bon niveau de personnalisation). Là encore, tous les pointeurs nécessaires sont sur le site.

En dehors d’un documentation plus que complète, le site propose un ensemble de videos extrêmement détaillées qui font qu’il est difficile de se tromper. Sans revenir sur l’intégralité du montage, je vais vous partager mon expérience avec le kit Arcademy qui encore une fois est d’une grande qualité.

Comme Lord Raptor consacre un blog complet au sujet et revient sur l’ensemble des étapes du montage (voir son site: Le bartop du Raptor), je vais me limiter aux étapes qui m’ont parues nécessiter un peu plus d’attention et parfois proposer quelques idées.

Préparation des côtés de la bornes et du montant du control panel (étapes 1 à 3)

Rien de bien compliqué ici. Suivez bien les deux video d’Arcademy ainsi que les recommendations du Raptor ici et . +1 sur le commentaire “comprendre comment coller correctement (cccc) le vinyle”, c’est crucial.

Préparation du montant avec haut-parleurs (étape 4)

Une paire de Pioneer TS-G1032I achetée chez Feu Vert ou Norauto fait parfaitement l’affaire. Par ailleurs les grilles se découpent facilement. Idem ici, a priori pas moyen de se tromper en regardant bien les videos et les commentaires. Et bien si! Pour n’avoir pas fait attention, j’ai posé le vinyle du mauvais côté et ne m’en suis aperçu qu’après avoir découpé les ronds centraux… du coup trop larges. Après 10 bonnes minutes à maudire ma stupidité, j’ai trouvé une solution dont le rendu est en définitive aussi bon voire supérieur (à mon avis) au vinyle: j’ai “bombé” l’élément au spray, couleur zinc noir ferronnerie. Jugez plutôt:


Attention aux vapeurs cependant, bien pulvériser la peinture dans un endroit aéré et laisser sécher 30 minutes à 1 heure pour être sûr. Pour l’assemblage de la pièce MBV, faire en effet bien attention à laisser un espace suffisant pour permettre l’installation de la vitre plus tard. Pour la découpe des grilles, le marquage au crayon-craie fonctionne très bien.

Préparation de l’élément bas (étapes 5 et 6)

RAS pour cette étape. Idem, consultez bien les videos sur le site.

Assemblage de l’ossature principale de la borne, assemblage du panneau arrière et du panneau du control panel à l’avant (étapes 7 à 17)

En complément des videos du site arcademy, les photos sur le blog de Raptor sont particulièrement utiles pour se rendre compte de ce que l’on veut obtenir. Quelques points d’attention sur la base de mon expérience:

1. Hélas on a très vite fait de visser un peu trop fort et quoique d’une manière générale la visserie fournie avec le kit soit parfaitement adaptée, il peut arriver que certaines vis soient un peu trop larges et qu’un coup de tournevis trop appliqué fissure le bois. Ce qui m’est arrivé dans le coin supérieur de la borne:


Pour éviter cela, deux suggestions assez évidentes: a) toujours vérifier qu’une vis n’est pas trop large et au besoin la remplacer par une plus fine de longueur identique et b) procéder très doucement dès que l’on assemble des pièces de bois assez fines.

2. Les charnières ne s’alignent pas forcément au millimètre. Si ce n’est pas un problème dans l’absolu, il ne faut pas pour autant être surpris. Dans ce cas de figure, il convient de commencer par visser dans les trous les plus alignés et de procéder vers les moins alignés. Dans mon exemple j’ai commencé par les vis 3 et 4 et ai ensuite étendu vers la gauche et la droite.


3. Il n’existe pas de sachet plastique numéro 13 (ou 14 ou 15 – je ne me rappelle plus). Ce n’est pas un problème, juste une erreur d’etiquetage parfois – rien de grave mais ne soyez pas surpris.

4. Ainsi que le souligne Raptor dans son post, la pate de verrouillage du bloc porte arrière est juste impérative. Elle permettra de s’assurer que la porte ne s’ouvre pas inopinément, mettant en danger toute l’électronique une fois installée. Bon à savoir: lors du premier assemblage le verrouillage est lâche (voir ci-dessous), il convient alors de tordre légèrement la pate pour s’assurer d’un verrouillage solide.


Montage du système de fixation et de positionnement du moniteur (étapes 18 à 20)

Vous trouverez sur le site d’arcademy une liste de moniteurs compatibles. J’ai pour ma part opté pour un HP L1904T d’occasion qui est parfaitement compatible, qui se démonte facilement et qui s’allume automatiquement. Le seul point d’attention porte sur les vis d’assemblage fournies dans le kit (celles destinées à être utilisées sur le système de fixation VESA du moniteur). Pour ce moniteur, elles sont trop longues, il m’a fallu les remplacer par des plus courtes, ce qui a été vite fait.

Préparation du cache contour de moniteur et Installation du moniteur sur la borne (étapes 21 et 22)

C’est le passage le plus délicat. Avant de vous lancer, faites attention également à bien avoir installé le joint qui servira à cacher le jour qui sinon laissera passer la lumière du marquee.

Le montage de l’écran et son centrage peuvent se révéler assez funky. Pour ma part j’ai procédé calmement par étape, en positionnant l’écran au maximum et en serrant les vis au fur et à mesure. Une fois cela fait, le positionnement en profondeur peut se préparer en retirant temporairement la vitre. Pas simple seul, mais jouable pour peu que l’on soit au calme.

Finalisation des côtés de la borne, du Control Panel et Pose des Baguettes du Marquee (étapes 23 et 24)

Pas grand-chose à ajouter par rapport aux commentaires de Raptor. Ah si, un truc: faites attention à la pose des baguettes du marquee. En particulier, le centrage avec le double-face. Car malheureusement dans mon cas j’ai raté mon centrage et en voulant repositionner la baguette le double-face (costaud!) a arraché une partie du plaquage bois:


Autant dire que j’étais sérieusement furax de cette erreur. au final j’ai réussi à cacher plus ou moins la misère mais quel dommage…

Pour ce qui est des boutons et des joysticks, Jérome recommande smallcab comme fournisseur, j’ai suivi sa recommendation et je n’ai eu aucun problème, tout est arrivé parfaitement emballé. Pour mémoire la liste commandée (le tout pour un peu moins de 80€):


Installation du Hardware PC (étape 25)

Là encore, allez regarder en détails la video disponible sur le site d’Arcademy ainsi que les commentaires sur le site de Raptor. Quelques remarques complémentaires:

1. Le peu de place à l’arrière du bartop vous contraindra peut-être (sans doute!) à opter pour un ventirad CPU “low profile”: dans mon cas j’ai choisi de remplacer un vieux Noctua par un Zalman qui remplit parfaitement son office. Idem pour la carte graphique, choix d’un low profile et fanless (pas besoin de sur-performances). Notez que les barettes de RAM avec dissipateur passent quand même (j’avais un doute avant le montage):


2. C’est aussi un bon moment pour tester et insérer un dongle WiFi (le TP-Link TL-WN725N à moins de 10€ sur amazon est parfait) A noter également l’achat d’un coude DVI (un coude VGA est fourni dans le kit Arcademy) pour cette carte (une Radeon). Idem, environ 10€ sur amazon pour un coude Lindy:


3. Pour fixer solidement l’alimentation (qui est assez lourde en position verticale) j’ai opté pour l’installation de 4 équerres plastiques au lieu de deux. Raptor a préféré installer une sangle, je trouve ma solution plus esthétique ^_^.


4. Notez également (si vous arrivez à voir) l’isolation des cables par gaine thermorétractable. J’ai choisi en fait de souder toutes les connexions et d’utiliser des gaines pour les isoler. Définitif mais plus efficace au final pour une question de longueur des cables. Pour les gaines, c’est aussi moins de 10€ les 100 gaines sur amazon (et ça sert toujours).

5. Si vous voulez vous faire plaisir avec la grille de ventilateur extérieur, assurez-vous de la prendre en 80mm… pas comme certains qui commandent un superbe modèle en 92mm…. !

Câblage du Control Panel (étape 26 – la dernière!)

Clairement la plus longue des étapes, afin de ne rien rater. Contrairement à ce que j’ai pu faire pour la partie électrique, j’ai choisi là de rester sur l’utilisation des cosses, les cables à cosses 4.8mm de smallcab étant impeccables (un seul regret, ne pas pouvoir choisir les couleurs, ce qui aurait aidé pour un cablage encore plus net)

Le résultat

Une fois l’intégralité montée, le système configuré (notamment via un excellent et très utile clavier sans fil Logitech K400), le résultat est à la hauteur de ce que j’avais imaginé (comparez avec le design prévu en tête de ce post grâce à l’outil de choix des couleurs sur le site d’arcademy – encore une trouvaille!!!). Un grand merci encore à Jérome pour la qualité de son design, sa disponibilité et son accueil, c’est un vrai plus – je sais qu’autour de moi d’autres songent à se lancer une fois vu le résultat!


piGarage – Redux

2 09 2014

Garage_door_sliding_upHey! Another post in so little time! This time about visually checking the status (opened/closed) and controlling the garage door directly with any smartphone connected to a Raspberry Pi through the personal wifi network.

I have seen a number of posts and articles recently about building one’s own pi-controlled garage door (as an example see issue #22 of the excellent MagPi or the corresponding tutorial on Adafruit), but none of them had all the features I was looking for. The basic idea is to be able to check the status of the garage from any location (imagine you’re at work and suddenly you realize that you may have missed to close the door) and if required to be able to remotely open or close it. And to ease the process, we want the controlling device to operate wifi and to show a little bit of information when plugged in. So we want something that would be autonomous, nicely packed, wifi-enabled, with a camera and a web interface, and a few controls and pieces of information directly on the device. And of course, we want to use this as an opportunity to discover GPIO’s, I2C and more…!

Here’s what I came up with as a first prototype. Here again this project leverages code snippets and tutorials found on the web so I have tried to name the authors as much as possible and to provide all references. If someone recognizes his code, let me know and I will certainly update this post. This is how the current version looks like:


Parts list

  • 1 x Raspberry Pi model B or B+ from your preferred reseller. Both will work, using the B+ version will give you additional pins but you will see later in this article that with a little bit of soldering, the regular B version is running great.
  • 1 x Rapsberry Pi camera module, either normal or infrared
  • 1 x 5V Relay interface board which you can find at amazon.com
  • 1 x wifi USB adapter, I would recommend the TP-LINK TL-WN725N, works great with the Pi
  • 1 x Adafruit RGB Negative 16×2 LCD+Keypad Kit for Raspberry Pi, neat for displaying the information we want to have at boot time (note that you will need soldering skills here in order to assemble the parts of the kit)
  • … and of course a bunch of jumper wires (female to female and female to male) and a set of M3 spacers ans screws, which you can find at any electronic reseller.
  • in addition, you may want to have an HDMI cable and a keyboard for fresh install / debugging parts as well as a plastic or acrylic box to sotore and hold all parts together. I found mine at the local mall so you should have no issue on this. make sure that the box is thick enough to sustain screws yet thin enough to be easily cut.

Initial setup of the Pi

Install the latest Debian for the Pi available at http://www.raspberrypi.org/downloads/. Once the install has completed, configure Internationalization options and enable the camera and SSH for further installation. As an option, change the password to something faster for the installaiton as you’ll have a few reboots to go with. Next, make sure you have the latest packages with

$ sudo apt-get update; sudo apt-get upgrade

Here we go, first reboot to start with a clean environment

$ sudo reboot

Now we are going to install the required components for the Wifi dongle. Mendrugox has an excellent, detailed tutorial on getting the TP-LINK TL-WN725N v2 to work on Raspberry Pi (Raspbian):     http://www.mendrugox.net/2013/08/tp-link-tl-wn725n-v2-working-on-raspberry-raspbian/. Here we are just going to show the main steps (make sure you have the dongle inserted in one of the USB ports before proceeding):

$ uname -a

You should get something like

$ Linux raspberrypi 3.12.22+ #691 PREEMPT Wed Jun 18 18:29:58 BST 2014 armv6l GNU/Linux.

So we’re looking for the Drivers for TL-WN725N V2 – 3.6.11+ -> 3.12.26+ which are conveniently available at http://www.raspberrypi.org/forums/viewtopic.php?p=462982#p462982

$ wget https://dl.dropboxusercontent.com/u/80256631/8188eu-20140616.tar.gz

Extract the file from this gunzipped archive and install the module:

$ sudo install -p -m 644 8188eu.ko /lib/modules/$(uname -r)/kernel/drivers/net/wireless  
$ sudo insmod /lib/modules/$(uname -r)/kernel/drivers/net/wireless/8188eu.ko  
$ sudo depmod -a

Next, configure the network interfaces. A detailed page at http://www.fars-robotics.net/ provides all the information required to properly configure the Wifi according to your own needs and network setup.

$ sudo vi /etc/network/interfaces

Edit the file and reboot to get the changes applied (ok, you could also run a sudo ifdown and sudo ifup but I got lazy recently and a small reboot does’nt hurt, does it?)

$ sudo reboot

Just to make sure: after the reboot simply run ifconfig and confirm that everything is fine, i.e. that you can get your IP address on wlan0 interface; if not, check alls steps above.


Log back in, start installing the required components for the web part:

$ sudo apt-get install lighttpd php5-cgi php5-gd 
$ sudo lighty-enable-mod fastcgi 
$ sudo lighty-enable-mod fastcgi-php 
$ echo '<?php phpinfo(); ?>' | sudo tee /var/www/phpinfo.php

Check this is fine by browsing to http://your.raspberry.ip/phpinfo.php.

Setting up the camera to take still pictures each 5 seconds

First you have to make sure to enable the camera by using the raspi-config utility.


If you are unsure on how to do this, check out http://www.raspberrypi.org/documentation/configuration/raspi-config.md.

After this is done, we are going to setup the camera for taking a picture every 5 seconds and save it on a RAM disk, and this is going to be installed as a daemon. This part is directly reused from the excellent article from ED at http://dronkert.net/rpi/webcam.html. I cannot recommend more that you would read his post very carefully to understand all the steps as I will simply quote a sub-part of it.

$ cd ~ 
$ nohup raspistill -n -e jpg -w 800 -h 600 -q 70 -t 2147483647 -tl 5000 -o /dev/shm/webcam.jpg & 
$ wget http://dronkert.net/rpi/webcam-service-1.0.1.txt 
$ sudo cp webcam-service-1.0.1.txt /etc/init.d/webcam 
$ sudo chmod 755 /etc/init.d/webcam
$ sudo update-rc.d webcam defaults 99 01

To disable the camera light, for stealth operation, edit config.txt:

$ sudo vi /etc/config.txt

and add on a new line disable_camera_led = 1.

A few more steps and you will be able to see the picture on the web server.

Installation of wiringPi

Wiring Pi is a library which makes it a lot easier to use the Raspberry Pi GPIOs. Check that you have the latest version of git:

$ cd ~ 
$ sudo apt-get install git-core

and install wiringPi

$ git clone git://git.drogon.net/wiringPi 
$ cd wiringPi/
$ git pull origin
$ ./build

Only part left is to install the .php files.

Code part 1 – the web site to be hosted on the Pi

This is the code to control the image & the buttons. Again, (very) largely inspired by Ewoud Dronkert’s (http://dronkert.net) code as well as the one from TheFreeElectron at http://www.instructables.com/id/Simple-and-intuitive-web-interface-for-your-Raspbe/?ALLSTEPS. Just made it simpler for the intended purpose, somewhat merged both codes and fixed a couple of issues when doing so. Authors of both articles are to be praised for the quality of their tutorials.

The result is composed of the following files:

  • /var/www/index.php: the main file for the site, includes scripts for both starting to shoot the pictures and the GPIO code,
  • /var/www/webcam.php: the page that will check if a file is available, then timestamp it and return to the main file for update,
  • /var/www/script.js: the javascript used to change the state of the buttons and thus of the GPIO pins of the Raspberry,
  • /var/www/gpio.php: used by the javaScript, updates the pins’ statuses.,
  • of course the “on” and “off” image file – also to be placed in /var/www.

Get all the code on GitHub at https://github.com/Narno38/piGarage and make sure that the adequate rights and owners are set:

$ sudo chown -R www-data:www-data /var/www

With all this, we are ready to test the camera and the relay card, we just need some cabling.

Assembly and wiring part 1 – GPIO and camera

First thing we want to wire is the 5V Relay board. As I wanted to save all the Pi GPIO pins and thanks to ozzmaker.com I learned that as of revision 2 boards there is space to add some header pins to get access to eight more GPIO pins. These are found on the Header 5 with the following functions: (image courtesy of ozzmaker.com)


  • P5-Pin1 – 5v0
  • P5-Pin2 – 3.3v
  • P5-Pin3 – GPIO28
  • P5-Pin4 – GPIO30
  • P5-Pin5 – GPIO29
  • P5-Pin6 – GPIO31
  • P5-Pin7 – GND
  • P5-Pin8 – GND

In this setup, I have used pins 1, 3, 5 and 7 and wired them directly to the GND, VCC (5v0), IN1 (GPIO28) and IN2 (GPIO29) pins of the relay board after a little bit of soldering onto the Pi. If you don’t feel like doing so, you can use any of the regular GPIO pins of the Pi as the display will be using I2C. The additional pins above are useful only in case you would want to use a different display or wire more parts. You will simply have to modify thre references to the GPIO pins in files index.php, gpio.php and script.js.

Notice that GPIO28, 29, 30 and 31 correspond to wiringPi pins 17, 18, 19 and 20 (see http://wiringpi.com/pins/special-pin-functions/).

At this stage you should be able to boot your Rapsberry Pi, to browse to http://your.raspberry.ip/index.php and to see the interface with the pictures taken every 5 seconds and the 2 buttons for switching on and off the relays.

Assembly and wiring part 2 – RGB LCD Display

Now that we have the main features up and running, we want a minimal interface on the front. Why is that? As an example, we want to be able to display the IP address that the Pi was given when the network is set to dhcp. Of course if you have networking skills, you can always ensure that the MAC addresses for the LAN and wLAN interfaces are static in your dhcp domain, but where’s the fun, eh?

The Adafruit RGB Negative 16×2 LCD+Keypad Kit for Raspberry Pi comes in handy. The good news about this sweet little piece of hardware is that Adafruit had the excellent idea to add a plate that makes the display i2c compatible, so that 2 pins (besides 5V and GND) are required. Let’s wire up!

  • LCD ground (GND) goes to pin 6 on the Raspberry Pi
  • 5V goes to pin 2
  • SDA goes to pin 3
  • SCL goes to pin 5

Below is an approximate schematics of what we want to have. the LCD is shown with a Pi Cobbler as the exact product does not exist (yet?) in Fritzing.


Now we are going to install the necessary packages in order to use the LCD. An excellent tutorial is available at https://learn.adafruit.com/adafruit-16×2-character-lcd-plus-keypad-for-raspberry-pi, we will simply list below the main steps.

As explained on Adafruit’s tutorial, you may feel better by knowing that the backlights of the display will not turn on until you have the code running!

Start by setting up your Pi for I2C:

$ sudo vi /etc/modules

and add 2 new lines with i2c-bcm2708 and i2c-dev to the end of the file. Then save and reboot to enable the hardware I2C driver.

Before you can get started with I2C on the Pi, you’ll need to run through a couple quick steps from the console.  Just enter the following commands to add SMBus support (which includes I2C) to Python:

$ sudo apt-get install python-smbus
$ sudo apt-get install i2c-tools

i2c-tools isn’t strictly required, but it’s a useful package since you can use it to scan for any I2C or SMBus devices connected to your board.  If you know something is connected, but you don’t know it’s 7-bit I2C address, this library has a great little tool to help you find it:

$ sudo i2cdetect -y 1

This will search /dev/i2c-0 or /dev/i2c-1 for all address, and if an Adafruit LCD Plate is connected, it should show up at 0x20. Once both of these packages have been installed, you have everything you need to get started accessing I2C and SMBus devices in Python.

The LCD Pi Plate Python code for Pi is available on Github at: https://github.com/adafruit/Adafruit_Python_CharLCD and we will use most of it and adapt to our needs.

$ sudo apt-get install build-essential python-dev python-smbus python-pip git
$ sudo pip install RPi.GPIO
$ git clone https://github.com/adafruit/Adafruit_Python_CharLCD.git
$ cd Adafruit_Python_CharLCD/
$ sudo python setup.py install

Retrieve the part of the code to display the IP’s from https://github.com/Narno38/piGarage.

As you will read from the code, you can also use the right button to simply switch off the screen. Probably this should be improved by putting a delay after which the screen would switch off…:)

Last thing to do, we need to make sure that the Python code runs at start.

$ cd /etc/init.d
$ sudo vi char_lcd_plate_ipaddress_v2

Paste the following:

# /etc/init.d/test
# Provides:          IP display on LCD
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Simple script to auto start lan0 and wlan0 IP's on LCD
# Description:       Simple script to auto start lan0 and wlan0 IP's on LCD
 case "$1" in
    sleep 10
    sudo python /home/pi/char_lcd_plate_ipaddress_v2.py &
    killall python
    exit 1
exit 0

Make it executable

$ chmod +x char_lcd_plate_ipaddress_v2

and make sure it starts at boot

$ sudo insserv char_lcd_plate_ipaddress_v2

Try it out without restarting

$ sudo /etc/init.d/char_lcd_plate_ipaddress_v2 start

After you have observed it starting, we should be safe to reboot

sudo reboot

and everything should be fine then! If not, don’t hesitate to drop me a note.

One last word of caution: from http://wiringpi.com/pins/special-pin-functions/, “The Raspberry Pi is a 3.3 volt device! Attempting to directly connect to any 5V logic system will very likely result in tears…”

On my setup, I have seen from time to time the Pi refusing to boot and I had to disconnect / reconnect the relay. This is really the only issue I had. I guess the best thing would be to have a 3.3V solid state relay but I haven’t found one yet. Or maybe to add another piece of electronic to power up the GPIO voltage prior to going to the relay. If anyone has a simple way to do it, let me know. the idea here was really to test a number of things together.

MicroView Alien Scanner

15 08 2014

Thumbnail_MicroView_HeroBeen a while without any post on this blog. Anyway, a good time for a revival now as I have recently received my chip-sized Arduino with built-in OLED Display know as the MicroView (a project which I’ve been a backer at kickstarter). After I did all the tutorials to learn about Arduino and the MicroView I started to wonder what I could do as a first project. Hence the idea of building an Alien-like tracker. Something that would more or less beep like the tracker in the movies and display the actual distance between me and the next thing in front of me. I still own a Nerf N-Strike Longstrike CS-6 Dart Blaster and I thought it would be pretty cool to attach the sonar to the gun. This is how the final prototype looks like:


Basically the MicroView serves as the radar display and gives the rough distance of the object/alien in front of us. If the… thing comes closer then the bar graph is going to light up. The closer it gets the more LEDs get on. And the whole time, there’s a bip-bip sound going on so you feel even more in the movie. For now, it’s more of a simulator (except for the sonar which actually work but I’ll need to continue on the 3D position and movement).

Bill of Material (aka what you will need to build it)

Of course you’ll need the MicroView – OLED Arduino Module as soon as available, as well as its USB Programmer. In addition you will have to get the following elements:

  • Perma-Proto Half-sized Breadboard PCB – find it at Adafruit
  • SPDT Mini Power Switch – at Sparkfun
  • a piezo buzzer – at Adafruit
  • Female headers – at Sparkfun
  • 10 Segment LED Bar Graph – Blue – at Sparkfun
  • a bag of 10+ 330 Ohm resistors – find them at Sparkfun (this will be to protect the LEDs)
  • Ultrasonic Range Finder – Maxbotix LV-EZ0 – at Sparkfun
  • a 9V Snap Connector for the 9V battery – at Sparkfun
  • … and of course a bunch of jumper wires, which you can find at any electronic reseller.

With this… heat up your favorite iron, it’s solder time!


Start with the LED Bar Graph, insert the top left corner in F1 (or better, F2 as I found out later that F1 means you’re losing access to the screw hole…). The component should sit between F1and F10 and E1 to E10. Solder nicely and trim the trails. Save them for they will make handy jumpers shortly.

After you’ve soldered the bar graph, add 10x 330 Ohm resistors, B1 to the GND, B2 to the GND, etc. Finally, use the saved parts to create nice jumpers for we will group the LEDs in batches of 2. First jumper links J1 and J2, second one is for I3 and I4, then J5/J6, I7/I8 and then J9/J10.


Now we will put in the additional components. Cut out two 8-long female headers and solder them H13 to H20 and C13 to C20. They will form the socket for the MicroView. Add one more 7-long from J21 to J27, this will be for the range finder. Finally, solder in the switch between H28 and H30 and the piezo buzzer E22/E25 (E25 is the GND). That’s it for the components, we will now move to the actual wiring.

First we will connect the grounds from the top and the bottom of the PCB. Solder a connector wire from top GND11 to bottom GND11. As we’re doing grounds, let’s wire them all. For the range finder, connect I27 to the top GND. For the MicroView, connect B20 and the bottom GND: this is pin 8 of the MicroView, see the Pin Configuration diagram here). And for the buzzer, connect B25 to the bottom GND.

Onto the rest of the wiring:

  • connect 5 of the bar graph LEDs to the MicroView Arduino pins: G1 to G15 (Arduino pin 6), G3 to G16 (Arduino pin 5), H5 to I17 (Arduino pin 3), H7 to I18 (Arduino pin 2) and H9 to D17 (Arduino pin A2). This is because we’re not using an 8-Bit Shift Register here.
  • Connect H23 (range finder ANalog) to D18 (Arduino pin A1).
  • B22 to B19 (Arduino pin A0) for the buzzer.
  • I29 to the top VC++ (for powering on via the switch)
  • I26 to I14 (Arduino +5V to the range finder)
  • F28 to F13: this will be the VIN for the MicroView.

Finally, you may want to add a couple of male headers at the top on e.g. row 1 so that you be be able to easily connect the 9V battery at a later time.

You’re done! Next, insert your USB Programmer with the MicroView on top on the “socket’’” we have built in the middle of the PCB. Connect your USB cable to your PC, we’re going to the…

Code part

This code leverages code snippets found on the web. I have tried to name the authors when available. If someone recognizes his code, let me know and I will certainly addgive deserved credits. Likewise: this code is free to use, just let me know if you found it useful. I have inserted a fair amount of comments for documenting it, so it hsould be easy to read/understand. If not, just drop me a note.

  • Get the code here as a .docx file to accomodate WordPress’ requirements for media files.

Have fun!

No RISC more FUN… get rid of legacy IT!

25 05 2011

1295700707040It’s been more than 2 years now that I’ve been working on migration projects with customers willing to modernize their IT and keen to replace legacy, costly, outperformed systems.

Besides the usual reasons given for IT and services upgrades(appearance of social medias, new business models, new devices…), there are clear drivers for migrating and companies which are limiting themselves to a mere Unix strategy need to understand that there are issues on the horizon. Aging RISC infrastructure with leases expiration leading to short term refresh or renewal, important CAPEX (Capital Expenditure) requirinq longer amortization, high consumption costs (power, data center space, cooling), knowledge reduction inside and outside the company (people just don’t want to work on old technologies!) and an increased dependency on 3rd Party Prodcuts (3PP) are the most obvious challenges.

The aging RISC infrastructure and the infamous vendor lock-in situation is by far the main driver. Looking at a sample on Oracle/Sun’s strategy, there is no product roadmap for SPARC processors and the SPARC-based server portfolio split between CMT/SPARC and Fujitsu MSeries is unclear – the least to say, even with the newly introduced T3. The OpenSolaris project was shut down by Oracle and replaced by Solaris 11 Express. Oracle runs numerous license changes and the confusion affects IT consolidation strategies. In the end, the monolithic, all-inclusive hardware/software offering creates a new risk for the end customer.

So options are to change now or later, but the necessity to change is not questionable nor it is questioned. However and even when the decision to modernize is taken, there are still migration roadblocks to overcome. Predictable blocking points generally include the complacency of (large) organizations or the resistance to change when the latter is considered a technological jump / a disruptive change. The traditional challenges in such a change are to maintain functionality, to optimize performances while reducing TCO, leveraging in-house engineering expertise, facilitating change management and streamlining development operations.

… it is all about taking smart risks when the stakes are high.

Related Information

Minority report…

9 12 2009

Technology is about to change our ways of communicating and interacting with the world… again. Again ? I recently bumped into a very good demonstration of augmented reality by General Electric. The Smart Grid Augmented Reality demo shows a GE Smart Griddigital hologram of GE’s technology which you can manipulate in front of your computer, provided you have a webcam and a printer.

GE explains that this demo uses the FLARToolKit from the Spark project and gives you the impression the landscape comes live in your hands. Very impressive and fun! How could we use this in projects ?

The Sixth Sense demo from TED is also amazing. This demo from Pattie Maes’ lab at MIT, spearheaded by Pranav Mistry, shows a wearable device with a projector that paves the way for profound interaction with our environment. Some blah blah blah at first and then the demo starts approximately at 2:20.

Made me think about Microsoft’s Surface, the way you can display, sort & organize things. With a slight difference in the price! Now certainly they need to work on the batteries to ensure friendly utilization, but now you may really ask yourself how this will impact our personal and professional environment. With all the use cases that TED has imagined for this presentaiton, we can certainly add some more, like true whiteboard sharing for brainstorm sessions, with live changes between participants. I can’t wait to see this, SMS’s will look so odd in 10 years from now ! Certainly also, combining augmented reality and SixthSense will bring us some more capabilities to accelerate projects and developments.