Friday 27 April 2018

Lighting Up

A tinted perspex f-board is going to be supported along each edge by some carbon extrusions. This will give me a 'tunnel' under the f-board where the LEDs can be positioned. Although missing from the WorldSemi datasheet, the WS2812B devices I sourced measure about 1.7mm high. They will be soldered to a 0.8mm thick PCB, with decoupling capacitors on the other side which should end up as around 3.5mm thick overall. The carbon extrusion is 4mm square which gives 0.5mm of wiggle room.

The neck width at the nut is 38mm (1.5"). With a pair of 4mm extrusions supporting the f-board, this leaves a tunnel width of 30mm. At the other end of the neck the width is 63mm (2.5") leaving 55mm of tunnel width. To keep the display consistent, I need to use the same quantity of LEDs across the width along the whole length of the neck so they will have to fan out. Although 30mm should in principle allow six 5mm LEDs, I want one of the modes to simulate traditional marker dots which will be down the centreline of the neck. This requires an odd number, so five LEDs across the width of the neck it will be. This gives a device-to-device pitch of 6mm at the nut. At the other end of the neck, the device pitch will be about double that.

Along the length of the neck, I cannot achieve the same pitch as I will need to get my soldering iron in there! After juggling some dimensions around, I have decided that a 7.5mm pitch is more realistic in the other direction. For a 21-fret, 34" scale neck and a display length of 600mm this requires 80 LEDs in each row, giving a total of 400 LEDs!

Each LED can take a maximum of 50mA (also missing from the datasheet) when all three colours are driven together. For 400 LEDs running at full beans, the guitar's 5V supply will need to provide 20A and the LEDs will collectively dissipate 100W!!! Ouch! At best this will cause it to go out of tune, at worst its a fire waiting to happen! 

The prospect of running this beast off a battery is a non-starter. The size and weight of a battery capable of 2-3 hours operation is not something I want to be lifting all the time whilst playing. It's going to need power sent down the lead. 

After further consideration, the maximum current is unlikely to happen as I'll be deciding how many LEDs are on at any one time, and also white isn't that interesting, so I will be more likely to be running single colours or combinations of two. So 2/3 of the colour, and maybe 1/2 of the LEDs are usually off gives a better (safer?) estimate of around 7A of current consumption. The neck should only(!) be dissipating 35W in that case which is barely a small fire. 

With some major design criteria understood, its back to the fun stuff. I bought a microchip PIC24EP256MC202 and a 8x5 device WS2812B test board to prove the concept. The PIC is a 16bit device and runs at up to 70MHz, but still has a DIL package for development. The 8x5 board needed a bit of hacking to get it from 40 serially connected LEDs to five lots of 8 serially connected LEDs. The PIC can be used with the Microchip's MPLAB X IDE software (free!) which provides a C compiler environment and makes coding for larger projects easier than trying to do it all in assembler. 

After pinching some code to get me started (thanks Robin!) I was able to get a line of LEDs lighting up in different colours. This proved I had the right pins connected and the logic the right way up. After that I wanted to control the five rows of LEDs more-or-less simultaneously. I didn't want an obvious ripple effect causing the bottom right LED to be noticeably lagging the top left. The WS2812B datasheet shows the critical timing is the width of the high pulse. A short high is seen by the LED as a zero, whereas a long high is seen as a one; after that the timing is more relaxed. During the relaxed time period I start to send data to the next row. The overall effect is to write to a column of five almost in parallel before moving on to the next five. After spending some time debugging with the oscilloscope, it finally started clocking out patterns taken from an array. Bingo!

The LEDs are so bright I had to cover the 8x5 board with tinted perspex so the phone camera didn't saturate too much. The development board can be seen on the right with a red PicKit3 programmer sticking up. It works! I'm excited! Still a way to go though...

No comments: