I got the idea for this after watching Dave’s teardown of the 1984 Sinclair flat screen pocket TV and thought it looked like a good candidate to make a cool retro style status display housing.
So soon after watching Dave’s teardown I headed off to eBay and picked one up, this one was non-functional to begin with (dead CRT) so I had no qualms about gutting it. With the guts and the fresnel lens removed you are left with a nice big space with a nice clear window for the screen.
Version 1 – Tiny328 and 1.8″ LCD
Initially I stuck a 1.8″ SPI LCD that I already had spare and one of my Tiny328 boards in it, receiving data directly from my sensors using the RFM12B transceiver. The 1.8″ 160×128 display proved the concept but was just a little too small as its surround and flex cable was visible within the TVs screen aperture so I took a punt on a 2.2″ SPI LCD which seemed like it would be a better fit.
Version 2 – Spark Core and 2.2″ LCD
The 2.2″ LCD I bought is a QVGA (240×320) display and the panel itself fits nicely into the recess on the inside of the TV case and lines up perfectly with the window with none of its surround showing at all, it could have been made for it. Cost? All of £3.65 including shipping from Hong Kong, crazy.
With this one I decided to swap the Tiny328 for a Spark Core and used it as a WiFi MQTT display for a while but I wasn’t really happy with the resulting graphics and decided that to really make full use of its potential it had to have a Raspberry Pi inside and that case looked the perfect size.
Version 3, The Raspberry Pi
It turned out that the Raspberry Pi Model A was almost exactly the right size but despite trying many different orientations I couldn’t quite get the case to fully close with it inside (if only I’d had this then) even after carefully bending the pins on the display over 90 degrees so they were parallel with the board. In the end I bit the bullet and decided to slim the Pi down by desoldering the composite video socket, audio output socket and the 26 GPIO pins. I then soldered the wires from the display directly to the necessary pads on the Pi. Now it fit with room to spare.
I used some Sugru to hold the LCD in position and covered it with a piece of plastic so it doesn’t short out on the Pi which sits nicely above it between the original standoffs. I’ve also used some Sugru to fit an infrared remote receiver in the window for the old tuning dial and to fill the holes for the original control wheels I cut one of the wheels in half and stuck them in with yet more Sugru, From the outside it looks as Sir Clive intended.
For network connectivity I have used the tiny Edimax EW-7811UN WiFi dongle and I’ve added one of these MicroSD adapters to further reduce the footprint of the Pi. With all this done everything fits inside nicely with the USB cable for power exiting via the original power socket hole. There is also a pair of speakers and a small amplifier board hidden under the Pi on the right hand side, more on that later.
Connecting the 2.2″ display to the Raspberry Pi
The LCD is connected to the Raspberry Pi as follows:
|SDI (MISO)||Not Connected|
|SDI (MOSI)||P1-19 (MOSI)|
For the Raspberry Pi GPIO pins refer to the layout here.
Setting up FBTFT
Fortunately using these SPI displays with the Pi is a doddle thanks to Notro’s FBTFT kernel drivers which support a range of popular display controllers including the ILI9340 controller used in this one.
There are two ways you can use the FBTFT kernel drivers, either via kernel modules or using a kernel with the drivers built in, I went with the kernel option as it allows you to use the LCD as your console straight from boot.
It’s easy to set up, first make sure you have the rpi-update with REPO_URI support installed with:
sudo wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-upda
then enable the SPI kernel module by editing /etc/modprobe.d/raspi-blacklist.conf and commenting out or removing the line: blacklist spi-bcm2708
Next install the kernel with FBTFT support with:
sudo REPO_URI=https://github.com/notro/rpi-firmware BRANCH=builtin rpi-update
FBTFT used like this needs to be configured on the kernel command line in /boot/cmdline.txt
The display I am using has a ILI9340 controller which is compatible with the fb_adafruit22a driver so I have used the following in the kernel command line:
fbtft_device.name=fb_adafruit22a fbtft_device.speed=32000000 fbtft_device.gpios=reset:23,dc:25,led:24 fbtft_device.bgr=1 fbtft_device.rotate=270 fbcon=map:10 fbcon=font:ProFont6x11
This breaks down as follows:
Tells FBTFT to use the Adafruit 22a driver.
Sets the SPI speed in Hz
Configures which GPIO pins have been used for the reset, DC and LED pins.
Inverts the red and blue which is required on this display.
Sets the angle to rotate display counter clockwise, can be one of 0, 90, 180, 270
Sets the boot console to always uses the LCD
Sets the font to use for the console, can be one of: MINI4x6, VGA8x8, Acorn8x8, PEARL8x8, ProFont6x11, 7×14, VGA8x16, SUN8x16, 10×18, SUN12x22
Once the FBTFT options have been added to the kernel command line a reboot should see the console displayed on the LCD straight from boot.
Log in (I did this via ssh) and then you can also launch X with FRAMEBUFFER=/dev/fb1 startx
or play a video from the commandline by installing mplayer and using the command:
sudo mplayer -nolirc -vo fbdev2:/dev/fb1 -framedrop filename.mpg
If you want to have it automatically login at the console you can edit /etc/inittab and change
1:2345:respawn:/sbin/getty –noclear 38400 tty1
1:2345:respawn:/bin/login -f pi tty1 /dev/tty1 2>&1
Where pi is the name of the user you want to be logged in.
To run a program automatically on login you can just add it to the end of ~/.profile
eg. Install htop and add htop to the end of .profile, combined with the automatic login the Pi will boot and automatically display htop, ideal for a little status display if you are using it as a server of some kind.
If you want to start X automatically edit /etc/rc.local
and add the following where pi is the name of the user you want to be logged in.
su -l pi -c “env FRAMEBUFFER=/dev/fb1 startx &”
Tip: To disable the screen blanker (default 30 mins) change the BLANK_TIME=30 to BLANK_TIME=0 in /etc/kbd/config
There are some more tricks described here including frame buffer mirroring which allows you to take advantage of the Raspberry Pi GPU for a faster display.
Adding an IR receiver
I also added an infrared receiver so I could control things from a remote control. I used a TSOP31238 IR receiver as it was the same one I used in my TinyPCRemote project and I had one spare but other 38kHz receivers that work at 3V3 with an active low output should work fine. The receiver is mounted behind the window used for the original tuning dial using a bit of Sugru.
Connection is simple:
To set it up make sure lirc is installed and then load the module:
sudo apt-get install lirc
sudo modprobe lirc_rpi
Then to test the receiver is working do:
sudo mode2 -d /dev/lirc0
Pressing buttons on your remote control should now result in a series of pulse and space messages being displayed, eg.
Now we know the remote control is working we can set up an lirc.conf file for our remote controls buttons.
To do this first shut down lirc with sudo /etc/init.d/lirc stop
Then run sudo irrecord -d /dev/lirc0 ~/lirc.conf and follow the on screen instructions, when it comes to naming your buttons you need to use names from the lirc namespace which you can get a list of by doing irrecord –list-namespace
The irrecord process will generate a file like this:
# Please make this file available to others
# by sending it to <email@example.com> #
# this config file was automatically generated
# using lirc-0.9.0-pre1(default) on Sat Jul 19 14:03:26 2014
# contributed by
# brand: /root/lirc.conf
# model no. of remote control:
# devices being controlled by this remote:
header 9041 4492
one 587 1669
zero 587 540
repeat 9040 2232
This shows the config file for the basic 5 button remote I am using.
Copy this new file over to /etc/lirc/lircd.conf and edit /etc/lirc/hardware.conf to change the line DRIVER=”UNCONFIGURED” to DRIVER=”default”
Then do sudo /etc/init.d/lirc start
From there you can go on to use it as an lirc device. I wanted to use it with Python so the final step was to install the lirc Python bindings with sudo apt-get install python-pylirc
I originally planned to make a little amplifier based on the mono LM386 and the original speaker but by a stroke of luck this nice LM4871 based stereo amplifier board with speakers fell into my lap (saved from going in the bin due to a broken power switch). Just the job. I just bypassed the power switch, removed the 3.5mm jack plug and connected the inputs directly to the Raspberry Pi where the original socket was and connected the power to the 3v3 line. Then it was just a case of sticking the board and speakers under the Pi out of the way (Sugru again) and we’re done.
PyGame User Interface
I am using the finished device to display information from my home automation and monitoring system and have started to create some screens using PyGame. The data is coming in from NodeRED via MQTT and I can use the infrared remote control to switch different displays. This is a lot more versatile and with much better graphics than version 1 and 2 of this display.
Here is an example of some of the (in progress) code I am working on for it.
Just for a bit of fun, here is a video showing the Sinclair TV playing a recording of a News At Ten story on the launch of the Sinclair TV.