We might be having too much fun with our Glowforge at Elmwood. After making our pretty but static rainbow sign, I thought I'd try some simple animation using the same construction technique. Since we already ♥ Flying Toasters, I reused its three frames and etched them into acrylic:
Lit from below with three green LEDs, it's not too bad an animation for a proof of concept. While you might not want to make one exactly like it, here's the technique I used. All the plans and code are on Github at scruss-elmwood/edge_lit_toaster.
Firstly, I cut and etched the three frames out of 3 mm clear acrylic from this graphic:
(source SVG here: edge_lit-toaster.svg)
You'll note that the toasters are facing the opposite direction from the animation. This is deliberate, as etching the images on the back of the acrylic makes for a clearer result. It also means that the front acrylic layer appears smooth.
The three frames are then sandwiched together and held together with small nylon bolts, either M3 or M2.5. You might find it helps to put a little black electrical tape at the top and bottom of each frame, as otherwise the light from the LEDs can bleed through to the wrong frames.
The slots in the bottom of the frames take a green 3mm LED. If you're making a permanent installation, use a drop of cyanoacrylate glue to hold them in place. I made this little box out of 3 mm ply to hold the frames together:
(source file: little_toaster-case-plain.svg, modified from a design made on MakerCase)
It's by no means a work of art, but it has a nice aperture to show off your animation and bolt holes on the back to hold the frames together.
I used a Trinket M0 to drive the LEDs, but I've also provided code for Arduino-like devices. The circuit's very simple:
The positive (longer) lead of an LED is connected to ports 0, 1 & 2 on the Trinket M0. The negative (shorter, next to the flat on the LED case) leads all run though a single 330 Ω resistor to GND. For extra brightness, you could use as low as a 68 Ω resistor for a 3.3 V system like the Trinket M0, or 150 Ω on 5 V systems like traditional Arduinos.
We want to light the LEDs in sequence 12321232 … to show the toaster's wings flapping. Here's the CircuitPython code to do just that:
# CircuitPython 2.0.0 - Trinket M0 # 3 led bounce: # LED anodes to D0, D1 & D2 # cathodes common thru 330 Ω resistor to GND # scruss - 2017-10 - for Elmwood import board import digitalio import time leds = [ digitalio.DigitalInOut(board.D0), digitalio.DigitalInOut(board.D1), digitalio.DigitalInOut(board.D2) ] for i in range(3): leds[i].direction = digitalio.Direction.OUTPUT led=0 delta=1 while True: leds[led].value = True # on print("LED %1d on" % (led)) time.sleep(0.4) leds[led].value = False # off print("LED %1d off" % (led)) led = led + delta if (led != 1): delta = -delta
(link: main.py)
Or if you prefer to use an Arduino:
/* 3-led bounce for edge-lit flying toaster circuit: three LEDs connected to D5, 6 & 7 with cathodes common through 330 Ω resistor to GND converted from MicroPython to Arduino scruss - 2017-10 - for Elmwood Electronics */ int led = 0; int delta = 1; /* Sketch relies on three adjacent digital IO pins. Doesn't much matter which IO pins, they just have to be numbered consecutively. basepin is set to the lowest-numbered pin, so if basepin = 5, we use D5, D6 & D7 */ int basepin = 5; void setup() { // D5, D6 & D7 outputs pinMode(basepin + 0, OUTPUT); pinMode(basepin + 1, OUTPUT); pinMode(basepin + 2, OUTPUT); } void loop() { // light LEDs every 0.4 s in sequence 01210121 … digitalWrite(basepin + led, HIGH); delay(400); digitalWrite(basepin + led, LOW); led += delta; if (led != 1) { // reverse direction if at highest or lowest LED // (world's simplest Larson scanner …) delta = -delta; } }
(link: edgelit_toaster.ino)
This little toaster's flying calmly on my desk even as I write. Have fun!