The first story (http://lucstechblog.blogspot.nl/2017/09/charlieplexing.html) told you some general info on wiring and software for this technique
The second story (http://lucstechblog.blogspot.nl/2017/09/chalieplexing-2.html) eleborated a bit more on the software specifics
And the third story (http://lucstechblog.blogspot.nl/2017/09/charlieplexing-3-hardware.html) told you more about how to put it all on a stripboard.
And now we are going to build a practical implementation.
A bit of background.
One day in the week I walk to my work and back. It is a 5km (about 3 mile) walk and it takes me about 45 minutes to get to my work. In the evening it takes again 45 minutes to walk the 3 miles back. During the summer that is no problem. But during the winter months I start walking when it is dark and in the evenings it is dark again. Next to that my stroll takes me through some roads where there is no streetlights at all. So I decided to place some light on my rucksack. But I did not wanted ordinary lights. I wanted a Larson scanner.
Larson Scanner ???
Well not all of you might know what a Larson scanner is. In the seventies of the last century there was a (now) cult TV series called Battlestar Galactica. Not to be confused with the remake from 2004 which in my opinion was to politically, less humoresque and to sophisticated. In the original series the bad guys where the Cylons. Robots that had no eyes but a series of leds that lit up from left to right and then back again. This was invented by the producer Glen A. Larson. He used the same running leds in a series called Knight Rider in which there was a car, called Kit, that had the same sequencing leds in his nose cone. So in honor of its inventor the name Larson Scanner is still used for a sequencing range of leds.
Lets build one.
I decided that a Larson scanner with twelve leds was enough. So here is the schematic for that.
I first build a prototype on breadboard and here I give you a neat trick for this kind of project. I really want to advise you that you'll make a prototype on a breadboard to. It helps to track errors.
Put all the leds on the middle section of the breadboard. That keeps things neat and clear.
On each side of a breadboard there are lines for ground and power. Now in our setup we do not need ground and power because the Arduino (Attiny´s) pins are going to supply the needed power. So we can use those as leads for the pins where the leds will be attached to. Just like the four leads on the stripboard.
So here is the stripboard layout.
I left the Attiny out for clarity.
Just antother small advise. Put the Attiny85 on a socket so it is easy to remove and re-program.
The leds I used where scavenged from Christmas decorations just like I described in this article.
So let's have a look at the software.
The software starts with an array that contains all the led connections as they are connected to the Attiny85.
Next in the main loop there is a loop that counts from 1 to 12 and puts one led at a time on. When that loop has finished a second loop starts which counts backwards from 12 to 1 and puts the according led on again. This way the leds sequence forwards and backwards again. This is repeated endlessly.
The alloff() routine puts all leds at the same time off by setting all Attiny85 pins as an Input.
The ledon() routine takes a numer from 1 to 12 (coming from the main loop) and looks it up in the array. In the array it finds which Attiny85 pin should be set HIGH and which pairing pin should be set LOW. It waits a short time and returns to the main loop in which another led is choosen.
That's all. Pretty simple.
The power supply.
This all uses just a small amount of power. In my January entry I showed you a cheap USB power meter. This measured just 0.03 amps.
So this could easily be powered using some AA batteries. However I soldered an USB connector to the stripboard and power the Larson Scanner from an USB power bank.
My stroll to my work takes about 45 minutes. And offcourse 45 minutes again in the evening when I walk homewards. My powerbank can feed the Larson scanner for about 60 hours calculated by the values found with the USB power meter. So I am on the safe side.
The housing.
As I was going to mount this on my rucksack I needed a sturdy housing that was somewhat waterproof (hey it rains here sometimes, this is the Netherlands you know). So I designed a housing in Tinkercad which you can see here:
The box is deep enough to house the stripboard with arduino and all the leds.
I glued the lid on with hot melt glue, and did the same with the handles.
The end result looks like this.
And a small video that shows you how it functions:
So what rests is the STL file for your convenience and the Arduino source file. Here you go.
Larson Scanner box
Lid for Larson scanner box
Arduino source file
Till next time
have fun
Luc Volders