If you wear this project before December then it’s wrong, sooo wrong, don’t do it – Bah Humbug!
On a more festive “past November the 31st note”, let’s make a bespoke Christmas jumper 🙂
Here’s a short video of the final project in action!
Kit List
 A basic plain Christmas Jumper suitable for modification! Or any plain jumper 🙂
Just about any Arduino but I’m using a Nano
LED Matrix display (4 in one module type) based on MAX7219 driver chip
External Power Bank (bigger capacity = longer your jumper will run for)
USB connecting lead
5 Connecting wires (if not supplied with the Matrix display)
Some stitch-able Velcro or old bits of fabric to hold the display inside your jumper
Battery Life
I used a small cheap 1800mAh (if that is true!) power bank and that gave about 3.5 hours of continuous usage. Not bad! Enough to get you through the day if you don’t have it on all time, or get yourself a bigger power bank for all day Christmas Fun!
The Matrix
Absolutely get a pre-made 4 gang matrix display, don’t buy four individual ones, it’s not worth it! Here’s the one I bought:
and here it is running connected up to my Arduino Nano Clone:
Connecting up
The module uses SPI to communicate, simply connect up the wires as shown below
Matrix Connection | Nano Connection | Pro-Micro | Uno |
---|---|---|---|
VCC | 5V | 5V | 5V |
GND | GND | GND | GND |
DIN | D11 (Mosi) | 16 | ~11 |
CS | D10 (SS) | 5 | ~10 |
CLK | D13 (SCK) | 15 | 13 |
Required libraries
You will need to download two supporting libraries, the first is the driver code for the MAX7219 driver chip for these displays. There are some 7219 drivers in the official Arduino Library Manager, however, I had some trouble getting these to work, mostly I think because there are several ways these displays can be connected to the 7219 chip. After some research I found a library that seemed comprehensive and had settings for several types of display. This one is called MD_MAX72xx (as it can handle any of the 72xx series chips). At time of writing, github (where I normally link to) was reporting a problem showing this page and another source had a version that was incompatible with the other library we have to use later on, so I won’t link to that. For now I will host the file you require on the XTronical website, click below to download:
Install this in the usual way for downloaded zip libraries, if your not sure how to see this article.
Testing and setting up MD72xx and your display
There are several types of LED matrix displays available and several different 4 gang ones too. Which one you have is difficult to work out! I had no idea which one I had and had to just try different settings, I’ll take you through the process of testing. First load up an example that will now be available on your Arduino IDE
“File->Examples->MD_MAX72XX->MD_MAX72xx_Pacman”
Upload this to your board and you should see this animation:
If you see this perfectly, then great, your good to move onto the “The Code” section, if not read the “Trouble shooting my board” section below:
Trouble shooting my board
When I first tried this driver it didn’t work, things were all messed up. The problem is the driver has been cleverly designed to work with many different board designs and there is a setting in the header (the .h) file for you to set the correct one for your board. However if your like me and my board there will be no clue as to what you actually have. So load up the header file into a normal text editor (as the Arduino editor can be a bit fussy and hard-work opening header files) such as notepad or I recommend downloading and installing notepad++. The header file should be located at:
My Documents->Arduino->libraries->MD_MAX72XX-master->\src\MD_MAX72xx.h
or if you’ve changed the default location of your Arduino install then you need to open that location and look in the libraries folder. The extract of the code your interested in changing is below:
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
/** \def USE_PAROLA_HW Set to 1 (default) to use the Parola hardware modules. The software was originally designed to operate with this hardware type. */ #define USE_PAROLA_HW 1 /** \def USE_GENERIC_HW Set to 1 to use 'generic' hardware modules commonly available, with connectors at the top and bottom of the PCB, available from many sources. */ #define USE_GENERIC_HW 0 /** \def USE_ICSTATION_HW Set to 1 to use ICStation DIY hardware module kits available from http://www.icstation.com/product_info.php?products_id=2609#.UxqVJyxWGHs This hardware must be set up with the input on the RHS. */ #define USE_ICSTATION_HW 0 /** \def USE_FC16_HW Set to 1 to use FC16 hardware module kits. FC16 modules are similar in format to the ICStation modules but are wired differently. Modules are identified by a FC-16 designation on the PCB */ #define USE_FC16_HW 0 /** \def USE_OTHER_HW Set to 1 to use other hardware not defined above. Module 0 (Data In) must be set up on the RHS and the CUSTOM hardware defines must be set up in the MD_MAD72xx_lib.h file under for this section, using the HW_Mapper utility to work out what the correct values to use are. */ #define USE_OTHER_HW 0 |
As you can see you need to set to a “1” the “#define” of your matrix hardware module. however as I mentioned for myself and possibly you this information is not always available. So in this case you just need to set each module to a “1” in turn, then upload and see if it works. You also need to remember to set the all the ones you are not using to “0”. For example by default the parola hardware is enabled by this define being set to “1”
#define USE_PAROLA_HW 1
and all the other options are set to “0”. So if you don’t know your hardware and this option doesn’t work then you will set this to “0” by altering the line to
#define USE_PAROLA_HW 0
and then enabling the next hardware in the code, which is
#define USE_GENERIC_HW 0
change this line to
#define USE_GENERIC_HW 1
So we only have one hardware type enabled at a time. Upload and try this, if it works then great, move on to the next section, else repeat for the next hardware type. For myself I repeated this until I got to this hardware line
#define USE_FC16_HW 0
setting this to “1” made my board work as it should 🙂
The Code
A few paragraphs below is the code for the Christmas Jumper, you will note that we have an “#include” line for the MD_MAX72xx library that we have just installed. But in addition it has a this line
#include <MD_Parola.h>
We need to get this library which includes lot s of useful functions for animating text and characters on a LED Matrix Display. It only works with the MD_MAX72xx library that we have previously installed. So go to this github link:
https://github.com/MajicDesigns/MD_Parola
Click “Clone or Download” to download the files as a single zip file. Then install into your Arduino IDE as we have done earlier.
Next Copy the code below into your new Arduino Project and upload to your board. Click the “Click to Expand” bar and then just place your mouse over the code and a menu bar will appear at the top, click the copy icon (far-ish right above the code) and then do a CTRL C to copy and then a CTRL V to paste into your Arduino editor
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
// Christmas Animations and Text // // NOTE: MD_MAX72xx library must be installed and configured for the LED // matrix type being used. Refer documentation included in the MD_MAX72xx // library or see this link: // https://majicdesigns.github.io/MD_MAX72XX/page_hardware.html // #include <MD_Parola.h> #include <MD_MAX72xx.h> #include <SPI.h> // Define the number of devices we have in the chain and the hardware interface // NOTE: These pin numbers will probably not work with your hardware and may // need to be adapted #define MAX_DEVICES 4 #define CLK_PIN 13 #define DATA_PIN 11 #define CS_PIN 10 // Hardware SPI connection MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES); // Arbitrary output pins // MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES); #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) // Global data typedef struct { textEffect_t effect; // text effect to display char * psz; // text string nul terminated uint16_t speed; // speed multiplier of library default uint16_t pause; // pause multiplier for library default } sCatalog; uint16_t SnowSpeed; uint16_t AnimationSpeed; uint16_t BellAnimationSpeed; // User defined characters, first byte is number of bytes in defintion followed // by the bytes themselves. The char itself is rotated 90Deg to Right in the // defintions below so that it can be as long as required. Height fixed at 8 pixels uint8_t VBlankLine[] = { 1,0 }; uint8_t XTree[] = { 9, B01000000, B01100100, B01110110, B11111111, B11111111, B01110110, B01100100, B01000000, B00000000, }; uint8_t Sleigh[] = { 48, B01111111, B10111110, B10111110, B11111100, B11111100, B10111100, B10111100, B10111000, B00111011, B00111111, B10111010, B11111000, B10111100, B00111110, B00100000, B00100000, B00100000, B10010000, B01010000, B00111000, B00110000, B00111000, B00111000, B01001110, B10011100, B00011000, B00100000, B00100000, B10010000, B01010000, B00111000, B00110000, B00111000, B00111000, B01001110, B10011100, B00011000, B00100000, B00100000, B10010000, B01010000, B00111000, B00110000, B00111000, B00111000, B01001110, B10011100, B00011000 }; uint8_t Bell1[] = { 8, B00011111, B00011111, B00001111, B00001111, B00000111, B00000111, B00000011, B00000001, }; uint8_t Bell2[] = { 10, B00000011, B00000111, B00001111, B00011111, B00111111, B01111111, B11111111, B00111111, B00001111, B00000011 }; uint8_t Bell3[] = { 10, B11000000, B11110000, B11111100, B11111110, B11111111, B11111111, B11111110, B11111100, B11110000, B11000000 }; uint8_t Bell4[] = { 10, B00000011, B00001111, B00111111, B11111111, B01111111, B00111111, B00011111, B00001111, B00000111, B00000011 }; uint8_t Bell5[] = { 8, B00000001, B00000011, B00000111, B00000111, B00001111, B00001111, B00011111, B00011111 }; uint8_t Baubles[] = { 13, B00001100, B00011111, B00001100, B00000000, B00000000, B01110000, B11111000, B11111111, B11111000, B01110000, B00000110, B00001111, B00000110 }; sCatalog catalog[] = { { PA_PRINT,"BELL",1,1}, { PA_DISSOLVE, "@ @", 15, 5 }, { PA_SCROLL_RIGHT, "&", 5, 0 }, { PA_BLINDS, "Merry", 7, 1 }, { PA_SCROLL_LEFT, "Christmas", 3, 1 }, { PA_SCROLL_RIGHT, "Ho,ho,ho", 3, 1 }, { PA_PRINT,"STARS",1,1}, { PA_BLINDS, "|$$$", 10, 3 }, { PA_SCROLL_UP, "Santa", 3, 1 }, { PA_SCROLL_UP, " is", 3, 1 }, { PA_SCROLL_UP, "coming", 3, 1 }, { PA_SCROLL_RIGHT, "&", 5, 0 }, { PA_SCROLL_LEFT, "Are you on the", 3, 1 }, { PA_SCROLL_RIGHT, "naughty", 5, 1 }, { PA_GROW_UP, "or", 12, 1 }, { PA_GROW_DOWN, "nice", 5, 1 }, { PA_FADE, "list?", 20, 1 }, { PA_SCROLL_UP, "Snow", 8, 0 }, { PA_SCROLL_UP, "is", 8, 0 }, { PA_SCROLL_UP, "coming", 8, 0 }, { PA_PRINT,"SNOW",1,1}, { PA_SCROLL_RIGHT, "Dec 25", 3, 1 }, { PA_SCROLL_DOWN_LEFT, " are", 3, 1 }, { PA_SCROLL_DOWN_RIGHT, "you", 3, 1 }, { PA_SCROLL_LEFT, "ready?", 3, 1 }, { PA_SCROLL_RIGHT, "&", 5, 0 }, { PA_PRINT,"BELL",1,1}, { PA_FADE,"Elves",20,1}, { PA_BLINDS,"are",8,1}, { PA_CLOSING_CURSOR,"busy",8,1}, { PA_OPENING_CURSOR,"Noel!",8,1}, { PA_SCROLL_RIGHT, ":) :) :) :) :)", 3, 1 }, }; /* sCatalog catalog[] = { { PA_PRINT, "Merry Christmas", 1, 1 }, { PA_SLICE, "Ho ho ho", 1, 1 }, { PA_MESH, "MESH", 20, 1 }, { PA_FADE, "FADE", 20, 1 }, { PA_WIPE, "WIPE", 5, 1 }, { PA_WIPE_CURSOR, "WPE_C", 4, 1 }, { PA_OPENING, "OPEN", 3, 1 }, { PA_OPENING_CURSOR, "OPN_C", 4, 1 }, { PA_CLOSING, "CLOSE", 3, 1 }, { PA_CLOSING_CURSOR, "CLS_C", 4, 1 }, { PA_RANDOM, "RAND", 3, 1 }, { PA_BLINDS, "BLIND", 7, 1 }, { PA_DISSOLVE, "DSLVE", 7, 1 }, { PA_SCROLL_UP, "SC_U", 5, 1 }, { PA_SCROLL_DOWN, "SC_D", 5, 1 }, { PA_SCROLL_LEFT, "SC_L", 5, 1 }, { PA_SCROLL_RIGHT, "SC_R", 5, 1 }, { PA_SCROLL_UP_LEFT, "SC_UL", 7, 1 }, { PA_SCROLL_UP_RIGHT, "SC_UR", 7, 1 }, { PA_SCROLL_DOWN_LEFT, "SC_DL", 7, 1 }, { PA_SCROLL_DOWN_RIGHT, "SC_DR", 7, 1 }, { PA_SCAN_HORIZ, "SCNH", 4, 1 }, { PA_SCAN_HORIZX, "SCNHX", 4, 1 }, { PA_SCAN_VERT, "SCNV", 3, 1 }, { PA_SCAN_VERTX, "SCNVX", 3, 1 }, { PA_GROW_UP, "GRW_U", 7, 1 }, { PA_GROW_DOWN, "GRW_D", 7, 1 }, }; */ void setup(void) { P.begin(); P.addChar('&', Sleigh); P.setInvert(false); P.addChar('$', XTree); P.addChar('|', VBlankLine); // Bell Animations P.addChar('6', Bell1); P.addChar('7', Bell2); P.addChar('8', Bell3); P.addChar('9', Bell4); P.addChar('0', Bell5); P.addChar('@', Baubles); P.displayReset(); AnimationSpeed=200; BellAnimationSpeed=200; SnowSpeed=10*P.getSpeed(); for (uint8_t i=0; i<ARRAY_SIZE(catalog); i++) { catalog[i].speed *= P.getSpeed(); catalog[i].pause *= 500; } } void loop(void) { //AnimateBell(); ///FlashingStars(); // Snow(); for (uint8_t i=0; i<ARRAY_SIZE(catalog); i++) { if(SpecialAnimations(catalog[i].psz)==false) { P.displayText(catalog[i].psz, PA_CENTER, catalog[i].speed, catalog[i].pause, catalog[i].effect, catalog[i].effect); while (!P.displayAnimate()) ; // animates and returns true when an animation is completed } delay(catalog[i].pause); } } bool SpecialAnimations(char *Code) { // returns true if performed a special animaton (based on code) else false if((Code=="BELL")|(Code=="SNOW")|(Code=="STARS")) { if(Code=="BELL") AnimateBell(); if(Code=="SNOW") Snow(); if(Code=="STARS") FlashingStars(); return true; } else return false; } void AnimateBell() { for(int i=0;i<3;i++) { P.displayText("||||6",PA_LEFT,0,AnimationSpeed,PA_PRINT,PA_NO_EFFECT); while (!P.displayAnimate()); P.displayText("|||7",PA_LEFT,0,BellAnimationSpeed,PA_PRINT,PA_NO_EFFECT); while (!P.displayAnimate()); P.displayText("||||||8",PA_LEFT,0,BellAnimationSpeed,PA_PRINT,PA_NO_EFFECT); while (!P.displayAnimate()); P.displayText("||||||||||9",PA_LEFT,0,BellAnimationSpeed,PA_PRINT,PA_NO_EFFECT); while (!P.displayAnimate()); P.displayText("||||||||||0",PA_LEFT,0,BellAnimationSpeed,PA_PRINT,PA_NO_EFFECT); while (!P.displayAnimate()); P.displayText("||||||||||9",PA_LEFT,0,BellAnimationSpeed,PA_PRINT,PA_NO_EFFECT); while (!P.displayAnimate()); P.displayText("||||||8",PA_LEFT,0,BellAnimationSpeed,PA_PRINT,PA_NO_EFFECT); while (!P.displayAnimate()); P.displayText("|||7",PA_LEFT,0,BellAnimationSpeed,PA_PRINT,PA_NO_EFFECT); while (!P.displayAnimate()); } } void FlashingStars() { for(int i=0;i<8;i++) { P.displayText("* + *",PA_CENTER,0,AnimationSpeed,PA_PRINT,PA_NO_EFFECT); while (!P.displayAnimate()); P.displayText("+ * +",PA_CENTER,0,AnimationSpeed,PA_PRINT,PA_NO_EFFECT); while (!P.displayAnimate()); } } void Snow() { P.displayText("* * *",PA_CENTER,SnowSpeed,0,PA_SCROLL_DOWN,PA_SCROLL_DOWN); while (!P.displayAnimate()); P.displayText(" * *",PA_CENTER,SnowSpeed,0,PA_SCROLL_DOWN,PA_SCROLL_DOWN); while (!P.displayAnimate()); P.displayText("* * * *",PA_CENTER,SnowSpeed,0,PA_SCROLL_DOWN,PA_SCROLL_DOWN); while (!P.displayAnimate()); P.displayText("* * *",PA_CENTER,SnowSpeed,0,PA_SCROLL_DOWN,PA_SCROLL_DOWN); while (!P.displayAnimate()); } |
Now you may get some warnings, I did on a different new Arduino install on a new computer but on my older one I didn’t (don’t know why, didn’t investigate) but ignoring them was fine and the code ran without issues.
Fitting into a jumper/sweater
My jumper was double layered (rare I think but I’m no clothing guru!) and I just cut into the second layer, placed the module inside and then stitched around so that it didn’t fall down. If you have a single layer jumper/sweater you will need some donor fabric (perhaps from an old T-Shirt) to stitch around your module to keep it in place. You will need a similar pocket for your power-bank power supply or tuck that into a trouser pocket. When stitching you will need a thread that is the same colour as the front of your sweater so as not to show up. Below are some pictures of my jumper being modified.
Working out where to position display
Cutting a pouch into the lining layer (you may need some material instead, if you’ve no lining)
Stitching around the display module so it doesn’t fall in the lining or come out of place. Small slot left for easy removal when washing jumper.
The completed stitching, again if you had no lining then you will have stitch a piece of material here to hold the display module. creating a pocket.
The completed jumper, note how the module sits higher than I intended – oops, I think if I’d placed it over an ironing board so that I only had the front layer accessible I would have found it a bit easier when stitching.
And a happy new year!
That’s it, just a bit of fun for the festive season 🙂 If your reading this shortly before the big day then Happy Christmas and have a great new year 🙂 !!!