Introduction: 1930s Kodak Pi Notification Lamp
This is a 1930s Kodak Table Viewer that I've adapted to display notifications and alerts using a range of bright colours. The light source is a Unicorn pHAT, a programmable matrix of bright LEDs, and this is controlled by a Raspberry Pi Zero W, which checks for incoming Gmail instructions using a simple Python script.
In case you can't see the embedded video it's on YouTube at https://youtu.be/B_vkmmcb0_M
Step 1: Mystery Viewer
I picked up this Kodak slide/negative viewer at a sale recently for £10 - more than I usually like to pay for a conversion project but it had such a great look that I couldn't resist. Normally I do a bit of web research before tearing a piece apart, just for curiosity and to get a feel for its original function, but I didn't get very far! Having trawled Google images and old photography catalogues the only similar model I came across was an Ebay listing, asking around £600 for the viewer.
I have no idea if that's a fair price or not but decided for this project that I'd attempt a non-destructive conversion, so that it could be always put back into its original state. This turned out to be a smart plan as the viewer is made exclusively of glass and metal, so any hacking around would have risked ruining an irreplaceable component.
I decided to stay fairly true to its original function and replace the light source with a modern LED array, hoping this would be bright enough to glow nicely and project at least some light through the viewer lens onto a wall.
Step 2: Old PHAT
I've experimented with the Pimoroni Unicorn pHAT (Hardware Attached on Top) before, in the ill-fated sequel to my Rabbit Pi project, so it immediately sprung to mind when I started thinking about LED options. The LEDs are bright to the extent of having a health warning and are easily programmed using Python, so this was the ideal choice, also I knew I had one - somewhere.
The pHAT I had "in stock" turned out to be a non-starter however, as I'd already soldered a 40-pin header to it and that made the assembly too thick to fit in the viewer. I wanted the pHAT to sit where you would normally put a slide or negative, but unfortunately this gap was only about 7mm.
Looking around on the web I found that the Unicorn pHAT only really needs to be connected to three of the Pi's GPIO pins (5v, GND and GPIO18) and this was a real life-saver - it meant I could solder in single right-angle headers to just those pins on the board and keep the profile nice and slim.
I dismantled the metal slide aperture (teeny screws!) and lightly glued the pHAT to the back of it, so that as many LEDs as possible would shine through the lens. It all went back together nicely, so now it was time to start looking at the code.
Step 3: Listening for Colours
Rather than just sit in the corner as a mood light I wanted this to be a connected, interactive lamp, so set about pulling together some code to get the Pi Zero online. I re-used the code from my Talking Radio project as a starting point, which uses a Python script to check incoming Gmail messages for a specific character string. After installing the necessary code for the Unicorn pHAT I adapted some examples so that the Pi would light up the pHAT in different colours depending on the subject text of the Gmail message it received, for example if the word "green" was included it would light the LEDs green for 30 seconds.
The code I used is on GitHub - please excuse my Python noobness!
Once the script was working properly I saved it into the /home/pi folder and set it to auto-run on boot by adding the line:
@sudo python /home/pi/kodak.py
to the end of the file:
The GitHub code lights the LEDs in a single colour at a set brightness, with some "rainbow" and flashing variations, depending on what word is received via Gmail. There are loads of other options for different colour effects included in the Unicorn documentation. With the code working "headless" the Pi Zero was ready to be disconnected from its monitor, mouse and keyboard and fitted into the viewer.
Step 4: Pi of a Cylinder
The back part of the viewer originally held the bulb and its holder, and was conveniently big enough for a Pi Zero, as long as it had no extras attached (hence choosing the W version with WiFi built in!). The back of the cylinder locked in place with just a twist, obviously to make changing the bulb easier, so I decided to keep this feature and attach the Pi in place of the bulb holder.
Although there appeared to be lots of room the cylindrical shape meant things were pretty tight, so I needed to find a way to hold the Pi securely in the very centre. After a few experiments I cut out a section from a translucent plastic box with a rotary tool, drilling holes so that it could be bolted to the "back door" and the Pi.
At this point I realised that none of my micro-usb cables were small enough to fit inside the cylinder while plugged into the Pi's power socket. I considered powering the Pi from the GPIO pins, which is apparently do-able but slightly risky as it bypasses a protective fuse, and also thought about right-angle plugs, but finally I just carefully trimmed down one of my existing cables with a craft knife, which did the trick. I routed the 3 cables from the Unicorn pHAT through one of the existing vent holes, and these were just long enough to connect up nicely before sliding the pi into the viewer.
I'm really pleased with how this part of the project came out, it's satisfying and practical to be able to slide out the pi to connect up a monitor & keyboard if I need to.
Step 5: Smartening Up
With everything built it was time to make this fancy lamp a bit smarter! With the Gmail script running I could control the light just by sending a message, but I wanted it to be more automated.
I've used the IFTTT (If This Then That) service in a few projects now, and it's definitely my go-to guy for IoT automation. If you've not used it before it's kind of an online hub that lets you link together multiple online services, using Applets to control how they interact with each other.
For the examples in the video I used the Google Assistant and Gmail services, for example defining a specific Google Assistant phrase for the "IF" component ("Go to Red Alert") that sends a Gmail message with the Subject "redalert". The script on the Pi only looks for emails from a set address with specific words in the subject, so when it receives the "redalert" message the script tells it to flash the Unicorn pHAT's LEDs red for 30 seconds.
The above is a basic example, others I have in use at the moment are:
- Flash Red if my phone battery gets below 15% (Android Battery Service)
- Light up Green if my MotionEye camera detects motion (Maker Event Webhooks Service)
- Light up Purple if my Motorola camera detects motion (Android Device Notifications Service)
- Light up Blue if it's about to rain (Weather Underground Service)
- Light up Orange at Sunset (Weather Underground Service)
- Light up Cyan if I'm mentioned on Twitter (Twitter Service)
There are many possibilities and more options are being added all the time, so its well worth experimenting and scrolling through the long list of available services.
Step 6: Regular Viewer
This project turned out to be a lot of fun, especially having the extra challenge of not irreversibly altering the original piece. I just love that big lens on the front, and the way the whole thing can be angled and tilts open. It's pretty portable (though heavy) and only needs a single USB plug for power so it's nice to try it in different locations.
In a darker room it projects a decent pool of light onto the wall or ceiling, but even in a lighter area the front lens glows brightly to keep you informed.
We have a be nice policy.
Please be positive and constructive.