Christmas is here again, and whether it’s your favorite holiday of the year or it makes you sweat, the decorations are starting to rise. This year, why not use some DIY technology in your jewelry to make it stand out?

In this project, we will build a weatherproof and motion-activated 8 x 8 LED array from scratch for less than $20. It is designed to be placed in the center of a standard Christmas door wreath, although it can be used anywhere in the home. And since it’s battery operated, anywhere away from home too!

Parts list

For this project you will need:

  • Arduino.
    • I used the Nano for its small size, but you can use almost any Arduino compatible microcontroller.
  • 64 x red LEDs.
  • 8 x 220 ohm resistors.
  • IR motion sensor.
    • Lots of Arduino starter kits go with it. I bought a multi-pack from Amazon for $10.
  • 1 piece breadboard.
    • The one used here was 9 x 7 cm, although you can use any size you want.
  • Battery 7-12V.
    • A simple rechargeable battery is used here for budgetary reasons, but the mobile bank charger batteries may take even longer.
  • Assorted short pieces of wire.
  • Tupperware box or similar weatherproof case.
    • Make sure it’s big enough to fit all your components inside!
  • Christmas wreath.
    • Any will do, just make sure the case box will fit in it.
  • Soldering iron and solder.

While this is not strictly necessary since you can solder components directly to the Nano, I also found a small breadboard very useful when testing. The hot glue gun also helps to bring all the pieces together.

Christmas Wreath LED Matrix Parts

This project requires quite a bit of soldering, and as a beginner it can seem intimidating. Personally, I’m still new to soldering and have found it not as difficult or time consuming as it sounds. If you are also new to soldering, here are some helpful tips to help you.

If you are really not interested in the idea of ​​soldering, this project is also possible with LED strips. or a ready-made LED matrix, which can be in your starter kit. Some code adjustments will be needed if you decide to go down this path.

Arduino setup

We’ll start with the Arduino circuit diagram and the wires we’ll be connecting to our IR sensor and LED array.

frieze wreath

Inside the Matrix

Now to make our matrix of 8 x 8 LEDs. It’s a good idea to start by creating one row and one column of the matrix to make sure it’s exactly where you want it on the breadboard.

testing where to put LEDs

In the photo above, all the LEDs are positioned so that the anodes (the longer positive leg) point towards the top of the board. This is important as we will be creating columns of common anodes by connecting them together and rows of common cathodes (shorter negative branch). Getting it right now will save you a headache later!

We’re going to build a generic cathode matrix of rows, this diagram shows how it’s all connected.

doubt

This may seem a bit complicated at first, but it’s a fairly simple configuration. In each row, all cathodes are connected from right to left and then attached to one of our Arduino pins. After that, we do the same for each column of anodes. So, depending on which column we apply power to and which row we connect to ground, we can turn on any individual LED in the array.

Let the soldering begin

Start by placing your first row of LEDs. Make sure all anodes are facing up and turn them over. I found that adding another LED to each corner and attaching another piece of proton on top with an elastic cord helped hold everything in place.

protoelastic

Now, one by one, bend the cathode (short) leg of each LED to the left so that they all overlap each other. It’s easiest to start on the left side and work to the right. If you are using most of the prototype, you can solder them to the board first and connect them together using the pads. Be careful not to connect the cathodes to any of the other lines on the board or to any of the anodes!

cathodic solder fold

Repeat this process for all eight lines, and when you’re done, you should end up with something like this:

picture of finished rows

Jumping Anodes!

Anode columns are a bit more jittery. In the diagram above, the anodes bend each time they cross a row of cathodes. This is because they cannot touch lines at all. It is necessary to bend the anodes over the rows of cathodes and attach them to each other. You may find that using the leg curl handle helps a lot.

bin solder anodes

Do this for each row of anodes and attach a resistor to each top anode. You may find it easier to place a resistor in the next hole in the board and connect the pads with solder. Now you should have something like this:

finished soldering

Congratulations! The LED Matrix is ​​completed. Check your soldering carefully at this point to make sure there are no breaks and that none of the columns are touching the rows. Don’t worry if it doesn’t look pretty, we just need it to work! You can now test each LED individually by connecting 5V to either end of the column and grounding either end of the row.

test matrix

Assuming everything is in order, connect the wires to each column and each row and attach them to the Arduino as shown in the picture above.

Let’s get the coding

Open the Arduino IDE and select your board and port. If you’re new to Arduino, check out this getting started guide.

Enter this code into the editor. This is pretty dense code if you’re not familiar with it, but it’s available here in its entirety with comments to help you understand how it works.

const int row[8] = { 2,3,4,5,6,7,8,9 }; const int col[8] ={ 10,11,12,14,15,16,17,18 }; int pirPin = 19; int pirState = LOW; int val = 0; bool pirTrigger = false; const int pirLockTime = 12000; int pirCountdown = pirLockTime; int pixels[8][8]; const int refreshSpeed = 500; int countDown = refreshSpeed; int currentCharIndex = 0; typedef bool CHAR_MAP_NAME[8][8]; const CHAR_MAP_NAME blank = { {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, }; const CHAR_MAP_NAME threedownthreein = { {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 1 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, }; const int noOfFrames = 5; const CHAR_MAP_NAME *charMap[noOfFrames] ={ &blank, &threedownthreein, &blank, &blank, &threedownthreein }; void setup(){ for (int i=0;i<8;i++){ pinMode(row[i], OUTPUT); pinMode(col[i],OUTPUT); //motion sensor pinMode(pirPin, INPUT); digitalWrite(col[i], LOW); } } void screenSetup(){ const CHAR_MAP_NAME *thisMap = charMap[currentCharIndex]; for (int x = 0; x < 8; x++) { for (int y = 0; y < 8; y++) { bool on = (*thisMap)[x][y]; if(on) { pixels[x][y] = HIGH; } else { pixels[x][y] = LOW; } } } currentCharIndex++; if(currentCharIndex>=noOfFrames){ currentCharIndex = 0; } } void refreshScreen(){ for (int currentRow = 0; currentRow < 8; currentRow++){ digitalWrite(row[currentRow], LOW); for (int currentCol = 0; currentCol < 8; currentCol++){ int thisPixel = pixels[currentRow][currentCol]; digitalWrite(col[currentCol], thisPixel); if (thisPixel == HIGH) { digitalWrite(col[currentCol], LOW); } } digitalWrite(row[currentRow], HIGH); } } void loop(){ val = digitalRead(pirPin); if (val == HIGH){ pirTrigger = true; } else if (val == LOW && pirCountdown <=0) { pirTrigger=false; pirCountdown = pirLockTime; } if(pirTrigger==true && pirCountdown > 0) { refreshScreen(); countDown--; pirCountdown--; if(countDown <= 0) { countDown = refreshSpeed; screenSetup(); } } } 

Important parts to understand:

Variable refreshSpeed . This variable determines how much time between screen updates. The higher the number, the longer the wait.

Const CHAR_MAP_NAME s. This is where you place each character card (or frame, if it's easier for you to think of them that way) that you want to display.

Variable noOfFrames . This determines how many frames are displayed in one full view. Please note that it may differ from the number of character cards. For example, if you want to display "A CAT", you will only need to define four separate frames: empty, A , C and T.

Now, when the motion sensor detects motion, the LED screen should flash the LED three down and three from the top left. If it doesn't display correctly, check the wiring again to make sure everything is in the right place! When you add your own image or message, it may cut out early or take too long to play. Try changing the variable pirLockTime, until it plays for the time you need.

The process of adding each frame to an LED display can be a little tedious, so we created this spreadsheet to make it a little easier to create text and images for your LED matrix (make a copy of the Google Sheet so you can edit it).

Using a spreadsheet, you can copy your creations straight into code.

Make it bold elements

Now that we have a working LED matrix, we need a way to get through the winter weather. While this method may not survive a tropical storm or swimming pool drowning, it should be enough to protect all electronics from the elements.

I used a round Tupperware box 15 cm in diameter and 6 cm deep as it was the perfect fit for my components. Cut out a window in the lid, a little larger than your LED array, and attach a clear plastic film to it, leaving no room for liquid to get in. Rugged plastic from some sort of packaging would work best, but that was all I had. You can also attach multiple board mounts, although both jobs can be easily done with a strong waterproof tape.

weatherproof

Next, make a small hole under the window, then carefully and slowly expand it until your IR sensor can fit through it. You want it to fit as tightly as possible.

cut a hole

Attach your IR sensor and fill in any gaps you can see with tape or hot glue.

glue feast

Peel off any tape or glue that might be preventing the box from closing properly and add all of your components to the box along with the battery. Here I used a simple AA battery pack connected directly to the Nano's VCC pin. A few small pieces of cork were added on the outside of the body to help hang the assembly in the center of the wreath.

And we did

Once the box is sealed, hang it up with a Christmas wreath and wait for the audience to react to your $20 high tech personalized party! You could even go one step further and create amazing DIY decorations, decorations with for other places around the house too!

finished led matrix christmas wreath diy

In this project, we built a self-contained LED matrix system from the ground up that is activated by movement and can survive being outside in almost all weather conditions. This build will come in handy long after the holiday season is over on other projects, and the same technique can be used to make cheap weatherproof cases for other projects as well.

Are you building anything to spice up your Christmas? Are you planning DIY themed Christmas gifts this year? Let us know in the comments below!

Похожие записи