Fab Academy 2018

Wk12. Output Devices


Assignment: Add an output device to a micro-controller board you’ve designed and program it to do something.


Controlling LEDS

This week I decided to attempt Charlieplexing. This is a way of controlling multiple LEDs with a minimum amount of pins. However, understanding the theory behind this is not that simple and took some head scratching. Especially, as none of our instructors had done this before, so I was relying on plenty of online examples. Here are my references:

Charlieplexing: in a nutshell.

Charlieplexing was elaborated by a guy called Charlie Allen in 1995 and is form of multiplexing that uses relatively few I/O pins on a microcontroller to drive an array of LEDs. Multiplexing, also lets you control a large number of LEDs from fewer pins, taking advantage of 3 things:

The path of least resistance

Charlieplexing basically takes it to the next level. As well as using uni-direction of diodes and the HIGH-Z state to manipulate persistence of vision; it also exploits the voltage drop across LEDs. This means that given a choice between lighting one LED and lighting two in a series, the current will always choose the path of least resistance.

Fringeneering explains it best in an image:

Charlieplexing

As you can see above, the formula for how many pins to control how many LEDS in Charlieplexing is Nx(N-1) where N is the number of pins available. So say we have 4 pins available 4x(4-1)=12 this means we can light 12 LEDS. Or say 5x(5-1)=20 and 6x(6-1)=30, and so on.

Designing a 30 LED array

After figuring this out, I went ahead and redesigned Neils baord making extra use of the available pins on the ATtiny44 to attempt an array of 30 LEDS. I also decided to add a button.

The design phase in Eagle took me much longer than I anticipated, as the layout of a charlieplexed array is quite confusing at first. Schematics also complicate things because you cannot draw diagonal connections, which help as the image shows below, understand the circuit logic.

I also decided instead of wasting tonnes of time on soldering 0 ohm resistors as bridges, I would create a vinyl layer on top as Neil shows here.

Charlies Angels

Milling and soldering

Here I also ran into trouble in the milling. First off, I had forgotten to check my Design Rules Check in Eagle, making sure that my traces were sufficiently spaced apart. This meant that my first board, although it looked fine, did not mill the traces properly as the first image shows. At first, I tried to use a cutter but ended up messing up the other traces and all was lost. Back to the Eagle board! ARG.

With a board finally milled I could get round to soldering. Well, as you can imagine there were 30 LEDS to solder and each needed to face in the right direction. Below you can see me making sure which side is the cathode and which is the anode using the multimeter. The cathode side tends to be marked with a line but this changes with different colour LEDs so it’s good to check.

I started soldering the ATtiny44, SMD header, switch and other main bits of the board before cutting out my sandwich layer with the vinyl cutter. I had basically imported the same PNG used for milling in photoshop (to keep the dimensions) and erased all but the LED holes. This worked out nicely.

Finally, I could paste on my vinyl layer and get soldering the 6 x 499 resistors and 30 LEDs. Important, I forgot about the connecting strips of copper wire until I had already put the solder on. Next time it would be probably best/neater/easier to do this before.

Charlieplexing

Finally, soldering done and I could get round to programming. I was curious to see what would happen if I just ran Neil’s code from the Arduino IDE and then added my missing pins. See here:

charlieplex2

What I learned

Charlieplexing is a rather complex but very useful way of controlling more LED’s with fewer pins. There are downsides to this method, first of all because Charlieplexing requires the LED’s to be individually addressed, rather than being lit by a column or row this can hamper the refresh rate of the display. Secondly, I was only using single colour LED’s but different colours have slightly different voltage drops so if you wanted to do this method with multicolour LEDS you might find them lighting up when they are not supposed to.

Also Remember…

Do yourself a favour and DESIGN RULES CHECK your Eagle board before exporting and milling it. Nuff said.


You can download all my design files for week 12 from my Gitlab repository.