ATTiny Dice

Early on in my adventures in the 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 the post about it all.

I learned early in life, 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 photo-board phase. I am making an actual die I can give as presents for this Christmas season.

I had an idea how to start the project. 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 as a die.

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, just a few pins, and it works with my Arduino Uno knowledge. 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 it should work). I also waded through the data sheets 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.

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 7 to replicate what an actual one looks like and how they will light up in turn.

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 (one I kinda of started already). I am going to take a quick detour on the ATtiny85. I know that the ATT85 is part of the Atmel family of microprocessors. The ATT85 has fewer pins, less memory, less power, and slower. 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 such as the Digispark, 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.

With the Uno it is as straight forward as connecting it to my Mac with a USB cable and upload the sketch. With the ATtiny85, I used the Uno as the ISP

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!).

BOM (Bill of Materials)

1     Protoboard

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

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.