LED Toast/Toaster With Distance Sensing
by Kevin_Ciardelli in Workshop > 3D Printing
199 Views, 1 Favorites, 0 Comments
LED Toast/Toaster With Distance Sensing
Hi my name is Kevin Ciardelli and welcome to my instructable for the LED Toast/Toaster combo fueled by distance sensing! Throughout this instructable you will learn the process into creating this fun and decorative machine which incorporates tons of different tech elements. The project includes 3-D printing, laser cutting, wood working, and coding in python. Let's get crafty as we dive into making this interactive piece!
Materials/Supplies Used (All Links Are Examples of Products Used)
- Circuit Playground Express(1): https://www.adafruit.com/product/3333 (Installed with CircuitPython
- Arduino Nano RP2040 (1): http://store.arduino.cc/products/arduino-nano-rp20.. (Installed with CircuitPython)
- Breadboard (1): https://www.amazon.com/Breadboard-Point-Solderles..
- Push Button (2): https://www.amazon.com/Latching-Button-Switch-Wat...
- Micro Servo (2): https://www.adafruit.com/product/169
- LED Strip (30-LEDS): https://www.adafruit.com/product/3811
- Time of Flight Distance Center with STEMMA-QT(1) cable: https://www.adafruit.com/product/3967
- 8 jumper cables for breadboard: https://www.adafruit.com/product/3142
- 3 Alligator Cables: https://www.adafruit.com/product/1008
- PLA filament used for 3D printing (schematics included farther down)
- 5''x6''x1/8'' piece of wood (3)
- 12''x24''x1/8'' piece of Acrylic used for laser cutting
- Power bank to power the cpb
- Micro usb data cable to put code into cpb and arduino
3D-printing
The step will most likely take the longest, so it is better to start with this and complete the following steps as the print completes. First, we will print the outline of our piece of toast. My design that I used is located here: https://www.tinkercad.com/things/3jQkfOBBde2-toast.... These are the exact dimensions that I proceeded to use. The piece has to be so large due to needing room for all the electronics that will eventually go inside. My print on the Prusa mini took around 8 hours on 15% infill. Our second print will serve as a base within the "toaster" which will also serve as protection for the Arduino Nano RP2040. This model can be found at this url: https://www.tinkercad.com/things/lvsPiXz1Z2Y-cool-....
Woodworking
I didn't want to take a lot of time 3D printing the toaster itself, so I decided to make it out of wood. The dimensions are 6"x5"x1/8" (3), and it is easily assembled with some wood glue, nails, pins, or anything else you can think of (I used wood glue and a pin gun). I proceeded to stain mine with some nice wood stain to make it look a little fancier, however it is not required at all.
Laser Cutting
In this step I wanted to create a translucent border around the piece of toast, so I created a template with the exact dimensions as the 3D print from earlier and used the etching functions to create that translucent effect. 2 of these were made for both sides of the toast. For the other pieces, these will serve as look through walls around the toaster (wood) from earlier. Match the dimensions for the border of the toaster (seen in picture) for the walls with extra holes for both your input power wire for the arduino and a 1" by 1.5" gap for the distance sensor to see through. The top piece matches the dimensions of the border along the top while having a 5 1/4" by 2 1/2" slot for the toast to slide through. Just use a hot glue gun to adhere the pieces where they belong.
Coding in Python With Mu Editor
These files are the code I used.
Toast (CPB with Circuitpython):
Essentially the code run through sets up all equipment used surrounding the cpb. The code then proceeds to check the debounced button to activate the toast. From there on, it will remain neutral until the button is pressed and thus, the light sensor will begin getting readings above two thousand due to the LEDS turning on. With those readings, the distance sensor will now begin producing values between 1 and 30 which leads the function light_timing to determine how fast the lights go from white to red to emulating a fire. After it reaches red, a fire animation will play. All this can be reset just by pressing the button twice again.
Toaster(ARDUNIO NANO RP2040 with CircuitPython):
This code implements two servo motors and a debounced button. When the button is pressed the servos switch to an angle in which the toast is allowed to drop (check orientation when building and match angles to your own orientation), and will return to initial angle when pressed again.
Circuitpython: https://learn.adafruit.com/welcome-to-circuitpytho...
Mu editor: https://codewith.mu/
Assembly
Toast:
Attach wires to correct outputs on the cpb based on the code you received earlier (Stemma QT to stemma ports, led strip to A1, button to A3). In the setup section of the code you can find in both files what pin outs are associated with which device. Cable management is very important throughout this piece due to a shortage on size. Matching up the distance sensor with its hole and the button with its hole is a must using tape and hot glue to keep them in place. The only other placement which is nice to have is the leds to be facing outwards to actually see the lights change. I hot glued one side of my acrylic in order to help get an idea on what the cable management was going to be when assembling. After you have your wires where you want them, slide the power cable through the hole at the bottom and attach it to the cpb. Hot glue the power battery to the bottom of the toast.
Toaster:
I then proceeded to attach the Arduino nano to the bottom of the support base for the servo motors using tape. Feed your servo wires up the existing holes and go ahead and tape or hot glue those servos in a place where you believe the toast can sit. The dimensions are snug for both the support platform and the toast print just a warning. From there I recommend plugging your arduino in to make sure the servos are working properly. The button associated with this will be inserted anywhere on the acrylic wall for the toaster, so make sure you have enough slack/wire from the arduino to reach it.