Raspberry Pi Project Page

Last Updated on January 04 2016


Raspberry Pi (aka RPi)

One thing I’d like to fit to the race car, is a camera that starts recording automatically. I’ve used the GoPro2 Hero for a few years, and initially the results were very hit and miss. It had several bugs in the firmware, that meant after turning it on it would turn itself off, randomly. Or I’d hold the power button down to turn it on, and it would just beep randomly and reboot. Quite frustrating, and it leads to a lack of confidence, and a lack of video footage. After I upgraded the firmware several times, it became more reliable, and then missing footage was just down to me forgetting to press the button, or the charge running out. After starting the camera, it would often run for 30 mins whilst you queued and waited for red flag after red flag. So I’d like to find a way of recording footage only when I’m competing, so it skips all the non-competitive footage. That should be easy enough to do…


I’m also learning about the Raspberry Pi at the moment. The Raspberry Pi is a low cost, credit-card sized computer that plugs into a computer monitor or TV, and uses a standard keyboard and mouse. It is a capable little device that enables people of all ages to explore computing, and to learn how to program in languages like Scratch and Python. It uses an ARM processor, and costs less than £20. I bought one in 2014, a B+ model, for £15, and its sat in a cupboard for a year. I’m now looking to see if I can use it to record HD footage, and using GPS or an accelerometer to trigger movement, it should be possible to only record footage whilst the car is being driven. The video quality should be ok, the HD camera records at 1920x1080, which is as good as the GoPro2, though not as good as the later Pro3 or Pro4. In my experience, HD is more than adequate for my purposes. It depends on the lense I suppose, but testing will reveal any issues.


Raspberry Pi B+
The Raspberry Pi B+


The Pi is such a versatile device, and there is so much support for it, that it has many uses. I’ve been playing with RetroPie, which is a project that allows the RPi to emulate many of the legacy games platforms. With the RetroPie image written to a MicroSD card, the RPi boots up and runs a lovely interface, that allows you to connect PS or Xbox controllers, as well as keyboards and mice, and you can then select the emulator and play games. The only challenge is where to obtain the old ROMS. These are the memory images of the cartridges, or tapes, or CD’s that you bought and plugged in to the front of the games consoles. Fortunately, most ROMS are available over bittorrent, so once you’ve found a set for the emulator you want to play, you just need to upload them to the RPi. Now that is also easier than it sounds. When RetroPie is running, you can connect to the RPi using SFTP from another computer, such as a laptop on the same network as the RPi, and after logging in with Pi, and raspberry for the password, you can upload the ROMS to the RetroPie/ROMS folder. Once uploaded, when the RetroPie emulator is restarted, the games emulator is then available from the menu. So if you copy NES ROMS to the NES folder on the RPi, when you restart RetroPie, you will see the NES emulator on the menu. The rule is, no ROMS no Emulator. So don’t worry about any missing Emulators, they’re all there, but until ROMS are copied, they won’t appear.


The Retropie Project
The Retropie Project

The other project I’ve tried on the RPi is a media center tool, called OSMC. With the image downloaded, copied to MicroSD, and the RPi rebooted, the media center tool boots up, and this allows you to listen to Internet Radio, or play video from your NAS on to an HDMI connected TV. Very useful, and very versatile.


The OSMC Media Player
The OSMC Project

Update Jan 2016

The Pi is now streaming video reliably using gstreamer
I'm running Raspbian Wheezy

This is how you get gstreamer installed on to the Pi

sudo apt-get install gstreamer-1.0
sudo apt-get install gstreamer1.0-tools

Once installed, the following command line tells the Pi to fetch the video from the Pi HD camera, and output using h264 compression to the ip address of the laptop thats receiving the stream (in this case 192.168.0.11)

raspivid -t 0 -w 1280 -h 720 -fps 30 -b 1700000 -o - | gst-launch-1.0 -v fdsrc ! h264parse config-interval=1 ! rtph264pay ! udpsink host = 192.168.0.11 port= 9000

The above is at 1280x720 resolution, but this can be changed to suit.

gstreamer is also installed to the laptop, and once installed, the following command line tells gstreamer on the laptop to expect video from the Pi via UDP port 9000

c:\gstreamer\1.0\x86_64\bin\gst-launch-1.0 udpsrc port=9000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink

If all is successful, and you've configured the Windows 10 firewall to allow the gstream.exe to talk over the same port 9000, then you should see the video from the Pi, on the laptop.

Next job is to try gstreamer on the Android tablet.

http://gstreamer.freedesktop.org/download/

The plan is to run a 32foot USB cable from the Pi at the rear of the trailer, to the front, and place a USB network dongle as close to the car as possible on the end of the USB cable. The tablet will then connect to the WiFi AP at the front of the trailer, which will only be a short distance away, whilst sat on the car dashboard.