Early on in my adventures in the Arduino / micro controller world one of my goals has been to usher an idea from paper, to breadboard, to protoboard, to real PCB board. After a long night of soldering, I decided to take a break and start to post my adventure.
I learned early start simple and build on what you know. In that vein I took the idea of making digital dice. To date I am up to the proto-board phase. I am making an actual “digital die” I can give as presents for this Christmas season. By next year I will have time to figure out the CAD software I will need.
I had an idea how to start the project, this will be simple. I grabbed my Arduino Uno, 7 LEDs, and my breadboard. 7 lights, 7 pins, and away I went. After a giggle of joy over seeing it work, I stared at it wondering how I was going to make a box that looked reasonable to fit the Uno. That idea was quickly nixed. In my readings and forum lurkings I had heard of the different chips in the ATmel family of microprocessors. With a little digging I soon found the ATtiny85 which seemed like it would fit the bill I was looking for. Small footprint and just a few pins. Dang, I have 7 LEDs with 7 pins and this little guy sure doesn’t have enough, or does it.
While awaiting my ATtiny order, I used the time to research a little more about this new turn I took (with little foreknowledge save it should work). I also waded through the data sheet for the ATTiny family to find out more of their capabilities. You can find the information here. There is a method to control more than 1 LED pre pin. The method is known as Charliplexing. Here is an example to get you going.
My apologies for a lack of pictures here early on. I was too involved to remember to take any.
With a little more knowledge in hand it is time to draw out how one might control the LEDs. Knowing how a die is made with the numbering scheme as dots we need a total of 5 to replicate what an actual one looks like and how they will light up in turn. With 4 pins I can control the 7 LEDs to make the 6 numbers.
Now that I had my little 85’s in hand I took to the breadboard to see what I could come up with. It took a couple of tries to a) double and triple check my wiring (make sure ground is going to ground!) b) at the same time learning how to program the ATTiny.
So, here is where there is a branch. I am going to take a quick detour on the ATtiny85. The ATT85 is part of the Atmel family of microprocessors. The ATT85 has fewer pins, less memory, and slower than what you find on the Arduino Uno board. None of these are an issue for this project and in all ways a big plus as I want this project to be small in size. There are breakout boards and programming boards one can use to program the ATtiny85 and there is the use-what-you-have-it-works-pretty-darn-well method too. I went with the later of them. Here is one of the sites I researched when planning on how to get my code on the ATTiny85.
The wiring is pretty straight forward, just follow the diagram. If it is your fist time trying this out, the blinking LED exercise if a good one; if for nothing else getting you used to setting up and uploading code to it.
On the right hand side of my breadboard you can see the ATTiny85, wire up and running the die code. In this version I am using a button switch instead of the motion switch.
It works. I have my ATtiny85 programmed with my die code, wired up to the LEDs, and it is working! I have that giddy feeling all over again, but than the sigh. Even if I get a small breadboard it still won’t look quite right. I guess it is time for another plunge and learning experience. That is a good deal of why I started tinkering in this digital world.
I knew what was next, I had to solder it all on some protoboard. You know those green or tan sheets with holes (well some have holes predrilled) that you can solder little parts onto. I made out my list of parts and pulled them all before I began. This hasn’t been your weekend type project. Between family, work, and other of life’s bits it has taken me a few weeks by now. And those boats from China really are slow!). And it has taken me more than one try to get to this point.
This is my first try at a full-on, solder it up type project. I didn’t think I would get it right on the first try, but Oye Vey! It almost worked, but my voltage readings were waaaaaay low by time I measure at the LED pins. Oh well, I will not be deterred and try again.
It is time to move forward, remembering mistakes made, and get it right this time. Before this attempt, I went to a good friend of mine who is an EE and quite the hardware hobbyist. He gave me a couple of quick, and very informative soldering lessons. During my lesson I learned that my lead-free solder was causing me some issues as it takes a higher heat to use and even slightly higher heat to reflow. Before tackling this next part, I was sure to procure some leaded solder and it makes a difference.
The first thing I started to thing about, beyond the predetermined layout for my LEDs, was how to best wire them. My end goal being a manufactured PCB, so why not use this exercise to start to think in that mode. All LEDs have 2 leads, one for ground and one for power. I started by arranging as many LEDs as I could with the ground pin on the outside of the board. This way I can chain them together to create an easy ground path.
The only one I needed to worry about was the inner LED. In its’ case I bent the ground pin over to the main ground path. It reached with some to spare.
Now I started to look at connecting the power for the LEDs. Where I could, for aesthetics, I ran a straight wire on top of the board. This keeps the wire count below down and gives it a nice look (I think).
Working with the back I tried to keep the lines as clean as possible too. The backside is a little more of a challenge.
In a yet another branch, while on my travels, it was noted that the ATtiny13 might work in this case as well. The memory footprint is smaller, but than the sketch for this project isn’t that big to begin with. I ordered a few in one of my bundles. Since I have a socket on the board, it will be easy to test!
I have four pins left to solder and apply power for the big test. That will be tonight. I will be sure and let you know how it goes.
Keep up with my progress over at wrightmac.net I am not done yet. 🙂
BOM (Bill of Materials)
1 ATTiny85 (read a little lower for more on this choice)
7 LED, 5mm
1 Motion switch
1 Various 24AWG solid core or stranded wire
1 Soldering iron