The Commadorable 64

Update Aug 28th: The BOM for all variants is now on Github. Please see the notes at the end if you want to build a Commadorable 64 yourself.

The ILI9341 based QVGA displays found on eBay for €4 are well suited for making small screenlets telling the current temperature, weather forecasts, traffic situation to work and spreading them over the house. As PCB design is both fun, cheap and rewarding I did a custom PCB for these tiny displays. Actually, I made three, one for each of the 2.2″, 2.4″ and 2.8″ screens. The 2.8″ version has not been produced but the smaller variant have and work well. From 2.4″ and onwards there is (untested) touch support on the screen modules.

The “Hello World” application for this project also named the PCBs. I call them Commadorable 64. Here is why:

LEGO Stormtrooper added for size reference
LEGO Stormtrooper added for size reference

The cursor blinks but I resisted the urge to create an animated GIF. “Commadorable 64” is a play with “Commodore 64” and “adorable”. It has been scientifically proven that those for whom the Commodore 64 played a significant part of their childhood will look at the 2.2″ version of the C64 start screen and react the same way as cat people looking at kittens. Heads will be tilted slightly sideways, smiles appear and sounds like “naaaaaaaw” will be heard. I have one of these at work and depending on childhood experiences people will either go “what?” or “naaaaaaw”.

ESP side
ESP side

The PCB is soldered directly to the pins of the ILI9341 module. Some of these screens will probably end up in other applications in the future. The other day I read about openframe.io and adding support for these would be fun.

The PCBs can be ordered from DirtyPCBs.com, 2.2″ with a bonus AAduino and 2.4″ version with touch. The BOM consists of the usual components for my ESP8266 designs. We have 0603 resistors and capacitors, a 3x6x2.5mm momentary push button [eBay] for displaying the IP address, a SOT23-3 P-mosfet to control the backlight, an LM1117 voltage regulator and a SOD-123FL schottky diode for reverse power protection and optional mini USB connectors. The PCB can be powered in three different ways depending on personal preference (well, four including the esprog interface). There are footprints for normal [eBay] and vertical [eBay] mini USB connectors, depending on if the module is to stand on a table or hang from a wall (Eagle parts available on Github). In addition there is a 0.1″ header for power. All power paths are protected by the diode.

Further update Aug 28th. I see some 20+ orders on DirtyPCBs for both Commadorable 64 variants which is great fun and I would really love to hear what you will build. I have some recommendations you might find useful. I have received a few broken ESP-12e/f modules on eBay over time and one broken ILI9341 module. Because of that I always try the modules before soldering them using my Esparducam board with the ESP Pinlet add on board. When a module passes testing I flash it with the ESP Open RTOS OTA basic demo meaning I can OTA any device directly after soldering. Also, you will note there is no FTDI connector on these boards, the reason is described here. As UART output is still useful, I have one “development” variant with leads from an FTDI connector soldered to the GND/RXI/TXO esprog pads. Oh, and I also have one Commadorable 64 board with a female header for testing the ILI9341 modules before soldering them. If you have any questions about building the boards, sound off in the comments below.

Code and schematics on Github, as always.

ADS-B skygrazing

This is a followup to my previous post about bringing life back to an old Macintosh Classic II.

Having an iconic Mac with a Raspberry Pi inside doing nothing is kind of dull. I wanted the Classic to display something interesting (at least in my point of view) and I did have another Raspberry Pi in the attic receiving ADS-B data and posting to an MQTT feed. How about showing a picture of the nearest aircraft with information about its speed, heading, altitude, distance, bearing and so on?

Without diving too much into the details about ADS-B, what we get from the aircraft is basically speed, heading, altitude and a 24 bit identification number, the icao24. This is a globally unique aircraft ID registered with the International Civil Aviation Organization and we somehow need to convert this into an actual image of the aircraft.

The aircraft’s operator, type and registration are not available in the ADS-B data the aircraft transmits and needs to be pulled from another data source. One excellent source is PlaneBaseNG with about 147k aircrafts. The database consists of an SQLite database which serves us well. Once we have the aircraft type and operator we make a Bing image search and pull an image of suitable size.

The system architecture looks like this, with data flowing from top to bottom

ADS-B receiver
ADS-B client
Proximity radar
Skygrazer

The ADS-B receiver is a Raspberry Pi with an RTL dongle running dump1090.

ADS-B client is a Python script parsing data from dump1090’s feed on port 30003, converting it into a JSON object, adding aircraft data from PlaneBase and publishing on the MQTT topic “`/adsb/radar/json“`.

Proximity radar is another Python script subscribing to “`adsb/json“` while keeping track of which aircraft is the closest one. It calculates distance and bearing, performs image lookup and publishes on the MQTT topic “`adsb/proximity/json“`.

Skygrazer is an application written in SDL2 subscribing to the topic “`adsb/proximity/json“` that downloads and displays the image and flight data received.

The architecture might seem like an overkill but I like the publish/subscribe idea of MQTT, it is a bit like Unix commands. Each one performing one task (and performing it well) and several commands may be chained to create something bigger that the sum of its parts. It also lends itself well to other ideas I have of how to have fun with ADS-B data.

Here is an image of the Classic in action with an A380 from Emirates passing by.

A380 Classic
Airbus A380 image from Wikipedia, Quentin Douchet CC BY-SA 3.0

The project turned out nicely. The Classic runs 24/7 and since the airspace over the southern tip of Sweden is quite busy there is always something going on. I have almost gotten to know some of the aircrafts and flights around here. A quick glance on the Classic and I can tell I am looking at the Air France A380 from Charles de Gaulle to Tokyo. Nerdy huh?

Update! Checkout further use of the ADS-B data in “Commercial pilots control my moonlight“.

Code available here and here on Github.

Another Raspberry Pi powered Macintosh Classic

The Macintosh Classic is somewhat special to me as it was my first computer I used for other things than just games. Not suprisingly perhaps as the line games was somewhat limited although there where classics like Dark Castle, Apache Strike, Empire and Deja Vu. That aside, I have had a Mac Classic II in my study for years reminding me of where my career in IT started and it was time to pour some life into the old machine (click for hires images or see the gallery at the end).

Hello (again and again)
Hello (again and again)

The obvious choice was to use a Raspberry Pi. Placing Pis in old macs is by no mean a new idea but I wanted to make something different and above all make something as sturdy as the old mac. The newly born Mac should be able to ride the bus as my old Classic did at times meaning I could not just put loose hardware into the box. Things needed to be fastened. I set out with the following specification:

  • Raspberry Pi
  • TFT screen
  • Speaker
  • Internal USB hub
  • External connectors for USB and ethernet
  • Working programmer’s key and reset button
  • Working floppy drive ejector motor
  • External 12V power supply

I had found this 8 inch TFT screen on eBay (update June 5th 2017, I have found a much cheaper variant on AliExpress that by the looks of it is identical) but as you can see the frame has no mounting support. Adding the cabling and driver board with its adapter boards sums up to quite a mess. How do we mount this nicely inside the Classic? Plexiglass to the rescue! I cut out two sheets of plexiglass and placed the TFT screen between them. Glued piexes of plexiglass on the back sheet keeps the TFT screen from falling out. The different boards are placed on spacers mounted on the back side plexiglass sheet. The front and back sheets are held together usings screws.

An 8" HDMI display package
An 8″ HDMI display package

The final part was mounting the “screen module” inside the Classic. As I had thrown the old CRT screen out, it was only a matter of drilling the right holes in the plexiglass screen module and mount it the same manner the original screen was.

Mounting the display package
Mounting the display package

Next was the mounting of the Raspberry Pi. For this I reused the hard drive bay where I mounted a piece of plexiglass holding the Pi on spacers.

Pi, power and speaker
Pi, power and speaker

I wanted to bring back the yawning like sound of a Macintosh ejecting a floppy disk. The idea was to have the Mac automatically eject an inserted floppy with a delay. So how did the old Macs detect the precense of a floppy disk?
There are a number of micro switches sitting in the front of the floppy drive. These will be pressed (or not) when a floppy is inserted into the drive. From right to left they will tell us

  1. Is there a floppy present?
  2. Is is write protected?
  3. Is is a single sided or double sided floppy?
Adding blue and white wires for floppy presence detection
Adding blue and white wires for floppy presence detection

<side note>Floppy disks back in the days had a write protect switch on them consisting of a small piece of plastic that would open or close a hole. An open hole indicated that the floppy disk could be written to. Another hole in the floppy disk indicated if data would be written on one or both sides of the disc. Switches 2 and 3 above would be not pressed if the corresponding hole was present on the floppy disk.</side note>

For this project, I only cared about switch #1. Deciding the floppy drive would never see real action again, I disconnected the switch from the rest of the floppy drive PCB by severing the traces. Soldering wires to the switch and attaching them to the Raspbery Pi GPIO header, the Pi could now sense the precense of a floppy disk. Next was the ejector motor. It runs on 12V (as the TFT screen) and I purchased a relay on eBay that the Raspberry Pi could control.

On the left hand side of the old compact Macs was the programmer’s key and the reset button. The former would enter the debugger built into the computer. I wanted to connect these to the Raspberry Pi so once again I severed some traces. On the the motherboard this time.

For power, I purchased a 12V to 5V converter with quad USB output on eBay. This together with the relay was mounted on a sheet of plexiglass that was mounted on spacers in the back of the computer. The speaker was mounted in a large hole i drilled in (you guessed it) a piece of plexiglass mounted on (guessed it again?) spacers. As the sound quality on the original Raspberry Pi was quite poor I added a USB sound card (also from eBay). I desoldered the microphone connector on the Mac’s mother board and replaced it with a power jack that I connected to the 12V/5V converter. An old Western Digital USB disk power supply provies the 12V needed.

Last but not least, I added two external USB ports and an ethernet port. Both use passthrough cables found on eBay (search for “USB 2.0 A panel mount extension cable 25cm” and “ethernet panel mount extension cable 25cm“. They are mounted on the last piece of plexiglass that is glued to the inside of the case. I reused the holes where the original 220V power cable connector and power switch where located.

Backside USB and ethernet connectors
Backside USB and ethernet connectors

A simple python script checks the programmer’s key, the reset button and the floppy detection switch and controls the eject motor. Pressing one of the keys will play the lovely old Macintosh Quadra chime. A long press will shut the Raspberry Pi down.

Floppy ejection was a bit tricky. The eject motor is a simple motor and not a servo meaning you cannot tell it to goto a position and back like those servos you have been playing around with using your Arduino. The motor needs to return to (roughly) its original position or it will be impossible to insert a floppy again. I have no idea how this was accomplished back in the days but this simple algorithm (based in parts of my recollection of the old floppy sound) did the trick

  1. Start motor
  2. Wait for lost floppy presence
  3. Wait for 1 second
  4. Stop motor

I am quite pleased with how this mod turned out. There is nothing loose inside the case that can fall over, get tangled up and cause shorts. By accident, the Mac was drop tested from a height of one meter. It survived, nothing came loose.

I have some future plans for HW modifications including a touch screen, replacing the clicking mechanical relay with a transistor and I should add a fuse to the 12V line for safety.

Most of all, I need to add software to make the old Classic actually do something. But that is for a later post.

Update 26th of June 2016, the python script running the show is now on Github.
Update 5th of June 2017, added AliExpress link to cheaper display and eBay links to USB/ethernet passthrough cables.


Gallery