On July 4th we'll be watching season 3 of Stranger Things. Are we all set?
Mmmh, we're missing a Joyce Byers' Xmas garland.
No time to order parts. So I went out and found something in the next hardware store. Cool.
Well... (as Kid noticed immediately) ... it does not blink!
- Dad, could you make each lamp blink independently?
- No, because they're wired together. But wait, I could make them blink altogether.
Since there really isn't much time till the Netflix release time anyway, let's keep it simple and try to do it in one hour, and take part in the "1-Hour Challenge".
Skills required: Very basic electronics skills.
- LED garland
- 10K Resistor
- Optional: Protoboard and headers
- Soldering iron
- Computer with Arduino IDE, USB cable
Step 1: Examine the Battery Box (5')
I was expecting a sliding mechanical on/off switch, that I could short by a MOSFET driven by the Arduino.
Instead of this, a momentary push-button toggles the LEDs on/off, meaning that the circuit is basically always powered, and listening to the button.
Thus, we could replace the "output" of the button by an output port of the Arduino, meaning we just need a serial resistor.
Step 2: Measure Resistance and Figure Out the Circuit (10')
First, it is easy to locate the VCC and GND points, by following the battery contacts.
In order to figure out the role of the button, I wanted to know:
- To what are its pin connected?
- Is there a pull-up or a pull-down resistor? Of which value?
So I inserted batteries and measured the voltages between the button pins and respectively GND and VCC.
- One pin was at 0V for any button position. Let's name in Pin1.
- Another pin was at 4.5V with button released, and 0V with button pressed. This will be Pin2.
- The command is therefore active-low.
After removing the batteries:
- I measured the resistance between VCC and Pin2: R1 = 122K.
At this point, we can figure out the button circuitry, see drawing.
Step 3: Design the Interface to Arduino (5')
So the Arduino will have a port of our choice connected to Pin2, and will drive the port low to toggle the LEDs.
- We just need a serial resistor R2 for the case the port is driving high, and the button is pushed, in order to avoid a short. This resistor shall be also small compared to R2. I had a 10K around, good.
- See addition in red on the drawing.
I also wanted to power the whole LED garland by the Arduino instead of batteries. Will there be enough power?
- I re-inserted the batteries and measured the current flowing through: 42mA. Nothing scary for the Arduino.
Step 4: Test on a Breadboard (10')
With a breadboard I tested the design.
- Remove batteries from the box,
- connect GND between Arduino and box,
- same for VCC,
- connect Arduino to USB --> Garland works!
- Disconnect USB,
- connect an Arduino port to Pin2 of push-button in battery box, through R2 (10K) resistor,
- re-connect USB,
- run a simple Arduino sketch that sets the port to output and toggles it every 2 seconds or so --> LEDS toggle!
Step 5: Build a Protoboard (15')
For comfort of use, I decided to re-implement the design on a protoboard, with soldered headers, wires and connectors.
Using a connector, the garland can be separated from Arduino and operated like before.
See photos. Note: the 10K resistor is on the backside of the protoboard, between the yellow wire and port 8 pin.
Step 6: Code (15')
Use the attached Arduino sketch.
Note: this is the code version after I polished it a bit. The initial version was very ugly, otherwise could not finish on time.
Step 7: Use
As there are only 20 LEDs, and they cannot be controlled individually, we opted for a "STRANGER THINGS" banner instead of the famous ABC... communication device.
The blinking gives a slight taste of Joyce's place and is worth the effort!