Actually, I started this project last October. In my spare time, I help organize a Python meetup in Orange County and we didn't have a speaker lined up for the month. Being that it was the Halloween season, I offered to build something fit for a costume. Luckily, I had an LED ring and a CircuitPy board laying around, so I thought an Arc Reactor would be just perfect.
If you're unfamiliar with Arc Reactors -- it's a fictional power source in Marvel's Comic Universe, famously used by Iron Man himself who initially had it installed to keep him alive. Over time, it's gone through several different design changes throughout the course of the comic -- but it's essentially a circular device that glows blue with a dim flickering light. The flicker is the key to making it seem like there's actual nuclear power flowing through the arc reactor. You can read more about that here, if you'd like: Marvel Fandom: Arc Reactor.
So, the first task was to get the light pattern accurate. I searched around and found some code snippets that all came really close to what I wanted, so I combined them all together and was off to a solid start.
The code for this isn't terribly complicated. Basically, there's a main loop and an alpha direction that determines whether the brightness should increase or decrease. Then, I either increment or decrement the brightness by a small amount. There's also a one in five-ish chance that the alpha direction is reversed each loop. So, if we're incrementing brightness, it will swap to decrementing and vice versa. This gives the effect of the device sometimes looking like it's about to power down only to then come back to life!
At this point, the hard work is done. I asked a few friends to 3D-print the casing for me. This took a few tries because apparently the light-ring was a different size than the thingiverse project I originally selected. I was able to frankenstein two printed objects together and came up with something nice. I spray painted my device a metallic silver for the finishing touch.
Fast forward to present day.
My wife decides she needs it, but she'd also like a big, red button wired up to it and when the button is pressed, it changes the color from blue to pink (temporarily). This, she explained to me, would be a sort of doorbell for her cubicle at work. She often works with headphones on and is usually startled when co-workers "sneak up" behind her.
We bought the button and spent half of a Saturday wiring everything up and programming the button logic.
Here's a portion of the code with the button logic. When the button is pressed, we turn the button LED on and change the color of the arc reactor to pink for quite a few CPU cycles, then turn the button LED off and change the arc reactor color back to its original blue.
Let me know what you think!
Here's a link to my github repo: ArcReactor
Authored by Anthony Fox on 2019-01-29