Arduino Christmas Jumper 2017

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 ConnectionNano ConnectionPro-MicroUno
VCC5V5V5V
GNDGNDGNDGND
DIND11 (Mosi)16~11
CSD10 (SS)5~10
CLKD13 (SCK)1513

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:

MD_MAX72XX-master

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:

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

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 🙂 !!!