Hey Raspberry Pi Foundation!

4 12 2016

DSC01453

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;

DSC01455

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

Advertisements




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_force_hotplug=1 
hdmi_cvt=320 240 60 1 0 0 0 
hdmi_group=2 
hdmi_mode=87
dtoverlay=pitft22,rotate=90,speed=80000000,fps=60

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

20160126_213546

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:

 

#!/bin/bash 
clear
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 
./info.sh

# 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.setmode(GPIO.BCM) 
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

then

$ 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!





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:

piGarage

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.

webcam-enable-camera

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)

gpio-p51

  • 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.

piGarage

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:

#!/bin/sh
# /etc/init.d/test
### BEGIN INIT INFO
# 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
### END INIT INFO
 case "$1" in
  start)
    sleep 10
    sudo python /home/pi/char_lcd_plate_ipaddress_v2.py &
    ;;
  stop)
    killall python
    ;;
  *)
    exit 1
    ;;
esac
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.