Wednesday 22 May 2019

Soldering Kata

7x7 LED Matrix
When I were a lad, LEDs were a big deal, literally: £1 each. Now someone in China manages to make a living selling them for £1 for 100. With inspiration provided by an Instructable, a rainy afternoon and the need for some soldering practice I set to work.

The Instructable's, err, instructions were clear enough:

  • take a piece of protoboard (the sort with pads instead of strips)
  • solder each row of LEDs anode (longer) first to hold them in place
  • cut the cathodes to size and bend them through 90 to connect each row's together
  • test each row after soldering!
  • I then cut a piece of stripboard ("veroboard") into single strips and connected each column's anodes together in a sort of DIY dual-layer PCB arrangement, see below.

Rear view: anodes connected in columns

The last step was the only point where I deviated from the instructions. (I first attempted to fit a single piece of veroboard over all of the anodes but found this impossible: there was too much variation in their positions. Perhaps aligning each row of LEDs as it is soldered using veroboard might work?)

Next: mount vertically on breadboard, add a handful of resistors (470R) and connect to an Arduino!

I wrote an Arduino library for it, available on Github. It contains a couple of examples, the simplest can be seen running below. (The moving light makes keeping the camera focussed impossible, sorry.)




The disadvantages of this bit-banging approach to driving an LED matrix are fairly well-known:
  • it uses an excessive number of GPIOs (14 here)
  • the GPIOs themselves can't supply very much current, so the more LEDs lit, the dimmer they are
  • PWM-style dimming is not practical
  • timing is tricky: since it relies on persistence of vision to work, each refresh cycle must take no more than 40ms
For all of these reasons, using a dedicated driver chip is recommended. More when my MAX7221 (another £1) arrives on the ship from China in a couple of weeks!