Hello all, I just had a quick question going to to any one who could help. I am currently very limited in my access to everything as I am at a remote camp, servers a quite restricted. can’t really check out too much. My question is if anyone has some code for a matrix WS2812B (mine is 7x28) that could be easily adapted to run scrolling text, animations, and maybe in the future an EQ display, and have the functions change with a button press. I am willing to contract someone to code for me as i am quite new to arduino, if anyone is interested message me for more details.
You are not asking for anything that has not been done by many within this community.
The code already exists mostly and would surely not require much effort to adapt to your needs.
I am willing to help for free someone who is willing and able to do the actual testing him or herself!
Do you have all the HW assembled with switches and controller and power supply ?
What Controller are you using ? Arduino Uno or else ?
What have you been able to achieve by yourself by now as far as programming or loading and running sketches on Arduino ?
I am very capable with the hardware aspect, I have soldered a 7x28 matrix from the individual WS2812B breakout chips. The button is not a problem, I could use wire jumpers for testing purposes and the adapt to the project later on.
I was hoping to use a nano if the specs will allow for the code (I.E. processor and ram limitations) Or even a pro mini. I would like to keep the hardware footprint small, if at all possible. I do have a mega, and an uno on hand if required.
I have managed to achieve a couple of simple example code cut and paste to verify everything is working as it should. I pasted together some different animations just to do a runtime test on the battery supply. The EQ is a thought for future when I have time to implement, For now all I would like is some scrolling text, rainbow diffusion or something similar, and simple animations that will loop until a button is pressed to change to the next one.
I have 6 18650’s run through a dc-dc step up constant current/voltage to step them up to 5v at 5A if required. Runtime at 10 out of 255 brightness (which is what I would like as to not be so abrasive) was approximately 13 hours.
All of the coding is extremely new to me, and I am very limited on time to prepare. I need the project to be ready by the beginning of august, and due to my work situation (remote camp 2 weeks at a time with very restricted internet) I only have about 3 weeks to actually work on it.
@Aren_Hibbing , you should be able to do what you want with a nano. I think that 3 weeks should be plenty as long as you dedicate some time to this.
For now, use the Uno to ‘play’ with the following library from Aaron Liddiment…
To be honest, I have not used that library myself but it would seem a very good place to start for someone that want to implement scrolling text.
If (or when) you get stuck, remember to post the code you already have on pastebin and provide as much detail as to what is happening and what you would like to see happening…
Good luck!
It’s not FastLED, but a much simpler way would be one of the many stand alone controllers. Like the T1000S…
Has simple downloadable software to to test or whatever. And buttons to change to a different file (program save), along with speed etc…
http://www.kutop.com/t-1000s-sd-card-rgb-led-pixel-controller.html
Ya I actually have one of those already, too bulky for what I need. Thanks though.
An thanks a lot JP Roy, it will be a few days before I can work on it, but I will try my best and post my progress.
And FWIW, the Pro Mini, Nano and Uno all have the same basic hardware… The ATMega328P with 32K, running at 16MHz on 5V. The difference is form-factor and USB/no USB.
Oh thanks Mike, I was under the impression that the mega had more memory.
The Arduino MEGA has a different processor. It is a ATMega2560 and it does have more memory.
@Aaron_Liddiment has some great code to start from cLEDText
Ive used it in a couple large 8x100 panels with great success!
@Aren_Hibbing the Mega and the Due and such have different processors, but you referred to boards that have the same processor, just different form-factor, which was why I mentioned it. I didn’t notice you said the mega. It has essentially the same processor (8-bit, 16MHz), just with more uarts, pins, flash and working memory.
The Pro Mini is ridiculously cheap and capable, I use it a lot. I have a bunch of Due and Mega… They are still in their packet waiting for an excuse to use them 
Ya, I loaded up on the nano and the pro mini. Bulk orders are your friend 
Anyway I am getting stoked to try out the Aaron Liddiment library and examples, looks quite capable. I am still not sure how to use a button press to cycle through the different functions, I.E. text, then animation, then maybe a cylon eye, rainbow, etc.
I still have a few days left in camp before I can fool around.
Thanks again guys, I will post pictures and video of the project closer to the date of completion (supposed to be a surprise for a couple of people)
@Aren_Hibbing raise a pin high, then look for it going low when you earth it. One end of the switch is to the pin, the other end to GND.
const int buttonPin = 10;
int buttonState = 0;
void setup() {
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
digitalWrite(ledPin, HIGH);
}
void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is LOW:
if (buttonState == LOW) {
then do something with your LED pattern);
}
}
@Aren_Hibbing create a counter from 1 to however many patterns you have and change the number when you press the button. When you hit the number of patterns, go back to 1.
Use the ‘switch/case’ statement to call your pattern:
switch (pushbutton) {
case 1:
//do something when var equals 1
break;
case 2:
//do something when var equals 2
break;
default:
// if nothing else matches, do the default
// default is optional
}
@Mike_Thornbury Thanks, I am getting pretty excited to dig right into this. You guys have laid out some pretty awesome code for me to fumble my way through. Maybe I’ll try to do some cut and paste tonight and see what I can come up with, still no matrix or arduion with me so no go on the testing just yet.
sorry I know this is super haphazard, but I had a minute at work to monster mash some code together. I took an example from Mark Kriegsman and tried to, as I stated previously “monster mash” his code in. I am sorry if this is wrong in every way, I did say I am extremely new at this.
switch (pushbutton) {
case 1:
#include <FastLED.h>
#define LED_PIN 5
#define COLOR_ORDER GRB
#define CHIPSET WS2811
#define BRIGHTNESS 32
#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
CRGB leds[NUM_LEDS];
}
const uint8_t kMatrixWidth = 16;
const uint8_t kMatrixHeight = 16;
const bool kMatrixSerpentineLayout = true;
const int buttonPin = 10;
int buttonState = 0;
void setup() {
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
digitalWrite(ledPin, HIGH);
FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness( BRIGHTNESS );
}
void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is LOW:
if (buttonState == LOW) {
then do something with your LED pattern);
}
}
switch (pushbutton) {
case 1:
{
uint32_t ms = millis();
int32_t yHueDelta32 = ((int32_t)cos16( ms * 27 ) * (350 / kMatrixWidth));
int32_t xHueDelta32 = ((int32_t)cos16( ms * 39 ) * (310 / kMatrixHeight));
DrawOneFrame( ms / 65536, yHueDelta32 / 32768, xHueDelta32 / 32768);
FastLED.show();
}
void DrawOneFrame( byte startHue8, int8_t yHueDelta8, int8_t xHueDelta8)
{
byte lineStartHue = startHue8;
for( byte y = 0; y < kMatrixHeight; y++) {
lineStartHue += yHueDelta8;
byte pixelHue = lineStartHue;
for( byte x = 0; x < kMatrixWidth; x++) {
pixelHue += xHueDelta8;
leds[ XY(x, y)] = CHSV( pixelHue, 255, 255);
}
}
}
// Helper function that translates from x, y into an index into the LED array
// Handles both ‘row order’ and ‘serpentine’ pixel layouts.
uint16_t XY( uint8_t x, uint8_t y)
{
uint16_t i;
if( kMatrixSerpentineLayout == false) {
i = (y * kMatrixWidth) + x;
} else {
if( y & 0x01) {
// Odd rows run backwards
uint8_t reverseX = (kMatrixWidth - 1) - x;
i = (y * kMatrixWidth) + reverseX;
} else {
// Even rows run forwards
i = (y * kMatrixWidth) + x;
}
}
return i;
}
//do something when var equals 1
break;
case 2:
//do something when var equals 2
break;
default:
// if nothing else matches, do the default
// default is optional
}
Yep, it’s a mishmash alright 
Set up your includes and your variables and your counters, etc, first. Then create your counter/pushbutton subroutine and finally select your FastLED display routines within the switch/case framework.
ok I think I see what I did, I included
switch (pushbutton) {
case 1:
before my #include or #define and then again after my void loop and void setup.
I do however have another question, If I were to try and implement Mark Kriegsman’s animation but it appears to use a different way of defining a matrix than the fastLED examples, do I define both or do I try and make just the one work? I can foresee potential problems implementing his animation into this, but would like to do so.
just for arguments sake the different ways are
#define MATRIX_WIDTH 80 // Set this negative if physical led 0 is opposite to where you want logical 0
#define MATRIX_HEIGHT 10 // Set this negative if physical led 0 is opposite to where you want logical 0
#define MATRIX_TYPE HORIZONTAL_MATRIX // See top of LEDMatrix.h for matrix wiring types
and
#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
CRGB leds[NUM_LEDS];
}
const uint8_t kMatrixWidth = 16;
const uint8_t kMatrixHeight = 16;
const bool kMatrixSerpentineLayout = true;
const int buttonPin = 10;
int buttonState = 0;
No don’t try to make both type work. Use only one and adapt it.
Ah ok, thank you. I will fiddle around tonight to see what I can come up with, but with no gear to test it out just yet I am going to have to wing it 