The three LED Light Show. The start of everything. (All images and videos from me.)
Like programming a sound sequence, I thought it would be useful to do the same thing with light. In this project we will start working on developing a Light Show Sequencer.
To make it simple, I will start with just 3 LEDs. I used the same kind of interface as in the Sound Sequencer project. Although the buttons are clicky, it does the job. Feel free to use any sort of keypad you want.
The goal was not only a real-time sequencing of light flashes, but also duration the light is on. So, hold the button down on one light for a long time, the program will remember the duration.
The software works as follows:
- Power it up.
- It will be in Play mode and flash a “play triangle” on the Micro:bit’s LED screen.
- Now, you can press any of the 3 buttons corresponding to each LED. You’ll notice when you press them, the numbers 0, 1, and 2 will show on the screen. This is indicating which LED is being pressed.
- Press button “A” and “B” simultaneously and it will switch to record mode. A “record circle” will display on the screen.
- At this point, the program is waiting for you to press the light sequence you want. So, press the LED buttons any way you wish.
- Then press the “B” button, it will stop recording and start playing the sequence you made in a continuous loop.
- Press the “A” button to return to play mode.
First, let’s gather all the necessary components you’ll need to build this project.
Project Wires Female - Male
Project Wires Female - Female (aka jumper wires)
3x 1k Resistor
3x LEDs of your choice (If you have the Kitronik kit, there are a few in there to use
Video demonstration of the project:
STEP 1
Load the code onto the Micro:bit.
I am providing the hex file you need to drag and drop onto the Micro:bit, and the python code as two separate files. For the below process, just use the hex file.
Plug the MicroUSB cable into the Micro:bit, and plug the other end of the cable to a PC or MAC.
At this point, you are going to copy over the code to the Micro:bit. I am providing the program (code) in this post that needs to be copied over. When the Micro:bit plugs into a computer, it shows up as a USB flash drive. All you have to do is copy the file over to the Micro:bit, like it’s a USB Flash Drive, and the Micro:bit will reset, and the program is active.
You can remove the Micro:bit from the computer at this point. The program will start running, and without the rest of the circuit, it will not function.
●
A little bit about the code:
The sequence is stored on the Micro:bit as a text file, technically. See above.
The rest of the code is commented fairly well if you want to see what is going on in it.
STEP 2
Wire up the schematic to the breakout board.
This project has a fairly large schematic.
Only 4 pins on the Micro:bit are used for the keypad. On the schematic, they are labeled R1, R2, L1, L2.
I used a 4x4 matrix keypad for this project. You can use any type of matrix keypad as long as it has eight buttons.
I then used female-female project wires to connect the pad to the Micro:bit breakout board.
Note: Pins 0, 1, 2 on the Micro:bit is the LEDs in order. So, however you want the LEDs to be arranged, keep this order in mind. Also, max current for the LEDs is 5mA. Be sure to add the resistors.
STEP 3
Setup
- Power it up. Plug in the 5V adapter.
- It will be in Play mode and flash a “play triangle” on the Micro:bit’s LED screen.
- Now, you can press any of the 3 buttons corresponding to each LED. You’ll notice when you press them, the numbers 0, 1, and 2 will show on the screen. This is indicating which LED is being pressed.
- Press button “A” and “B” simultaneously and it will switch to record mode. A “record circle” will display on the screen.
- At this point, the program is waiting for you to press the light sequence you want. So, press the LED buttons any way you wish. Each key press is stored as two elements. Pressing a key and released key set a relative time interval. Even if you press no keys, a no input is stored as a “-1.”
- Then press the “B” button, it will stop recording and start playing the sequence you made in a continuous loop.
- Press the “A” button to return to play mode.
Conclusion:
This is a great first step towards building larger light sequencers. Even this one is useful. You could connect solenoids in place of the LEDs and control larger lights or banks of lights.
Top Comments