Introduction: Toaster Google Assistant & Internet Radio -- a Love Story
Runner Up in the
Raspberry Pi Contest 2017
In the early 1990s, I really wanted a Dualit toaster. Classic-model Dualit toasters were, and are, ridiculously expensive. But they are beautiful creations and worth every penny.
Once you look for them, you'll see Dualit toasters in many British movies and tv shows, signifying something (I'm not sure what) about the characters who own them. In a modest homage to this tradition, you can see my toaster (in its original condition) as a prop in another Instructable, to which this project is tangentially related.
The only thing was, though I cared for it dearly, my Dualit never actually toasted bread very well. It really needed to toast a few slices before getting into the swing of things, making consistent results difficult. Possibly this was a legacy of its origins in commercial kitchens where it would be used all the time, or less than perfect optimization for 120V in the U.S.
Nevertheless, it gave twenty years or so of faithful service, until a combination of circumstances meant it was relegated to the basement closet where I store all obsolete stuff until it becomes useful again. It gathered dust and the aluminum end-pieces tarnished. Once in a while I'd put it on the bench and fire it up, for sentimental reasons, but we now had a coolly modern Breville toaster that was handling toasting duties more competently than the Dualit ever did. And while I will forego a good deal of competence if incompetence is delivered stylishly, Management takes a different view.
I'd been considering using the toaster as an enclosure for a Pi-based internet radio but decided that was too much enclosure for such a modest project. Then Google released the Google Assistant SDK, allowing you, in effect, to make a Google Home with a Raspberry Pi. The two projects have a lot in common, components wise, so it was as if the Dualit had its hand up saying, Pick Me, Pick Me!
If you don't happen to have a spare Dualit Toaster, you may still want to read on if you are interested in deploying Google Assistant quickly and/or want to build an internet radio with a Raspberry Pi. Or if you just like a good yarn in which many difficulties are overcome and friends who have drifted apart are happily reunited.
Step 1: Ingredients
Like many relationships, this one cannot be measured in dollars and cents. Even aside from the toaster, you can buy a Google Home, or the cheaper variants of its rival (Alexa, you tramp) for less than what you'll spend here. Let us therefore set such worldly considerations aside.
All up, aside from the Dualit itself, I spent around $60, including some wasted cost in screw-ups and unnecessary purchases. But I already had a Raspberry Pi and SD card, a birthday present from one of my children (see Step 4). Adding these things in puts the project at a little north of $100. Or $450 with the toaster.
Here's what I used:
- Classic-Model Dualit Four Slot Toaster. The Dualit works as an enclosure because it has plenty of unused real estate inside either end - especially the right-hand side. It is also very easily disassembled/assembled and the slots on either end are good for letting sound and light out. At this point, I should note I disabled the toaster functionality. In my implementation, I felt this was necessary for safety reasons and, as already mentioned, I have another toaster in the kitchen. I think it would have been be possible, and reasonably safe, to keep the Dualit usable as a toaster with a different approach. But in an uncharacteristic departure I took the better-safe-than-sorry route. I did make sure it would be easy to restore the Dualit's toasting ability if that were ever desired. If logic, not love, drives your decision-making, an old portable radio would probably be the best starting point enclosure since many of the components could be re-used more or less in situ (and you may be able to dispense with items 2 and 3).
- Mini digital amplifier - I used this one. Build quality is shocking, even by my standards, but for $10, hard to beat for this purpose.
- A couple of recycled 6 - 8 Ohm speakers (one, if you are happy with mono sound). I got mine from a duff clock radio. Size is obviously the key consideration here. For a Dualit, you want the biggest (diameter and depth-wise) that will fit in the "narrow", left-hand side (by definition, the same size speaker will then fit in the right side also).
- Raspberry Pi 3B.
- Micro sd card - might as well get a 32GB though this project doesn't need anything like that.
- 12V and 5V power supplies. Things that can crank out 2.5A for the RasPi and 4.0A for the amp. I first tried to use this dual voltage supply but it produced horrible noise in the amp and I couldn't find a way to suppress it. I think perhaps the supply was defective but can't recommend going this way. I ended up using separate 12V and 5V bricks I had lying around. Using a single 12V brick and buck converter for the 5V might be a better way to go.
- Microphone. I think the microphone choice is key to making the Google Assistant practical. It needs to pick up voices from across the room reliably and help the software reject spurious sounds. I've had good luck with this Kinobo mic, which I've now used in two Google Assistant projects. You could go with a smaller, cheaper USB microphone but I suspect the voice pickup would be nowhere near as good. Without playing with the sensitivity this mic works at more or less normal speaking levels and only slightly elevated levels if there is a lot of background noise (e.g., the internet radio is on).
- 128x64 I2C OLED display. This is optional but I think is a really nice enhancement to the internet radio - especially if you grab some graphics for your favorite stations. You can also use it to display all sorts of other quasi-useful information to squeeze more use out of your Pi. Displays using SPI are a bit cheaper and supposedly faster but use way too many pins IMO.
- Button switches! If you have read any of my other Instructables you will know I love my switches. I didn't go quite as wild with this project as on others and in fact used only switches I had lying around - some salvaged from old stereo equipment. I would recommend using a couple of nice ones for the radio on/off and station change but the decision is largely aesthetic. In any event, my implementation uses one "locking" and four momentary buttons - all but one for the internet radio side of things - plus an ancient toggle switch, part of a job lot I bought from a mysterious e-Bay seller in Ukraine. I also re-purposed the Dualit's illuminated two/four slice switch (not present on newer models) and trademark clockwork on/off/timer switch. The re-purposing has practical applications, but is mainly so I could continue to use the original controls for old times' sake.
- 3.5mm audio jack splitter, male to male 3.5mm audio cable, male to female audio cable. Your exact configuration may differ from mine so no link here and if you have any of this stuff lying around you can adjust your approach to match what you have. You may also want to use the Pi's USB/HDMI ports rather than the analog 3.5mm jack, which some claim improves sound quality. My experience is that it doesn't make much difference, at least with modestly-priced DACs.
- MOSFET driver modules. Again, totally optional. I used them to control some 12V LED lights intended for automotive use (see next item) that provide more subtle illumination/event cues for the Dualit than is possible with small LEDs powered directly from the Pi's GPIO pins. You don't really need the whole module but they are almost as cheap as building your own MOSFET circuits.
- 12V LED running lights. I love these things (the link is to ones that are clear when off, blue when lit, but I used a couple of red ones too). Very bright so they can be strategically placed in the Dualit and still provide external illumination. Get a whole bunch in various colors - I guarantee you will find a use for them.
- Hook-up wire/breadboard jumper wire, heat-shrink tubing, crimp connectors, misc other consumables.
- Something to polish your Dualit aluminum (obviously optional, especially if not using a Dualit).
Step 2: Tools and Resources
- Multimax Dremel (optional)
- Soldering Iron
- Hot glue gun
- Heat gun (not strictly necessary but I used A LOT of heat-shrink in this project)
- Misc hand tools -- the more the merrier
The picture is of my bench in its natural state. Don't judge me!
I don't usually bother to list these in my Instructables but I use the ones listed below for just about every project (all are free and certainly have many applications beyond Pi projects).
- FileZilla. This is awesome - a fantastic way to transfer files back and forth from your developer computer to the Pi (or for transferring files between any computers for that matter).
- VNC Viewer - After initial set-up, my Pis operate in headless mode and my ability to do much via ssh and the terminal window is extremely limited. The VNC viewer makes the Pi's desktop environment readily available. The server side (VNC Connect) comes with Raspbian so you just need the Viewer.
- Audacity. Great for just about anything you may need to do audio-wise.
- Fotor - Good basic photo editor; for this project it was a very simple way to generate graphic files exactly 128x64 (needed for the OLED).
You could do the Google Assistant implementation straight from the Google Assistant SDK site but I used the code and instructions here. There's an associated YouTube video which is well worth watching too. I didn't need all the features included but it is a lot easier to eliminate features than add them. Follow the steps carefully and the hardest part of this project is taken care of. Thanks so much to "Sid", who published this material! Sid is also amazingly fast and polite in responding to questions, even dumb ones. I made some very small code modifications to the key python files but his implementation is very much a turn-key proposition for this side of the project.
I was surprised there was comparatively little on the interwaves about using the Raspberry Pi as an internet radio. I mean, there's a bunch of projects but nothing I found exactly met my needs. Perhaps the intersection of radio listeners and Pi dabblers is not as great as I imagined, especially expat listeners for whom internet radio is a godsend. The closest project to what I had in mind was in a MagPi magazine from 2015 by the renowned Simon Monk, but even that required a fair amount of code modification to bring it up-to-date and add some desirable features. (As an aside, I just noticed this issue also announces VNC coming to the Pi.)
Step 3: Enclosure Preparation - Part I
You can skip this step (and the next three steps) if you are not using a Dualit toaster as the enclosure, although some considerations apply to pretty much any enclosure you may choose.
In addition to deciding whether you want to retain toaster functionality, there are a couple of other decisions:
- Would you be happy with an external DC power brick? I decided not because I wanted, insofar as possible, to preserve the Dualit's original appearance, even the power cord
- Do you want to have a standalone device with its own amp and speakers, or can you live with outputting line-level audio to an external amp and speakers? Or do you want both?
- If there is space and you are not really trying to do this on a tight budget, going the "both" route is obviously ideal. I went with both, fitting everything in the Dualit as follows:
- Left (narrow) side:
- Raspberry Pi
- MOSFET module to switch the "listening" LEDs
- Four(!) 12V LED running lights (blue) to indicate listening status
- MOSFET module to switch ongoing conversation LED
- 12V LED running light mounted in hole drilled in the front side (this is the most easily visible LED -- more on this later)
- Wiring, including a female 3.5mm jack output mounted in a hole drilled in the rear side
- Momentary buttons for software volume up, volume down and shut down/start of Google Assistant service (mini buttons mounted on a pcb -- you can see them on the top left of the toaster)
- Left (narrow) side:
- If there is space and you are not really trying to do this on a tight budget, going the "both" route is obviously ideal. I went with both, fitting everything in the Dualit as follows:
- Two 12V LED running lights (red)
- Mini amp
- On/Off switch for amp (mounted in hole cut in rear side, also switches the red LEDs that light the element slots)
- MOSFET module to power "speaking" LEDs
- Four 12V LED running lights (blue) to indicate speaking status
- Power supplies
- OLED display (mounted in the cut-out originally used for the two/four slice switch)
- On/Off button for radio
- Station change button
- Existing clockwork timer/on/off control and two/four slice illuminated switch (mounted in the bottom front side)
- Existing two/four slice illuminated switch (repurposed and repositioned as described later)
- Wiring, including the existing incoming AC cord
That may sound like a lot but in fact fitting it all in wasn't too difficult. If you want to preserve some toaster functionality, however, I'd put everything in one side and disable the two slots closest to that side (or at least the end slot). This would probably mean I'd have to use an external power brick and use a smaller amp and speaker (or even eliminate them and rely on external components for sound). Alternatively, (and this only occurred to me late in the project) you may want to disable the two outer slots which might allow use of both sides, though there will still be the issue of heat affecting wiring running between the two sides (manageable, I think, with careful routing).
Step 4: Enclosure Preparation - Part II
Once you've got a rough idea where everything will go, some modification to the enclosure will almost certainly be needed. Again, what follows is specific to the Dualit (and more particularly to early 1990s variants of the Classic Four Slot Model) but similar considerations will apply whatever you are using.
Unplug the toaster. This is important if you want to complete the project, or live until lunchtime.
The Dualit is held together almost exclusively with what appear to be Phillips pan-head #6 3/8in sheet metal screws (the feet are held on by #6 1/2in screws). This is useful to know if, like me, you can't take anything apart without losing fasteners. Apparently, making a Mental Note not to lose screws is not as effective as a proper system to put them somewhere.
All the screws are visible so get busy and remove the feet, baseplate, both sides and the stainless steel center cover. Make a Mental Note not to lose any screws. Head down to the hardware store to buy the replacement screws you will need for reassembly. Make a Mental Note where you put them.
Once apart, inspect the crumbs from bread toasted in a previous millennium, before your now adult children were born. Sigh. Move on.
Photograph the wiring inside the right-hand side and then remove the spade connectors to the rotary timer and two/four slice switch. I include a picture of what I found but your results may vary. Take a moment to marvel at the prelapsarian technology, a household appliance without a single electronic component in sight! Double down and turn the timer. Clockwork!! Consider your humanity as someone about to sully such purity. Console yourself. You are not Harvey Weinstein, or even Matt Lauer. You may not even be a man, in this day and age.
Remove the press-fit two/four slice switch. You will use this cut-out for the OLED. Read my Instructable here. Actually, unless you have a lot of time on your hands, don't do that. All you need to know is that the cut-out is almost exactly the right size for a 128X64 OLED. A bit wide, but nothing that judicious application of insulating tape can't hide.
Pull the timer knob off the shaft (it comes off fairly easily). Feel free to use that line in your next porn novel.
Remove the timer mechanism. (The mechanism is held on with two machine screws of indeterminate size, so don't lose these. Really.)
Step 5: Enclosure Preparation, Part III
In which I relate a cautionary tale and consider human frailty.
What we need to do now is drill some holes for the button switches, drill a hole for the amps's volume spindle, drill a hole for the external 3.5mm jack and, most challengingly, make a new rectangular cut-out for the two/four slice switch, which will be repositioned below the rotary timer.
Now, if you have examined the opening picture carefully, you will be saying "what about the hole for the 'ongoing conversation' LED in the front left side?" The truth is, I never intended to include this. In accordance with my overall design philosophy of minimal change to the Dualit's original appearance, I was just going to have internal LEDs indicate speaking and listening, since one or the other will always be on when a conversation is ongoing. The internal LEDs shine through the slots on either end and, despite throwing off a ton of light, provide quite subtle illumination when viewed externally (unless you are viewing the toaster end-on). This is the effect I wanted.
Unfortunately, with the toaster disassembled, I got the back and the front of the narrow, left hand side, mixed up. Which meant I drilled the hole for the 3.5mm jack into the front of the left hand side instead of the back. This is the kind of mistake that seems incomprehensible in hindsight but which seems to occur in nearly every project I undertake. I felt like the surgeon who has removed the wrong leg. Worse, really, because the bungled operation was on an old friend, now staring mutely up from the bench in full-on WTF mode.
The human brain's compensating plasticity is formidable, however, and whatever gene I am missing that prevents dumb mistakes is offset by an over-developed one for making the best of them. Hence the "ongoing conversation" LED, which I included to fill the extraneous hole (enlarged, obviously). In pictures it can appear a little garish but in fact is a useful indicator, especially in bright sunlight when the internal LEDs may not be visible. Or at least, so I tell myself.
Mental Note: Mark symmetrical pieces. Then mark asymmetrical pieces. Then check you have marked them properly. Make a Mental Note that the Mental Note system is fatally flawed.
Step 6: Enclosure Preparation, Part IV
OK, stay with me. I am very aware the Enclosure Preparation franchise is getting a little tired. I just need to comment on making the cut-out for the repositioned two/four slice switch and the OLED opening.
The good news here is that we are working with aluminum, or more accurately aluminium. And aluminium is... anyone?, anyone?, Beuller? Soft!!
So drilling holes is a breeze, even with my much-abused bits (that's another line for you). And despite what I said here, creating the rectangular hole for the switch can be made with a drill and a file with minimal fuss. It doesn't have to be perfect, since the switch has a frame to hide minor issues. Be careful positioning the cut-out though - there's not much room between the timer knob and bottom of the case.
The bad news is that Dualit did not skimp on the aluminium. It is thick. Not a problem for drilling -- in fact as every cisgender schoolboy knows, drilling a reasonably substantial chunk of metal is easier than drilling a thin sheet -- but it did make the OLED display look a little too recessed. So in a highly optional process, I used a Multimax Dremel to remove a millimeter or two of material from the inside of the case around the cut-out. This took a while but was surprisingly effective, the only downside being it created a giant amount of filings that got everywhere. Getting the display to sit closer to the outside of the case is one of those small details in a project that likely no-one else will ever notice, but provides pleasure because you took the trouble to make the finished product a little better. Doesn't completely make up for cutting off your best friend's good leg, but goes some way.
Guess what? You are done with the enclosure preparation!
Well, unless you want to buff up the aluminium, which I highly recommend, even if you have to buy some buffing wheels and polishing compound specially. I wouldn't be so crass as to refer to this as "work", but there is no shame in looking after oneself, once you reach a certain age.
Jane Austen types can skip to Step 15 now.
Step 7: Prepare the Pi for Google Assistant
OK, let me be real pithy here. No need to re-invent the wheel. Follow the instructions here. As I've already said, this all works great if you implement exactly as written - just follow the comments in the code to customize for your needs. I did make a few adjustments but mostly for personal preferences, such as:
- Disabling the Snowboy custom wake word service:
- Though it is fun, sort of, to ask your toaster to do things by saying "Hey Toaster," I found there were just too many false triggers. In my home office, where things are quieter, I have another GA running with Snowboy which rarely triggers wrongly, even though I often have music or talk radio playing. The wake words are different but I don't think that is the issue. Using "Dualit" cut down the spurious triggers but did not eliminate them and Management expects pretty much 100% perfection in my projects deployed for regular household use. For whatever reason, OK Google and Hey Google virtually never trigger improperly.
- Using Snowboy, the GA couldn't perform some seemingly straightforward tasks - setting a timer for example - and it quickly became tiresome remembering to use Hey Google for these tasks
- Note, you can go ahead and install, enable, and start Snowboy if you want to give it a go. If it doesn't work for you, simply execute a "sudo systemctl disable snowboy.service" command from the terminal.
- Removing PWM on what in the original code is GPIO25 (in my project this is what I refer to as the "ongoing conversation" LED - the one I didn't originally intend to include).
- I found the flashing and brightness changes distracting (perhaps because I was using a much bigger/brighter LED than anticipated)
- Even playing around with the frequency and duty cycle didn't yield satisfactory results - and at least with the MOSFET module didn't yield perfectly controllable dimming either
In reality, these are all tiny tweaks. I didn't even bother to remove a lot of the stuff - for example the servo and relay control - that I had no intention of using (though I did re-purpose some of the GPIO pins used for these functions). Thanks again Sid (and apologies for being so informal with your name -- I'm not sure what your full name is).
Breadboard and test the LEDs and any other GA peripherals before installing in your project.
Download the GA app to your iPhone (this is the easiest way to link all your connected devices (Philips Hue, NEST, WEMO, etc to your Google account). Android users will already have done this, I assume.
Step 8: The Internet Radio, Part I
The "Tune In" command to play internet radio stations via Google Assistant works fine with the exception that the GA as implemented is unable to distinguish "four" and "for". This would be a minor issue if it were not for the fact my most-listened to station is BBC Radio Four -- which the GA stubbornly refused to play until I mapped it to "Radio 5" (Sid identifies this problem too).
However, you don't always want to be asking your toaster to play the radio so for me some dedicated functionality was essential. Not "essential" as in air and water, perhaps, but up there.
I code like an English major -- that is I find something as close to what I need as possible, shamelessly copy it, then write any modifications in something as close to plain English as the programming language allows. I assume anyone who has put their code on the interwaves is OK with the copying part of that, since that saves me the trouble of reading the license.
My three requirements for the internet radio were that it function as...an internet radio, that it have a simple control interface, and that it have some sort of display. The MagPi Simon Monk project was the closest I found, and in fact used an I2C 128x64 OLED, which was my preferred display choice.
Follow the instructions in the MagPi article unless specifically noted below. There is a link to my final code in Step 9 which depending on your desired feature set may be a better starting point than the MagPi code.
Here are the major modifications I made:
The display library Dr Monk uses has undergone some significant changes since 2015 so a visit to the repository and careful reading of the documentation will be rewarded (at the very least, use my import statements, not the ones in the MagPi code). Also, my radio script is written using Python 3.5 so make sure you follow the directions for the Python 3 install here. Well, I say that but I think I found a mistake in those instructions regarding when to use pip3 versus pip so if you don't get a clean install the first time (or get a "Module not found" error when running the program) try again until it works. Sorry for not being more specific about that, I just don't remember what the exact problem was.
Visiting the repository is a good idea anyway because there are some great examples there. I ended up using a modified version of the time and date clock example (didn't need the analog display) and developed my core function to display graphics from the pi_logo.py example.
The MagPi code uses the display to show information parsed from metadata of the radio stream that is playing. I had no real interest in that - I doubt it would work reliably and even if it did the OLED display is just too small to display a lot of readable text unless you are right on top of it. Installed in the toaster, you are unlikely to be looking that closely at it.
Instead, my idea was for the display simply to show the playing station's identifying logo. This has a certain (limited) wow factor and meshed with the fact the display would show the Dualit logo when the radio was off.
A few Google image searches supplied suitable logo images and these I cropped and reduced to 128X64 in the Fotor editor. High contrast B&W images work best (I increased the contrast of those that had more greyscale). The code assumes all images are in the same folder as the script so if you want them in a separate folder you'll have to adjust the path appropriately.
If either the "volume up" or "volume down" button is pressed, the display shows a corresponding standard icon and two other "amusing" graphics when max and min volume is reached.
When the radio is off, the display alternates between internet-provided time/date and the Dualit logo, modified to have a little dig at the Breville toaster (and by the station change button, a dig at our dumb-as-a-box-of-hammers dog, Neville). The clumsy iterative checking if this button has been pressed is solely to ensure it works immediately.
Finally, turning the rotary timer (which originally also turned on the toaster) triggers an audio apology for lack of toaster functionality and an associated graphic.
Clearly, there's a bit of fluff here, driven by my weakness for whimsy and anthropomorphizing favored appliances. You will doubtless wish to eliminate some or all of this fluff and replace it with evidence of your own folly.
Step 9: The Internet Radio, Part II
Control - Station Change
The code in the MagPi project uses a single momentary button to cycle up through the pre-programmed stations, before returning to the first station when the number of pre-programmed stations is exceeded. I originally considered using a rotary encoder for station change (it would make going up or down easier) but in the end couldn't be bothered to modify the code. Also, it would require another external knob which violated my "minimal external change" design philosophy. My radio has only nine pre-programmed stations, which comprise 99% of my listening. If I wanted many more, I probably would go the encoder route, or at least provide a station change "down" button.
Control - Volume
The MagPi project code has no volume control. You might not need this if you are going to use the digital amp's volume knob but if you want control over the line-out level you really do. Also, I didn't want a volume knob to be visible so I installed the amp so it projects from the rear of the case, along with the amp's on/off switch. This has several advantages - it makes it less likely someone will turn down the volume, thereby rendering the GA useless, and preserves the Dualit design aesthetic. Also, it was slightly easier to fit the amp in the enclosure by placing it toward the rear. Last, in my implementation, the primary sound source comes from a sound system integrated into our kitchen, the volume of which is controlled by a wall-mounted iPad (or your phone). While nifty, this isn't the most convenient way to change volume, so it is much better to leave the system volume fairly high and attenuate with the control on the radio itself.
Coding the volume control wasn't as easy as I thought. First, I needed to install the python 3 alsaaudio library (use "sudo -H pip3 install pyalsaaudio") and then fiddle around a bit with the code to get it to work (assigning a fixed value to volume was easy but incrementing required converting the value to an int, which I assumed it was in the first place).
Control - On/Off
Again, the MagPi Code doesn't have this, I assume because it is intended to function more as a development project than finished article. To function as closely as possible to a traditional radio, however, an on/off button is necessary. My python script loads on boot so what the button is really doing is changing the display logic, and starting the mpc player. I used a latching button, because I happened to have one of those that has a nice blue LED halo when "on". You could also use a momentary button with a small code modification.
My code is here. I am painfully aware it it highly sub-optimal but it seems to work very well without taxing the Pi and doesn't mess up the GA side of things. I'm also sure there are many other ways to implement - possibly using packages already installed as part of the GA project. But if you want something that works, there it is. The folder contains all the graphics and audio files used in my code so it will work pretty much unmodified.
Step 10: The Internet Radio, Part III
The fun bit is adding your own favorite radio streams. Follow the steps in the MagPi article for how to add stations to mpc, but not where to find them, and don't use the sample streams since most if not all don't work any more.
I used vTuner to find what I needed.
Follow the vTuner link, search for stations you want, right click on the "Play" button and choose "Open Link In New Tab". Verify you have the right station when it plays, then copy the address straight from the address bar into a document you should preserve for reference. Only then go ahead and add the streams to mpc (you can also use this process to customize the "actions.py" file with your favorite stations on the GA side).
Last, I use some mp3 files launched with mpg123. If you don't have this installed type "sudo apt-get install mpg123" into the terminal. Or just re-process into .wav files using Audacity and use "aplay" in the code. Or just delete them, since they are optional.
I think that is enough of that. I included a few comments in the code to fill out the above.
Oh, nearly forgot: to load the script on boot do this:
- In the terminal type "sudo crontab -e"
- Add this line to the end of the file (changing the path to the launcher file as necessary): " @reboot /bin/sleep 10 ; sh /home/pi/Radio/launcher.sh"
Step 11: Installing Components, Part I
Refer to Step 2 for where I placed the components I used. No photos because all you would see is a pig's breakfast of wiring. For the button and amp placement, you can see where I put them from pictures of the outside and the rest of the bits and pieces I stuffed in as best I could. Even if you are using a Dualit, you may want to do a little re-positioning. Some notes, however, may be useful (and the order in which everything is populated is quite important):
Timer Mechanism and Two/FourSlice Switch
Put the timer back where it came from. Put the switch in its new, lower position. These go in first because they are quite big and can't be moved around. At this point you really need to decide whether you want any toaster functionality or not and reconnect any original wiring accordingly. As mentioned, I disabled the toaster. This I did by disconnecting the three wires (two red "hot" wires and one blue "neutral" that went to the element bus bars), and disconnecting the hot and neutral incoming from the timer switch. The incoming wires you will use for the AC side of the power supplies, but run through the two/four slice switch which will now be a main power on/off switch for the power supplies. The short brown wire is a hot wire that allowed switching of the second pair of elements and can be removed completely (but put in a safe place). I left all the other disconnected wires in place (to allow easy restoration of toaster functionality) but insulated all exposed terminals. Whether or not you are keeping the toaster as a toaster, make sure the ground wire is still firmly attached to the terminal on the enclosure.
Here I need to add my customary admonition: you are messing with potentially lethal stuff here, so do not attempt unless you know what you are doing. If you are not comfortable, you can still complete this project by using external power bricks that remain isolated from the incoming 120V of the toaster.
I used small nuts and bolts to secure these to the upper part of the side so they played through the slots (most speakers will have mounting holes in the corners). Make sure it does not vibrate against the metal case at high volume.
This is perhaps the trickiest bit. First, insulate the inside of the enclosure around the cut-out (I'd recommend a couple of layers of insulating tape). Next, with the display on, align the display in the cut-out and tape in place. Once you are happy with the alignment, fix more solidly with hot glue. Once again, I refer you here. If you get the display even slightly crooked it will bug the heck out of you so this is one step not to rush. You might want to try mounting with screws but I think that would be difficult unless you are real handy (I am not).
This is probably the most difficult component for which to find an optimal place. In fact, I ended up removing the heat sink and sawing off an inch or so to allow clearance. In a classic gangsta move, i screwed the sawn-off bit back on to the re-installed heat sink back-to-back, hopefully preserving most of the original heat-sinkability.
These are bulky so need to be positioned now, if not actually fixed in. If you have a dual-voltage supply designed to be installed in a case (like the Meanwell I first tried) it will eventually need to be screwed to the enclosure securely. Fully enclosed bricks can be just hot glued in place and connected to 120V as you see fit, depending on their design (wall wart or corded on the AC input side).
Wire up the buttons before installation. Check operation, especially any illuminated buttons like the LED halo button I use for on/off. Then install.
This is small, so can be positioned anywhere you have left over space. Insulate the underside if it could come into contact with the case or other conductors. Actually, insulate it anyway.
12V "Listening" LEDs
Wire up in parallel and distribute as you see fit. I didn't fix them down since by now there isn't much room for them to move around and precise placement is of little consequence.
"Google Assistant Service" LED Indicator
This is mounted in that little hole above the rotary timer (you may need to enlarge the hole slightly depending on the size of LED you are using). Don't forget to use a suitable current-limiting resistor (330 or 220 Ohm is fine, if you need to be told). Hot glue in place.
Step 12: Installing Components, Part II
Apart from a bunch of wiring between the two sides, all that goes here are the two 12V red running light LEDs. These are switched using the digital amp's on/off to show when it is on but more importantly provide a really nice red illumination to the slots - very subtle, like the elements are on and toasting. This was a simple touch I added late in the project but is now one of my favorite features. Position the LEDs below the toast lifting tabs so the effect is not super obvious and the light is diffused nicely. Hot glue in place.
Step 13: Installing Components, Part III
Same deal as for the right side.
I stuck some anti-static foam on the enclosure with hot glue then stuck the Pi onto that with some more hot glue. A little dab'll do ya, and in fact you don't want it too secure since you may need to re-position it or remove it to access the SD card etc. And make sure you tack it in a spot where there will be room to connect the USB mic, and audio out cables.
In my install, the three buttons on this side (volume up, volume down and GA on/off) were cut from an old PCB that had a couple of mounting holes I could use to screw them to the case (don't drill through when making the pilot holes). As before, wire up the buttons before installation and check operation.
Same deal as for the right side "Listening" module
12V "Speaking" LEDs
Same deal as for the right side "Listening" LEDs.
12V "Ongoing Conversation" LED
Install through pre-drilled hole. Hot glue in place.
I haven't mentioned placement of this before because it is largely up to you, even if using a Dualit. I placed mine on the front left , super-glued to the crumb tray. This is optimal for pick-up though it is highly visible. You could try hiding it more but this is one time when I think functionality wins out over aesthetics.
Step 14: Wiring It All Up
OK, nearly there!
Except there is a shed load of wiring to sort out.
First job is to attach jumper wire to all the GPIO pins you are using on the Pi. Here's a Great Tip:
- Find a Pi 3 Pin Layout diagram. Do the same for other devices/MCUs you use.
- Paste the diagrams into a two-page document and print on a couple of letter size sheets.
- Laminate back to back (Staples will do a heavy-duty job for about $3). This will become an invaluable, durable reference for this and future projects.
- Make a few and you have a world-class set of reversible nerd placemats.
- Congratulations, you will never have a girlfriend. You are welcome.
Anyway, since most if not all the jumper wire will not reach its intended other terminal, strip and tin the non GPIO end to prepare adding wire of the requisite length. For most of the wires that need to run from one side of the toaster to the other, I used an old data cable that had 12 conductor strands. No idea where it came from. You could also use a couple of ethernet cables (8 conductors each). This will work for anything coming off the GPIO header. I doubled up the ground, 5V and 3.3V runs to the other side because, well, it seemed like a good idea. Attach lengths that are way more than you need so you can route the cable and connect everything up with the toaster still disassembled and test everything one more time before putting it back together.
Keep track of what is connected to what since you are unlikely to be able to keep colors consistent between the jumper wire and the data/ethernet cables. Quite out of character, I used a spreadsheet, where I also captured some other useful information (attached, in case you want to use a similar form).
You need something a bit more substantial for the speaker runs, 12V power to the MOSFETs and lights, and 5V power to the Pi, though nothing is carrying much in the way of current.
In the Dualit, there is a channel on either side of the slots to tuck the wiring into. If preserving toaster functionaility, though, I think I would route the wire externally under the baseplate. It still wouldn't be visible and it would be further away from heat from the elements.
Last, reconnect the AC power wire to the 12/5VDC power supply through the two/four switch so it illuminates when on (check the pinout with a MM). Don't wire so the neutral and hot can be shorted! Double check you have this right.
Check everything one last time, especially for exposed wiring. Say a prayer if you are that way inclined then stand back and plug in. At this stage success is no fire or explosion. Outstanding success is no blue smoke. Some or all of it working is a f@#*&!g miracle. I suppose miracles do happen, but not in my projects. So unplug and check your wiring again. Fix dumb mistakes/faulty connections and repeat, not forgetting to do the unplug thing each time. So, you know, you can have lunch.
Step 15: Reassembly & Epilogue
Unlike most things, including relationships, the Dualit goes back together as easily as it comes apart. Of course, you will need to run down to the hardware store again because you lost the replacement screws you already bought, but you knew that going in.
With any luck, everything will still work after reassembly but if not (perhaps you can guess my experience) it is easy enough to take apart again. After a while, you will be surprised how quickly you can do this.
Just when it seems impossible, a day will come when the Dualit is in one piece again and it all works. Buff it up one more time and proudly place it on your kitchen counter. Get ready to bask in the admiration and amazement from friends and family.
Wonder why they are staring at their phones.
We have a be nice policy.
Please be positive and constructive.