I built a computer last month so I could have a much better time editing videos. My next project is to make a very simple work table so that Shoshie can paint her magnificent minis while I work in the same room. This is a 3.5' by 7' table that I threw together quick in SketchUp. This will give us the opportunity to perhaps do some streams of us working, too.
It was bugging me that I couldn't change the speed of the dance party effect for my workbench lighting, so I added the ability to adjust the beats per minute. I also converted the switch to an interrupt so that it behaved better while doing other work. Interrupts are a simple concept - stop whatever the device is doing and do this other thing right now. However, this also means I had to learn a bit about debouncing.
When an electrical circuit is closed by a button, the voltage fluctuates slightly until it flattens out. This fluctuation means that one button press can look like 3 or 4 button presses over the course of a couple hundred milliseconds. This behavior is called bouncing.
Debouncing uses either hardware to smooth out the voltage or software to ignore the bounces. Since I didn't have the components necessary for hardware debouncing, I used a software method that works pretty well. When the interrupt is triggered - the voltage from pressing the button rises, including from bouncing, check for when the last voltage rise was detected. If it's shorter than 200ms, ignore it. Debounced!
So I don't have very good lighting available for my workbench. I have a really bright standing CFL light off to the side, but it doesn't give good distributed light. I could buy a heavy fluorescent light, but why not make something that gives me more control? My plan is to get a strip of Neopixels, another Arduino-type board, and a rotary encoder. A rotary encoder is a knob that can be used to input position and speed. With that capability, I'll have the ability to control whether all the lights are on, all the lights are off, and whether a portion of lights are on including where the lights are on.
While prototyping this workbench lighting system tonight, I decided to use my ESP8266 Thing from SparkFun as well as a new full-size, solderless bread board. I learned that the power rails on the top half do not connect to the bottom half. That one took a bit to figure out, including some accidental connections.