This was meant to be a one-off, lets just have some fun kind of project. I was once told if you don’t learn something new everyday it just wasn’t a day. And I did learn in my eagerness for some quick video gaming gratification.
I had been trolling through my parts box and thinking of a fun project to work on. Then I remembered two things. First was the ATTiny85 video games. I always have ATTinys laying around so this would be great. I checked the BOM and I had everything save the PCB boards and they are available on OSHPark. I even had a spare OLED screen in my display box. COOL. And, and, a way back I had an online bump in with Drew of OSHPark and he had sent me a gift certificate for boards. Excellent. I quickly put in my order and it was under $4.00 so still plenty left on the coupon to get my first PCB designed board done.
I placed the order and forgot about it for a while. After all of the slow boat from China orders I tend to forget about things once I order them, I can’t stand being obsessive over something that is just going to take its time. Anyhow, low and behold one day when I get home from work there is a little package from OSHPark. I quickly get into it and see the 3 pretty purple boards and my OSHPark sticker for the collection, just waiting for a quick trim with the Dremmel and then get populated.
When I wasn’t waiting for the boards I took the time to program a ATTiny85 and breadboard it up with the screen. I wanted to make sure the big parts were ready and working for when the boards showed up. I almost wired up buttons, but it was about 2:00am and it was time for some slumber.
I was giddy at work just itching to get home and put all of the parts together and play some Tetris. And to be honest it has been quite a while since I have played it. Alright already, all of the parts are laid out and the iron is hot.
There I go. It took about an hour to get it all soldered up. I was trying to be extra nice, and neat. While my soldering skills are markedly better than they were a year ago, practice makes perfect and I am still working towards that goal. Once it is done the big moment, time to slide in the battery. I rummage in the battery drawer and pull out a CR2032 and pop it in. And nothing.
Really, nothing. Take it out and make sure I have positive facing up, yup. One more try and nothing. I pulled out my multimeter and check the battery 2.1V. Doesn’t that figure and I wait another day as it is again about 1:30am’ish (I work second shift so tend to have late hours in the studio).
I grab a two pack early the next morning and try it again. NOTHING! Well shit and shoved in it Wilbur I am getting a little annoyed by this time. I pull out my meter again and start checking continuity and don’t find any issues. I put the battery back in and start checking my voltages. All the pins have power and reading at the correct levels. WTH?
I sit down and start doing a little web surfing while keeping a picture of the Pocket Tetris on my screen. What could be wrong? Well it is a funny little story about CAREFULLY checking what pins go where and which pins you have there after staring at one’s problem for a good long while. There was a dope slap and a DOH! involved when I saw it.
Now this simple, fun, quickie project will have to wait a little while longer. That was my only spare screen and I don’t have a solder sucker (yet). So while another slow boat makes its way here with new screens, with the CORRECT pinouts, and a solder sucker I have other projects to move onto. New high scores will have to wait for another day.
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 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.