programmable rgb led sequencer (using arduino and adafruit trellis)
I also think it will be a great opportunity to create a teaching tool for them that they can use to improve the programming and electronic skills I teach them.
This is the result.
Let me show you how to use Arduino Uno in this simple, programmable rgb led bar controller (or Nano)
An Adafruit grid with some other parts.
The Adafruit grid is one of my favorite new toys for Lady Ada and crew.
The board is $95 and another $4.
95 Silicone elastic button pad (
Price as of this article).
This is a very big month-
Button 4x4 matrix with LED function.
It doesn\'t have any led installed and you need to provide them, but this gives you the flexibility to choose the color you want (
Reduced cost and complexity compared to building in addressable led).
To build this project like I do, you need 3mm LEDs.
I used 2 red, 2 Green, 2 Blue, 4 yellow, 6 white.
Trellis communicates using I2C, so only two I/O pins are required (data and clock)
Control 16 buttons and 16 LEDs.
You can complete the hardware part of this project on a small prototype board, which is the way I make the prototype.
I quickly realized that I needed something more neat to put on their table (
A bare Arduino and prototype board will be too fragile)
So I made my own shield to drive the LED strip.
The final step contains instructions and files for building blocks.
The driver uses three IRLB 87 21 mosfet and three resistors.
Of course, you need an LED light strip to drive;
Almost any ordinary 12 v rgb led light strip is OK.
These are simple LEDs such as SMD 5050 s instead of separate
No NeoPixels etc. )--
This is another project!
You will also need a 12 v power supply large enough to drive the number of LEDs you intend to use.
Therefore, to sum up, the basic hardware requirements of this project are: the necessary disclaimer: the link above is provided for your convenience, not the approval of any product or supplier;
I will also not profit from any purchases on these links.
If you have a preferred supplier, be sure to support them!
Let\'s start. . .
This is the LED drive circuit.
This is very simple.
It uses IRBLxxx N-
Channel MOSFET for each channel on the LED light strip.
The LED strip is a public anode, which means that 12 v is sent to the LED strip and the red, green and blue LED channels are controlled by providing ground on the corresponding connection to the strip.
Therefore, we will connect the drain of the mosfet to the LED color channel and connect the source to the ground.
The gate will be connected to the Arduino digital output and the resistor provides pull-
Make sure that each MOSFET switch is fully turned on or off as needed.
Pulse provided by Arduino-
Width Modulation on some of its digital outputs, so we will use these outputs (
Specifically D9, D10, D11)
This controls the strength of each color channel.
If you are confused about the position of the connection on the IRLB 87 21 mosfet, please hold one in your hand and face you on the front, as shown in the picture above.
Pin on the left (pin 1)
Is the gate and will be connected to the Arduino digital output pin and resistor (
The other end of the resistor to ground).
Sales of the center (pin 2)
Is the drain pipe and is connected to the LED strip color channel.
Pin on the right (pin 3)
Is the source and connected to the ground.
Make sure to track which transistor is connected to which LED color channel.
I will not go into details on how to weld the prototype plate.
I hate it, to be honest, and I\'m not good at it.
But it works for good or bad, it\'s a quick and dirty way to get a solid prototype or-off done.
My first board is shown here.
You can wrap this up too.
This is definitely faster than welding everything on the prototype board, but not so long-lasting.
After connecting the driver, connect the MOSFET gate input to the Arduino digital output pin: D9 of the green channel, D10 of the red channel, and D11 of the blue channel.
Also connect the LED light strip to your prototype board.
In addition, make sure that the drive board is connected independently with one of the Arduino\'s ground pins.
Finally, for the LED power supply, the negative pole is connected (ground)
The lead of the 12 v power supply is connected to the ground on the drive board.
Then connect the positive lead of the 12 v power supply to the anode lead of the LED light strip (
This is a black line on my cable, as shown in the figure).
In the end, I designed a PC board shield installed on Uno and also had installation support for the mesh.
This provides a more complete final product.
If you want to do this, you can skip using the prototype board described here and just make the shield board.
This is described in the last step.
The lattice board has an empty pad with 3mm led, which we need to fill in.
Please pay close attention to the symbol on the pad--
There is a very subtle \"\" next to the pad to specify the anode side.
If you take the board then the text is correct --
Looking up, there is also a symbol on the top and bottom of the board indicating that the LED anode is on the left.
Weld 3mm led to the circuit board.
Look at the front of the board, right-
Side up, above
The left switch/LED position is 1, the upper right is 4, the lower left is 13, and the lower right is 16.
Here are the colors I use at each location (
There is a reason for this, so I suggest you follow my pattern at least in the first two lines):1 -red2 -green3 -blue4 -white5 -red6 -green7 -blue8 -white9 -white10 -white11 -yellow12 -yellow13 -white14 -white15 -yellow16 -
YellowCC Attribution: The above lattice image is made by Adafruit and used in the Creative Commons. -
The grid has five patch panels, but only four are used in this project.
Trellis requires SDA and scp to communicate with Arduino (using I2C)
The power supply is 5 v and GND.
Do not use the last pad INT.
The grid pad appears on all four edges of the plate.
You can use any set of mats you want.
Weld solid interconnect wires to 5 v, GND, SDA, and cl pads.
Then, connect the 5 v wire to the 5 v pin on the Arduino, connect the GND to the ground pin, connect the SDA wire to the A4, and connect the scl wire to the a5.
Next, we will power on the Arduino and upload the sketch to the Arduino.
Now is a good time to put the silicone button pad on the lattice board.
It\'s just sitting on the blackboard (
Pay attention to the \"nubs\" at the bottom of the pad, which fits the holes on the board)
So you may now want to fix the edge of the mat on the board with a few pieces of tape.
CC properties: the grid layout chart above is like a cropped version of the image by Adafruit, which is used in the Creative Commons--
You can download the sketch of this project from my Github repo.
After getting it, open it in the Arduino IDE, connect the Arduino using a USB cable, and upload the sketch to the Arduino.
If the sketch is uploaded and the grid is connected correctly, any button on the grid should flash three times quickly when pressed.
This indicates that you have pressed an invalid button because the system is in a \"off\" state, so the only key that works is the key you need to turn it on.
To open the system, press and hold the button in the lower left corner (13)
At least a second.
When you release the button, the indicator light should be lit for a short time, and then go out in the upper and lower rows, except for what will be taken (bottom left).
The system is now powered on.
And idle state.
As the first Test, you can try to light and dim the LED channel using the first two lines.
If that works, you can move on to the next step.
If not, please check: In the next step, we will play some features of the button pad UI.
Note: Don\'t worry if your controller is working but the strength Button can\'t control the correct color, and don\'t re-wire!
Just go into the sketch in the Arduino IDE and modify the red, green and blue pin definitions near the top of the file.
Now that the system is up, we can play with some buttons and let it do something.
As I said in the previous step, the system is \"idle\" when powered on.
In this state, you can use the buttons of the first two lines to increase and reduce the color intensity of each red, green and blue LED channel.
If the white Increase/decrease button is used, the system will increase or decrease the strength of all three channels equally at an equal level.
The bottom two lines are used to play back the preset pattern.
These patterns are stored in the EEPROM of the Arduino.
When the sketch runs for the first time, it sees that the EEPROM does not store any patterns and stores a set of default patterns.
After that, you can change these modes and change the preset mode, which is stored in the EEPROM of the Arduino.
This ensures that your mode can survive after a power outage.
The next step will introduce the editing function.
Now, simply press any preset button (
Eight buttons in the bottom two lines)
The mode that runs as stored for this button.
The button flashes when the mode is running.
To stop the pattern, press the pattern button briefly again.
When the mode is running, you can change the mode rate using the white up/down button in the top row.
If you let the project run separately for a few seconds without touching any buttons, you will notice that the led is darkened.
This is not only to save energy, but also to avoid too many grids.
Illuminate any \"mood\" led tries to create \".
Touch the button on the grid to wake it up.
To turn the system off, hold down the-below-left (13)
Button for one or more seconds and release.
The grid and LED light bars will dim.
As I said in the previous step, the sketch stores eight default patterns in the EEPROM the first time it runs.
If you want to edit mode using the mode on the button board, you can change 7 of them to another mode.
To enter pattern editing mode, first decide which button to edit the pattern.
You can select any button except the lower left button.
Enter pattern editing mode through long-pressing (
Hold down for more than one second)
On the pattern button of your choice.
When released, the button will light up the solid and the two lines above start flashing.
This means that you are in edit mode.
Edit mode starts from the first step of the pattern and lasts until you exit the edit or complete the 16-step edit (
Up to 16 steps per pattern).
In each step, use the channel strength button in the first two rows to select the color required for that step. Then short-
Press the pattern preset button to save the color and proceed to the next step.
In your last step, not short
Just press long.
Press Exit edit.
After exiting the mode Edit, the mode is played automatically. That\'s it!
You now have an rgb led controller that will sort the patterns you can program through your keyboard.
You can stop here, or go ahead and complete the rest of the steps if you want to build a more formal version of the project.
Once I have a working prototype, I know that I can\'t leave a bare Arduino and prototype board on my child\'s desk as a permanent solution.
I need an attachment for this project.
I also decided to make a better drive board and I thought it was a great opportunity to make my own shield.
I input my paper schematic into expressch, a free tool offered by ExpressPCB, a board that offers cheap, small PC boards for short-term operation
I \'ve been using the ExpressPCB in the project for over a decade, but in any case I\'m going to use the tools and manufacturers you like.
I have added a few small features to the basic schematic so that it can be used as a shield for this project.
I added the wiring pad to connect the mesh, power jack, indicator and connector of the LED light strip.
I also added a capacitor position to the power supply.
The final circuit is shown here.
I decided that the motivation for this project should come from the shield.
The 12 v supplied to the shield supplies power to the LED light strip and Arduino.
The Arduino\'s power supply is provided by connecting the power input to the Arduino\'s VIN pin, which is two-waydirectional (
You can power the Arduino on this pin, or if you connect the power to the Arduino elsewhere, it will provide you with the power on this pin).
Protection Diode D1 prevents any power supply directly connected to the Arduino (e. g. USB)
Try to power the led.
Why not use the Arduino\'s power jack and connect 12 V there?
While I can supply 12 v power to the Arduino\'s power jack and use the VIN pin to power the shield, I am concerned that the D1 diode and trajectory of the Arduino will not reach the possible high current when driving the LED strip.
So, I decided that my shield would take over the power input and power the Arduino.
I also need 5 V grid, but Arduino is in-
Board power conditioning provides 5 v power on several pins, so I use one of the pins as a grid.
This made me install a regulator circuit on the shield.
Then I arranged the PCB.
I used some of the resources I found to get accurate measurements of the pin position to meet the title on Arduino Uno.
A little diligent and matched the first attempt.
There is not much in the Shield circuit itself, so I have enough space.
I laid extensive traces for the LED load so there will be a lot of current
The carrying capacity I need.
I put the mosfet where it can fit safely, whether there is a radiator or not.
The number of led I \'ve been using so far does not require a radiator, but the space is there if needed.
I also added holes on the grid that match the mounting holes so I can use the stand
Hang the grid on my shield.
Insert the shield of Arduino, the grid hanging on the bracket-
Everything should be beautiful and solid on the shield.
I then printed the board layout and glued it to a piece of foam core and inserted my part to make sure all the parts fit.
Good, so I sent out the order.
Then I started working on a fence.
Using Fusion 360, I designed a simple shell with three boards (
Arduino Uno, shield, grid).
The holes on the housing allow connection to the USB port of the Arduino and, of course, access to the LED strip connection and shield power jack.
The Arduino power jack is covered by the housing to ensure that it is not used.
After several trial prototypes, I finally got a design that I was satisfied.
I have posted the STL file of the shell to Thingiverse.
In the future, I will make a board version that the Nano can insert directly, which will make the project more compact.
Before that, you can also use the Nano to Uno shield adapter like this.