COMPLETED: Heart Keepsake Project: My first serious electrical project build-log thing I guess

Around the time before valentines day, I got the idea of making some sort of gift thing for my girlfriend, SpiritSai. Since I was just starting to transition into designing circuit boards and stuff, I figured I would make her something she could hold. Thus, this project began.

SECTION 01: Ideas and Part Aquisition

Part 1: Idea

The idea started out as some type of necklace thing with a small display that said something nice, on the push of a button. The final product would be shaped like a heart, and have some sort of enclosure.

Basically, it needed to be:

  • Shaped like a heart
  • Small enough to possibly wear as a necklace or easily hold
  • Simple to use
  • Have an easy to replace battery
  • Be green somehow

Part 2: Parts

Since the final product needed to be relatively small, I had to be careful with what parts I used.

I went though multiuple different screen options before settling on this 8x8 LED matrix display. I also got the display’s “backpack” board, as designing the driver circuit for the matrix into the main board is outside of my current abilities.

I decided to use an ATtiny85 as the project’s microcontroller. I already have experience with it, I am able to easily prototype its code on my Arduino, and program the ATtiny with it as well. 

On top of all of that, I had to design it for use with a standard 3 volt coin cell, since anything else would end up making the result too thick. I also needed to use a special battery holder that would allow the battery to be easily replaceable.

SECTION 02: Part Testing and Prototyping

Part 1: The Arduino

Soon after selecting and ordering the parts, I was able to start testing the parts and prototyping this project.

I started with testing the display by writing text and pictures to it.

Not long after that, I got to where I could push a button, have the display turn on, display the message, display a short “animation”, and turn off. All was going well.

Part 2: The Attiny

I then brought the ATtiny85 in, and adapted all the seemingly obvious parts of my code for it. (pins, etc) However, the compiled code ended up being too large to fit in the 8 kilobytes of space I had to work with.

I tracked down the main culprit as being the Arduino Wire library. I replaced it with a library made for the ATtiny microcontrollers, TinyWire. I changed my code as necessary, and it complied and uploaded.

My first problem finally surfaced with the bottom row of the matrix displaying the problem in the video above. Since the soldering of the display’s bacpack was fine, and it worked perfectly on the Arduino, I substituted in a replacement Attiny85 to test, but the same problem still persisted.

Since my programming skills are limited, I spent at least a few days searching and trying to track down the problem. Halfway through the search, I made this forum post, but received no help. Yet, I kept searching. I attempted slimming down the code to only run the display, reducing RAM usage, but nothing was working.

I eventually ended up looking through the TinyWire library, just to see if I could find anything. As shown in that forum post above, I stumbled upon the buffer size line. Since the problem did seem like the display wasn’t getting all the information it needed, I increased the buffer size value. It was a success, and it now worked exactly as it did on the Arduino.

Part 3: Sleep

Since the final product would essentially always be using power, I had to find a way to limit power usage when the device was not actually being used. As a start, I followed Sparkfun’s low-power guide. This helped bring down my project’s standby power usage greatly, but it still wasn’t low enough. 

The display turned out to be consuming quite a bit of power (in comparison)  when not being used, so I needed some way to disable it automatically. I decided to add a standard NPN transistor to disconnect power from the whole display when the device prepares to sleep, and to turn it on just before it sends out the message to the display. This reduced standby power usage even more.

When active, the whole thing only uses about 10-20 milliamps, and almost nothing when sleeping now. Under normal use of once a day or something, the battery should last a few years at least.

SECTION 03: Circuit Board Design

The next step was getting the working circuit onto a circuit board. I needed to fit a few resistors, an NPN transistor, a battery holder, a button, the ATtiny, headers for later reprogramming, and the whole display assembly on a board within 2x2 inches or smaller. Because of my somewhat limited soldering skills, I opted to only use through-hole components for this project.

I decided to use OSH Park as my board manufacturer, since I did not have the tools or materials necessary to make my own board. 

A few days later, I came up with my finished board design, ensured there were no errors I could find, and sent it off to be manufactured.

image

The design fits most parts on the front side of the board so you can easily see them. The button I chose will let the user activate the device from the side. This is important because the front will most likely be covered by the enclosure.

All component places are labeled, and I added battery/power and board revision information on the back. I put my logo on it too. There are 7 holes, 4 for mounting the matrix display (ended up only using two), and 3 for mounting some sort of enclosure.

A few weeks later, I received the finished board, plus two extra for future use.

image

SECTION 04: Soldering

After I recieved the board from the manufacturer, I began to solder everything to it. Pretty straightforward.

image

After I finished that, it was time for the moment of truth. I put the battery in and pushed the button. Didn’t work. 

The solder connections looked good, and everything continuity tested okay. However, when I put the battery in reverse, everything worked. 

Since I didn’t want to reorder the board and wait another few weeks, I decided to just turn the battery holder around. The problem is, the battery holder’s pins are obscured by the display assembly. I had to carefully desolder the display without melting the headers, and then desolder the battery holder without melting its casing.

After what seemed like 30 minutes of desoldering, I got the battery holder reversed, and got everything back together. This time, everything worked.

image

It turns out that the eagle part for the battery holder had the pins on it reversed. Always double check everything. And then do it again for good measure.

A side-effect of solving this problem, though, is that you can now see the silkscreen indicating the original battery holder location on the board. Annoying for someone like me, but it all works now at least.

SECTION 05: Enclosure Design

Since I now had a finished and working board ready, I needed to get some sort of enclosure for it. I didn’t want a fully-encompassing enclosure, but something to cover the front and the back, while still leaving the sides exposed. 

After looking at Ponoko for some ideas, I decided that I should go with having a laser cut piece of plastic on each side. I opted to go with the transparent green material. (which they no longer stock :’c) Green is my girlfriend’s favorite color, and the material is transparent. I got the designs made, plus some other things since I had some extra space left.

image

A couple weeks later, I got the laser cut designs and some screws and spacers for mounting. Everything looked great, and the enclosure matched up with the board perfectly.

However, another slight problem surfaced. The screws I got were not long enough. Because the spacers were threaded, I did not need to buy longer screws, or use any nuts. All I had to do was cut the screws short enough to fit two in each section, but in such a way that at least one spacer held both screws at once. I ended up with one short screw per section, and a medium screw per section.

After I got everything together, the project was basically finished.

Even though I missed valentines day by a long shot, at least I’ll still be able to get it out to her somewhere near our ‘anniversary’.