James West

May include blinky lights. And cocktails.

Negroni

Venice is sinking. I know, because I’ve just come back from there and it’s awash with a million bottles of Aperol, which are slowly dragging the island city into the lagoon. I had my first Aperol Spritz at a bar in Campo San Barnaba, and it’s a good drink. You have to be careful to specify Prosecco rather than soda water or you get a slight disappointment (you can never be properly disappointed in Venice) but the spritz is a sweet refresher after a day on your feet, or a jolly aperitif before lunch.

Still, it’s a bit of a soft drink. For a more robust kick-start you should go with a Negroni, and the Negronis in Venice are excellent. It’s a simple recipe; equal measures of Campari, gin and vermouth rosso. Making them at home I’ve foolishly been mixing my Negronis in a shaker (stirring though, never shaking) and then pouring them into a glass. Clearly this is madness. In Venice everyone built the drink in its glass with satisfyingly large chunks of ice and maybe giving it a bit of a twirl with a straw before chucking in a good size strip of orange peel.

Back in Campo San Barnaba, at the Bar Ai Artisti the stir was definitely DIY and my first pull through the straw was a jolt of neat Campari. Once I’d sluiced it around the drink was excellent and sitting with Lucy sipping our drinks and nibbling from a bowl of crisps at the back of the bar was a great way to pass half an hour.

Enjoying a slurp of Negroni at Caffe Brasilia
Enjoying a slurp of Negroni at Caffe Brasilia

In central Venice, between the Rialto Bridge and Saint Marks we sought out Caffe Brasilia. It’s the local bar of Nathan Sutherland in Philip Gwynne Jones’ entertaining books which I’d been reading before we set off to Venice and which you could use as a guide book. The bar was on a corner of the narrow Rio Tera dei Assassini, and given its central location was quiet and modestly priced.

The best Negronis we had in Venice were in the tiny bar of The Hotel Olimpia, where we were staying. Strong, cold, oh so red and served with care and attention by waiters who doubled duty as porters and really deserved their tips.

We’d a great short break in Venice, and when I visited the Ferrovia I was reminded that the dangerously delicious Inamorata was inspired by the railway journey from London (gin) through Paris (Cointreau) and on to Venice (Prosecco). You’ve got to have an Aperol Spritz while you’re there, it’s the foundation of all bar life in the Venice at the moment. But don’t miss out on the Negroni.

Adding Twitter control to a bubble machine

I got a bubble machine for a fiver at The Works with the idea that I could control it somehow from a Raspberry Pi Zero W. It turned out to be quite a simple hack, with satisfying results.

Before adding any bubble mixture I turned the machine face down and took the six small screws out of the back so I could get the case open. Inside I found an electric motor, which turns the bubble paddles and drives the bubble-blowing fan and the back of the battery box. There’s quite a lot of empty space inside too, which means it’s not hard to squeeze the Raspberry Pi in there.

I de-soldered all the existing wires and replaced them with a short pair of wires from the battery compartment and another pair from the motor’s terminals. The original circuit included a button at the top of the case, which I’ve by-passed. I used my hot glue gun to fix the button-press in place at the top. I used the motor controller board from my CamJam Robotics kit to connect everything to the Pi, hooking the motor up to the “Motor A” terminals and power from the batteries to the VIN and GND posts (taking care to ignore my badly chosen wire colours). It’ll be interesting to see how much of a battery hog the little motor is.

Pi Zero W and CamJam motor controller in place and connected to power and the electric motor.

I drilled a 10mm hole in the back of the case and elongated it with my Dremel to allow me to pass a Micro USB connector through which supplies power to the Pi. I used one of these extenders so I can use a proper power supply or a USB power pack if I want to take the bubble blower outdoors (and of course I will once summer comes!)

As far as hardware goes that’s it, so I wrote a few lines of python with GPIOzero which supports the CamJam Robotics kit. This made the coding side of the project super-simple, which I like very much. It really did take just a few lines to prove the Pi was controlling the motor and letting me remotely blow bubbles.

Bubbles powered by @Raspberry_Pi pic.twitter.com/WdMxsxC7gt— James West (@jameswest) April 7, 2019

For the final touch I wanted to let anyone set the bubbles going by watching Twitter for the #blowbubbles hashtag. I recycled the code I wrote for the Tea Time Klaxon, so again it was quick and easy to get this going. The complete program is here if you’re interested.

Greet trick-or-treaters with this Halloween skull

Halloween is the time of year when makers add LEDS and sound effects to cheap goodies bought at pound shops and supermarkets.

I saw this skull in my local Asda, and thought it was ideal for a bit of modding. The cranium is quite rigid, and as it’s hollow there’s room to put stuff inside it. I used my Dremel to drill a 3mm hole in each eye socket, and to cut a square out of the bottom to allow access. I threaded orange LEDs through the hole in the base to each eye hole, and secured them in place with a dollop of hot glue, which also gave the LEDs a nice diffuse look inside the eye socket.

The plan was to have the eyes gently puslsing and to make spooky sound effects play as trick-or-treaters approached. I have a PIR detector in my box of bits and so I connected it to a Raspberry Pi and used the examples from the gpiozero documentation to write some code to use the sensor as a trigger. I’d tried using this sensor before for something and couldn’t get it to work, and again it defeated me. I’m sure there’s a trick to setting the sensitivity pot just right on these things, but I couldn’t make it work so chucked it back in the box for another day.

Instead I decided to add a button so the trick-or-treaters can scare themselves by playing the sounds if they’re brave enough! The illuminated arcade button that came as part of the Google AIY kit with issue 57 of the MagPi was perfect!

Sounds are played with a Pimoroni Speaker pHAT (I love these). I got the audio files from a Spooky sounds CD I bought at Woolies years ago. It plays just over an hour of gruesome sounds, and I edited a few short samples from it to use here.

Having got the electronics and software working I made a stand out of plywood, drilled holes for the button and to allow wires to pass through into to skull, and painted this black.

Paint it black

Once the paint was dry I put all the bits together. Having glued the LEDs to the skull earlier I had to take unfasten them now to let me hide the Raspberry Pi underneath the stand. Threading the wires from the Raspberry Pi, through the top of the stand, into the skull and then into the small holes in the eye sockets was tricky, but some patient fiddling about helped me get there. Really this is just a new version of the box of horrors I made at Halloween a couple of years ago, just don’t tell anyone I’m recycling my ideas!

Hyperpixel cocktail recipe kiosk

We're never going to finish that bottle of Creme de VioletteIt all started when we saw this lovely cocktail cabinet in a vintage shop. I said we could only buy it if we actually used it for booze, and not to store the usual crap a family of four hides in their cupboards.

Deal struck, we brought it home and have since enjoyed mixing and drinking cocktails at the weekend. It’s been fun finding a collection of drinks we enjoy, but we have recipes in books, recipes on my Notes app and recipes squirrelled away on bits of paper. There has to be a better way – and this is it!

I put a Hyperpixel 4 from Pimoroni on top of a Raspberry Pi and wrote a Python program using Laura Sach’s guizero library. Guizero lets you create simple graphical environments, and even for a learner like me it’s very accessible with clear documentation and examples.

My code is here on Github. The functions at the top are called for each relevant PushButton press, and the stuff at the bottom is the nuts and bolts holding together the app layout. I wanted to use photos as the background to the recipes as much as possible, these are stored as .jpg files which are called to fore when you press the button for that drink. As I remember to take more photos of the cocktails before we slurp sip them I’ll add more pictures to the backgrounds. The Hyperpixel display is great: it’s clear, colourful and the touch works well, even with my tiny buttons. By default the “bottom” of the screen is where the power plugs into the Raspberry Pi, and as I want to hide the plug away behind my little kiosk I used Pimoroni’s simple instructions to rotate the display 180 degrees, which moves the power connector to the back.

The Hyperpixel4 is small; it’s just a shade larger than the Raspberry Pi itself, but crams in 800 x 480 pixels. Even so, every line you display counts. My app looked great on screen but the title bar was using vital space. Despite reading the guizero documentation I couldn’t work out a way to make the title bar disappear, so I tweeted Laura and was delighted when she replied with a solution for me. Simply put, guizero is a friendly wrapper for a more complex Python library called Tkinter, and you can use those methods to modify objects in guizero. It just took one line of code, which Laura included in her tweet, but it made all the difference to how my programme looks on the Hyperpixel.

Open with Python Launcher

I wrote this program entirely on my Mac – there’s no GPIO interaction, nothing requiring the Raspberry Pi hardware at all, so I wondered if I could also regularly use this on my Mac without having to launch it from Terminal. A quick Google search led me to this page where I found out that with Python 3 installed it’s easy to right-click on a Python file and choose Open With -> Python Launcher. I dragged the icon onto my Dock and it opens when I click on it – just like a real app! I changed the power off button to a quit button so I don’t keep shutting down my laptop, and now I can easily browse these cocktail recipes on my Mac or on my little touch screen Raspberry Pi kiosk.

Rotary phone jukebox

I’m at the age where things which were normal in my childhood are now described as vintage; cars, furniture, radios, and telephones.

I got an old BT rotary dialling phone from eBay a while ago, and have been hanging on to do something with it. We did use it as a phone for a while, but the handset speaker wasn’t great quality and the ring was so loud it made us all jump. This phone has two push-buttons on top – one stopped the bells ringing and the other was labelled “Recall” but didn’t seem to be working – at least not as I’d expect a button labelled recall to function.

I think my phone is a BT model 8746, having been wired with a plug-in jack at the factory. There are lots of websites with detailed information about these old phones which can help you identify the model you’ve got, host circuit diagrams and have useful repair and maintenance guides. Sam Hallas’ site is wonderfully detailed and britishtelephones.com was also useful. There’s also quite a bit of prior art with Raspberry Pis and rotary dialling phones, and I read these helpful posts from Dan Aldred and Giles Booth.

With the lid off

This is what I found inside the phone after I got the case off. I used this diagram to work out where the handset earpiece connected to the board, and the terminals for the handset cradle switch. Using croc clips I connected the dial to the Raspberry Pi’s GPIO and used Dan Aldred’s code to try to read the pulses. I got nothing, which was a bit worrying. I knew the dial was doing something as I used Giles’ LED trick to be able to see pulses. Next I connected the LED to the Raspberry Pi and wrote a few lines of code to make it flash from the GPIO. Nothing again, so I found another Pi (a 2B lurking unused) and tried again. This time the LED flashed and once connected to the phone’s dial I was able to count some pulses, so I diagnosed a dead GPIO on the Zero W and ordered a replacement – the 2B was never going to fit inside the phone!

Although I was now detecting pulses, the Pi was returning inconsistent results. I wasn’t going to be able to accurately report the number being dialled. So I abandoned the crocodile clips and cut the terminal connectors off the wires in the phone and soldered them to the Pi. I had hoped to be able to keep the phone in reasonably original condition so it could be returned to use as a telephone, but as this now wasn’t going to be an option I was free to get a bit more hacky with the phone. The transparent push-buttons on top of the phone looked like they’d make great light pipes so I hot glued an LED into the bottom of each one. These I connected to 3v from the Raspberry Pi via the two-way switch on the cradle, so when the phone is on the hook one lights up red until you pick up the handset when it switches off and the other button lights up green.

Ready to put the case back on

With the dial soldered to the Raspberry Pi I got a cleaner signal from the dial and could now reliably read the number dialled. I added some code to Dan’s example to play a different .wav file for each number between 1 and 9. Dialling 0 switches the Raspberry Pi off. My code is here if it’s helpful, but out doesn’t add much to Dan’s I’ve chosen songs about phone calls or phone conversations, starting with Hanging on the Telephone by Blondie when you dial 1. To get the audio from the Pi into the handset I used a Pimoroni Speakerphat and wired it straight into the handset, having identified the wires for the speaker from the circuit diagram. The output was a bit too loud, so I soldered a 1k resistor into the circuit which made the volume more sensible.

At the moment the music carries on playing even after you hang up the receiver. I should have a go at using the hook switch to stop the playback, but I’m not sure I can squeeze many more wires into the space – it’s surprisingly cramped inside those old phones, despite how big the look from the outside!

The tea time klaxon

We’re lucky enough to have two teenage boys in the house. One of them lurks in the gloom of his bedroom listening to loud, raucous music and doing god knows what on his computer until he can be lured out by offers of food. But sometimes the music is so loud, or the headphones so firmly clamped that he doesn’t hear the call of “Tea time!!!” wafting up the stairs. I could go up to his room to get him, but this is the 21st century and there has to be a better way.

That better way is the Tea Time Klaxon.

Now I just need to send a tweet featuring the secret hashtag to trigger flashing lights and a buzzer to alert the eldest that tea is ready.

Actually, I’ve wanted to find an excuse to make something with one of these LED towers for ages, because they just look so cool, and recently they’ve been discounted at Pimoroni which gave me a good excuse to get one. The tower needs 12v DC so you can’t drive it directly from a Raspberry Pi. Instead I bought a power supply from Amazon – this one, I think and a Pimoroni Automation pHat to handle the switching.

I made a little plywood stand to hide the gubbins, which looks quite neat with a couple of coats of varnish. Inside you can see the Raspberry Pi Zero with Automation pHat hot glued into a corner.

Internals

I wasn’t sure how easy it would be to get the pHat and LED tower talking to each other, but Pimoroni’s python library for the pHat is excellent. It’s simple to read and is well documented so even a non-coder like me can get going with it very quickly. I borrowed a bit of code from their Blinkt! library to help look out for the hashtag on Twitter and was soon ready to go.

My final code is on GitHub, and you can see that it really is straightforward.

I enjoyed making this, it turned out to be much simpler than I first expected. It’s meant as a bit of fun because both our boys are lovely really, even though one does occasionally text us from his room rather than actually come and speak to us.

Agua de Valencia

Why wouldn’t you make a jug-full?

This is a refreshing jug of instant sunshine. You might think a mix of orange juice, gin, vodka and Cava is only a summer drink, but you’d be wrong. As a reminder of warmer weather on a dark winter night this is just the job, and as it’s so refreshing it might help if you over do it with the winter warmers.

Agua de Valencia is really easy to make. You’ll need a jug that’ll hold about a litre. Pour in a wine glass full of orange juice, add a little dab of sugar, 50ml1 each of gin and vodka and top up with as much of a bottle of chilled Cava that’ll fit in your jug. Pour immediately into wine glasses and get on with it. When you’ve served your first glasses you can top the jug up with any Cava that’s left in the bottle.

We first came across this on an episode of Travel Man when Richard Ayoade and Sara Pascoe enjoyed the drink in Valencia, and had to have a go at making it ourselves. It’s a lovely drink, and I’m sure we’ll also be enjoying this outside in the summer months.

#inventadvent submission – Father Christmas’ naughty or nice detector

Seasonal hacking inspired by Les Pounder is now officially a thing. Invent:Advent asks you to spend no more than a tenner in pound shops and add that to crafty/makery things you’ve already got lying around to make festive Christmas hacks.

So here’s my go. I bought a wooden Father Christmas with a spinning panel in his belly to let you to show whether you’ve been naughty or nice, several strings of LEDs powered by 2 AA batteries and a sparkly reindeer. I decided to make Father Christmas a bit more high-tech in his approach to declaring your behaviour status, and to give him a less binary choice. The plan was to press a button and see just how you’ve behaved appear on a screen.

For this hack I’ve used the Father Christmas and a set of the LEDs (although a second set was sacrificed to some careless snipping). I raided my box of making bits for a USB power bank (I could easily have afforded to get one at Poundland, but I knew I already had this at home), a Raspberry Pi Zero W with Pico HAT Hacker, a PaPiRus Zero e-ink display which formerly ran a Twitter display, one small button with a red cap, hook-up wire, some left-over transparent red Perspex and lashings of hot glue.

I took the spinning panel out of Santa’s tummy and found the PaPiRus Zero was a good fit vertically, but left a gap of about a centimetre at each side. I used the left-over acrylic to fill the gap and create a mounting plate I could bolt to Raspberry Pi onto. I drilled a hole through Father Christmas’ nose (sorry) to fit the button. Signal and earth wires for the button were soldered to the Pico Hat Hacker and then to the button. The LEDs were also soldered on here, after I’d worked out which lead was positive and which was negative and shortened the train of LEDs to fit.

Everything (the transparent red acrylic holding the Pi Zero and Papirus Zero, the USB power bank, and all the LEDs) was hot glued into place. I’d already written the code and tested it while I was prototyping the hardware so all I had to do was fire up the Raspberry Pi and press the button – err, nose, to set Santa into action. I’ve made about ten statuses that Father Christmas might give you, but you can have as many as you like. They’re all delivered to the screen as black and white bitmap images which are 200 x 96 pixels.

This slideshow requires JavaScript.

Cocktail lamp

On holiday in Menorca this summer I loved these bottle lamp-shades at a bar in Mahon’s old fish market.

Bar, at Mahon fish market

They look lovely, and I thought they couldn’t be too difficult to make.

As ever, YouTube is your friend and there are lots of videos showing various methods of cutting bottles. I had fun sourcing a trio of attractive and different bottles (drinking the booze is a definite plus point for this project, but please don’t attempt any making when you’ve had a drink) and decided to use a diamond cutting wheel on my Dremel to do the glass cutting. I half expected to shatter a bottle or two as I got the hang of this, but actually it went quite well and the bottles all cut quite neatly. I’m not going to write up how to do this, there are dozens of blogs and videos describing good techniques, but I would definitely advise wearing eye protection, a face mask and long sleeves if you use a rotary tool like I did – small shards of glass flew all over the place.

Having cut the bottles the edges needed grinding and sanding to smooth off any bumps and sharp edges. It takes a while to get really nice results, so spend as long as possible to make the cuts look neat.

I ordered a ceiling rose with three outlets, some lovely sparkly braided cable and three bulb holders from Creative Cables UK and waited for them all to be shipped from Italy. My bulb holders are hidden by the bottles so I got plastic ones, which meant I could use two-core wire without an earth. Metal holders look nicer if they’re going to be in sight, but don’t forget to connect the earth to them with three-core cabling. I wired up the bulb holders, slipped the bottles over each cable and connected them together in the ceiling rose with a terminal strip. Then I swapped my new lamp with the existing one in the front room (where the cocktail cabinet is…). If you’re at all unsure what you’re doing, get an electrician to help, and please make sure you switch off the circuit breaker for your lights at the consumer unit before you make a start.

Ceiling roses are always too small for the stuff inside them, but after the usual struggle I managed to get it secured to the ceiling and when I turned the power back on to the “ground floor lights” nothing went bang or let out smoke.

Boozy bottle lamp

I’m pleased with the result of this. I had considered longer wires and making a spider display with the individual bottles spread out across the ceiling, but I think they look nice nestled together. The bulbs are filament LEDs so strike a good balance between looking good, having a long lifespan and being energy efficient. The edges on my bottles aren’t quite as clean as the ones in Mahon, but unless you look closely they’re good enough.

If I did it again I’d spend even more time grinding, sanding and polishing where the cuts had been made. The base of the prosecco bottle makes a nice small dish for nuts or olives and the bottom half of the Martini bottle is now a straw dispenser, so I’ve been able to make use of most the bits of glass I didn’t need for the lamps.

Maintenance update: learning by fixing

It’s nice to think the things we make just work and will just keep on working, but obviously that’s not a realistic expectation. This week I’ve been back to two projects that needed a bit of love and attention.

I got both projects up and running again, and along the way learned a couple of things which will help me as I do more making.

The first problem was that the yellow LEDs on my global status indicator had stopped working. A quick look at the circuit showed all the connections looked sound, so I shorted across the button connectors to see if there was a problem there and the yellow LEDs all lit up.

Having diagnosed a problem with the button and checking I had a spare in my box of bits, I desoldered the connectors so I could pop it out of the map. Then I decided to try the button again, while it was out of its snug mounting hole. And of course it worked.

Old button works now its not snugly mounted in the frame.

What I think happened is that the hole I’d cut in the board was a bit too tight and was pinching the moving bits of the button that peek out of the sides, stopping something inside the button working properly. So I rotated the button 90 degrees, stuck it back in the map and checked it was going to work before re-soldering the connections to it.

What I learned: components stop working for lots of reasons, not just because they’re broken. I could have saved myself some time by just trying to reposition the button in its hole before starting to take things apart.

The second problem was a corrupt SD card on the Raspberry Pi running my desktop Twitter ticker. I know corrupt SD cards can be a problem for Raspberry Pi users, but until now I’ve never experienced it. When I built the case for the ticker I did consider making the Pi Zero W inside accessible, but that needed more steps and I just wanted the thing finished, so I glued the last panel in place rather than drilling pilot holes and finding some screws to close it up.

Now I used my Dremel to make pilot holes while the case was still in one piece, then levering from the bottom where any screwdriver marks wouldn’t hurt so much I managed to prise the back layer of plywood off the case fairly cleanly.

Raspberry Pi Zero W inside the Twitter ticker.

Then I managed to wriggle the Pi out of the case, reformat the memory card and flash a new OS to it using Etcher. Then I installed Twython and copied my code across and tried to run it. Of course it didn’t work because I’d forgotten to also install oauthlib.

It still didn’t run because I’d forgotten the Pimoroni one line installer for the ScrollpHat HD.

So eventually I got it working and screwed the case together.

Now includes screws!

I learned two things from this fix: if I’m going to blog about how I build these things I should be more comprehensive in writing up the software requirements, and I shouldn’t put Raspberry Pis in cases that aren’t easily openable.

« Older posts

© 2019 James West

Theme by Anders NorénUp ↑