Introduction: Recipe of the Day Toaster
I purchased the Adafruit Thermal Printer a while back thinking it would make for a cool and fun project. It took me several months of thinking about potential projects and how I could utilize this mini receipt printer until it finally came to me. I'm always looking for new recipes whenever I make my grocery list and I constantly find myself typing "easy weeknight recipes" into google just to endlessly scroll and scroll. I thought what better way to directly get unique and different meal ideas than to have the Thermal Printer print out random recipes from the internet. On top of that, I wanted to make a fun enclosure for the printer and I ended up going with a functional toaster design.
So, whenever I am interested in searching for a new recipe, I press the handle down just as you would when making real toast. The LED on the front panel turns on indicating that the brain of the toaster (Raspberry Pi) is hard at work "toasting" up a recipe. And finally, the thermal printer prints out a recipe where the toast would pop out and the LED turns off signifying that the recipe "toasting" is complete! A section of printer paper displays the recipe name, cook time, a spoonacular review score (more on that later), and a QR code. If I am interested in the recipe, I easily scan the QR code with my phone and navigate directly to the source website. Additionally, if I like the recipe and either want to scan it later or save it for the future, I can store it behind the front panel of the toaster!
This project turned out to be a blast to make! I find myself pressing the toaster handle at least 3 times a day, once for each meal, just to see what recipe pops up. And the best part is that you can print whatever you want! A simple change of the code would allow you to print a recipe review or maybe the ingredients needed to make the recipe! Finally, I chose the color scheme of my toaster to match the scheme of my kitchen but that would be a simple fix as well should you want a different color!
- DC barrel/power jack connector x 1
- Red LED x 1
- Mechanical limit switch x 1
- 470ohm resistor x1
- PLA filament (I used both black and white for my project)
- Wooden skewer or metal rod
- 3-4 spring loaded pens
- Potentiometer knob
- Spray Paint and Primer
- Wood filler (optional)
- Wire cutters/strippers
- Soldering iron/solder
- Hot glue gun
- 3D printer (optional)
- HDMI cable/HDMI mini adapter for connecting raspberry pi (optional)
- Keyboard and mouse for connecting raspberry pi (optional)
- Monitor for connecting raspberry pi (optional)
Step 1: Setting Up Raspberry Pi and Testing the Printer
Set up the Raspberry Pi Zero W: There are plenty of tutorials out there on how to set up a raspberry pi but a simple and straightforward site that I found useful was from the raspberry pi website. I also utilized a monitor, mouse, and keyboard for this project (rather than going headless) as it just helped me in preparing and testing the code. That is not necessarily needed should you want to replicate this project. Your other options are to ssh into your pi or utilize some VNC viewer. Note: in the image I am using a raspberry pi B+, but for the final design I switch to a raspberry pi zero w.
Connect and test the thermal printer: You can connect everything as I have shown in the schematic but this step will be to ensure that the right software for the thermal printer is downloaded and that it is actually functioning. Adafruit has a really nice thermal printer IoT project that describes how to connect your Thermal Printer to your raspberry pi as well as installing the correct printer driver. This is what I used when I began my project and it is very helpful. Once powered up and connected, you'll be able to test your printer by running "python printertest.py" from the command line in whatever directory you saved the Adafruit Thermal Printer folder. Your printer should print the standard "first test" receipt.
Step 2: Spoonacular Food API and My Python Code
I'll be the first to admit that I have a very basic knowledge of coding, especially with using Python because I was not taught on that. However, the best way to learn in my opinion is through trial, error, and google and that is exactly how I put together my code. It may not be the prettiest or even the best way to go about things but it ended up doing exactly what I wanted it to do and that was my goal. Feel free to download and tweak my code however you like! I will just run through my rationale and thought process here and then explain how to test my code.
Spoonacular.com and your API key: Spoonacular.com was crucial for this project. It is a food API that makes searching for specific recipe information and getting the data incredibly easy. They have over 360,000 recipes from various food websites on the internet and make it easy to search for whatever you want. For example, you can get recipe summaries, random recipes, recipe instructions, etc. They have excellent documentation on how to call specific API functions as well.
You'll need to create a login in order to generate your personalized API key. It is FREE to do so up to ~150 requests per day. Once logged in, copy your API key and save it for when we go through the python code. You will be pasting your key into the code. Refer to the image above that shows where to find your API key and what section of code to paste it.
My Python Scripts: First, download both script files onto your raspberry pi and into the same folder as your "Adafruit-Thermal-Printer" folder from the previous step. Additionally, from the command line type "sudo pip install qrcode[pil]". This will ensure that you have the proper qr code library installed from PyPi. The "Cooktest.py" code is the main code that searches spoonacular for a random recipe, obtains its summary information, and prints out the desired information to the thermal printer. The "ButtonRecipe.py" code is the ultimate code that I call from the command line that listens for the limit switch to be pressed, turns on the LED, runs cooktest.py, then turns off the LED.
- cooktest.py generates a random number up to 360,000 and uses that number to index spoonacular's recipe library and obtain that specific recipes summary information. I then parse/separate the data into the variables that I want to print. I also generate a qr code based on the recipes source url. I then print everything out on the thermal printer. Make sure you open up this code and paste your Spoonacular api key into the required section. You can either call "nano cooktest.py" from the command line and change it from there or open up a program like IDLE.
- ButtonRecipe.py is the code that I run from the command line that puts everything together. It listens for the switch to be pressed, turns on the LED, and runs cooktest.py.
Test the code: Ensure all components are hooked up properly from the last step. From the command line, change directories so that you are in Adafruit-Thermal-Printer folder that also contains my two scripts. Type "python ButtonRecipe.py" and hit Enter. Now press the mechanical limit switch and the red LED should turn on. In about 10-20 seconds, your thermal printer should print out a receipt with the qr code similar to what I have displayed in the picture. Assuming everything works accordingly, you are ready to 3D print the enclosure!
Step 3: Toaster Design and 3D Printing the Parts
In order to create the toaster enclosure for my printer, I began by searching different toaster designs. I did not particularly care for the traditional square box type toasters and I wanted to create something slightly more smooth and modern looking. I came up with the design above in Fusion360 and was happy with how it turned out! A couple of things that I added into the model are worth mentioning. I made sure to include a front hole and an opening in the back for the LED and DC jack connection respectively. I created a little groove on the side that the handle could fit through as well as areas on the base plate and lid that I could mount rods to support the handle. I also added an area right behind the front plate on the right side that I could slide recipe of the day receipts into in order to store them. That slot is big enough to store ~20-30 receipt slips.
Another added benefit of this design are the front and back plates. I chose to print them out in a different color than my toaster body. This gives me flexibility should I decide on changing the color scheme in the future. All I have to do is print out two new face plates and mount them onto the toaster!
Feel free to print out your parts in whatever color scheme you choose! I've also included the fusion file should you want to tweak my design!
Note: I printed the toaster lid upside down as a way to save on filament and time. The top of the lid however did not print as smooth as I would have liked, even with printing on a raft. I tried to smooth out the surface in the upcoming steps but just keep that in mind when printing out your pieces.
- My Printer: Maker Select Printer V2
- Nozzle: 0.4mm
- Filament: Black and White PLA filament 1.75mm
- Slicing Software: Cura
- Printing Temp/Build Plate Temp: 215C / 60C
- Print Speed: 60 mm/s
- Enable Support: Yes, everywhere
- Build Plate Adhesion: Raft
Step 4: Toaster Handle and Painting the Design
Toaster Handle: I wanted to simulate actually pressing a toaster handle down when calling for a recipe and having the handle pop back up. The easiest way I came up with was by incorporating small rods fitted with pen springs. In the images, I show using a wooden food skewer that I broke up into two ~70mm long pieces. However in the final design, I switched out the wood for two metal rods (of ~4.0mm in diameter). This resulted in a much smoother action of the handle.
Regardless, find 2-3 old pens and obtain the springs. Make the 2 rods by cutting down the wood skewer or metal to size (~70mm). Place one in each hole on the toaster base and add two pen springs to one rod. Place the handle, as shown in the image, so that it lines up with the rods. Place the toaster lid on top ensuring that the two rods align on the top holes of the lid and that the handle is through the midline. You should have a functional spring loaded toaster handle!
Painting the Toaster: I wanted to create a shiny metallic finish on the toaster body to bring it out somewhat so I purchased primer and a metallic finish spray paint. I started by sanding the base and lid going from a coarse grit to a higher grit of ~220. I followed the instructions on the primer and applied 3 coats. I still wasn't satisfied with how smooth the top of my toaster was so I applied wood filler and sanded that down once dry. I then added 2 coats of the final metallic finish to the toaster per the spray paint instructions.
Now onto wiring and final assembly!
Step 5: Wiring and Toaster Assembly
Wiring the Components: I wired everything together as I show in my wiring breadboard and schematic. Two separate (+) and (-) wires coming off of the DC jack terminals for both the printer and raspberry pi. I added a bit of length to the wires connecting both the limit switch and LED as they would need to wrap around the printer in final assembly. Once everything was soldered and connected, I performed one final test by plugging in the 5V 4A power supply into the DC jack and running my program. After seeing a recipe pop out of the printer I was on to final assembly!
Final Assembly: I started by warming up the hot glue gun and adding a few drops to the bottom of the thermal printer and placing it in its designated area on the toaster base. I then used a generous amount of hot glue to secure the DC jack into place. I applied some double sided sticky tape to the back of the raspberry pi and secured it on the back side of the thermal printer. I then placed the limit switch in between the two push handle secure holes and hot glued that into place. Finally, I ran the LED wiring around to the front side of the toaster using electrical tape to secure it to the printer and then pushed the LED through the front hole of the toaster lid. I used hot glue to hold it into place as well. I then placed the handle rods with springs in their respective holes on the base and added the toaster lid. Next was adding a touch of hot glue to the top corners of each panel and placing them on the front and backsides. The final step was hot gluing the potentiometer knob onto the front as a final touch! And just like that the toaster is finished!! All thats left to do is plug in the power supply and either ssh or VNC into the pi to start the "ButtonRecipe.py" code from the command line.
Now, anytime that you're looking for a recipe or just want to see what kind of meals the internet has to offer, just push the spring loaded handle down and wait for the Recipe of the Day Toaster to toast up a meal! Thank you so much for reading my instructable and happy making!
Runner Up in the
3D Printed Contest