Go Down

Topic: WS2811 10 X 10 LED Matrix Serpentine Wiring (Read 155 times) previous topic - next topic


Aug 13, 2019, 06:06 am Last Edit: Aug 13, 2019, 06:32 am by joedeangelis33
Hi, I like to tinker around with Woodworking,  Arduino, and LED's while not being an expert in any of those hobbies.  I started playing around with the Arduino and those cheap 8X8 MAX7219 modules and wanted to make something bigger.  Well I had few strings or WS2811 LED strips and some scrap pieces of Poplar and decided to build a big 10X10 RGB Matrix.

Quick Video with the Fast LED Library and XYMatrix example.

I'm successful running the FastLED library with the XYMatrix example but have no idea how to implement my own animations and scrolling text.  I've looked at other libraries like Adafruit and "semi grasp" the "array" concept in the code to create animations.  It seems like the libraries I download either don't work with my Serpentine style wiring or WS2811 hardware.  A lot of libraries throw up "missing file" errors when I'm trying compile. 

If anyone can offer any advice or point me to "LED Matrix for Dummies" information it would be greatly appreciated.  I'm interested in learning more.  Thanks


Aug 13, 2019, 08:54 am Last Edit: Aug 13, 2019, 08:59 am by Grumpy_Mike
Exactly how it is wired up?
There are many ways of wiring it up and each one requires slightly different software.

For example this is a 7 by 7 column raster that starts at the bottom left corner and goes up.

You could wire it from the top right and go down, or the top right go down and move from right to left, or the bottom right, go up and move from right to left. That is the four ways you could wire it.

If you have a row raster then there are four ways to wire that up as well.  

To do any sort of intelligent plotting on this sort of thing you need a function that takes in the X-Y coordinates of your matrix and converts it into an LED number.

For this way of wiring it up the conversion from X - Y values to strip values are just a little more involved but that  what software is for. In the case of even numbered columns the conversion is simply what we had before, with:-

LED number = Y + (X * number of LEDs in a column)

However for odd numbered columns the conversion is :-

LED number = (X * number of LEDs in a column) + (number of LEDs in a column -1 -Y)

To determine if the X coordinate is odd or even, simply look at the least significant bit of the X value and if it is a zero then it is an even column or if it is a one it is an odd column. So all the software has to do is to examine the X - coordinate and decide what formula to use. It is simple enough to make a function that returns the LED number given the X & Y values.
Code: [Select]
int getLEDpos(int x, int y){ // for a serpentine raster
   int pos;
   if(x & 0x1) { // is X odd
      pos = x * yMax + (yMax -1 - y) ;
   } else { // x is even
      pos = x * yMax + y;
   return pos;

Where yMax is the number of LEDs in a column.


Thanks for responding. I appreciate you taking the time. If you look the picture and if I rotated the box 90 degrees clockwise it would match your diagram. Your coding explanation is something I don't fully understand but will give me something to build off of. I'm still learning the basics.  If you come across any other examples and can shoot them my way I would appreciate.  Thanks


Well try it, for example make a loop that just sets the first vertical line, then moves to the second and third and so on.

Have a go at doing this and if you get stuck then post your code and we will try and sort you out.

The only way to get a feel for this is to play with it.


And if you are going to use anything near full brightness for the whole array, don't forget to connect your 5 V power in parallel to both ends of the string.  If you then see some odd colouration in the middle at high brightness, you may need to parallel the power in the middle (both 5 V and ground of course) as well.

100 LEDs is a lot, 6 Amps at full white and you can lose some voltage in the wiring


Thanks for the tip.  I have seen many examples with adding a power supply those LED's came with them.  I have get the coding down first. :)

Go Up