Tiny Watch

EPLogo
 Presents

 

 

 

TinyWatch

Objective: Make a digital watch from the ATTiny85 microcontroller.

Introduction: The ATTiny85 is a small and versatile microcontroller that I’ve been using for almost 2 years. In that time I have worked on many projects, from small quick inventions to complex builds like “The Lawn Mower”, a mini car that’s controlled via Bluetooth. The fun for me is being able to see what i can do with the small amount of memory that the ATTiny85 has, with only about 8kbytes worth of space there is only so much you can do.

My next idea was to see if I could build myself a digital watch from the ATTiny85 that would.

IMG_20150719_171431

  • Tell the time
  • Tell the temperature
  • Have Bluetooth Capabilities
  • Receive data from phone
  • Small enough to wear
  • Stylish

What I was able to come up with after about 2 months of research and development, and a few buckets of tears, was this ugly duckling here. With the sacrifice of style I was able to jam pack this sucker with many different kinds of sensors and useful features that are actually used and aren’t just for show.

 

The Hardware

“People who are really serious about software should make their own hardware.” –  Alan Kay

This quote has guided me through the many trials and errors I’ve had while developing my own devices over the past few years. Sometimes existing hardware is not enough to make your ideas come to reality, which is why I always try and make my own hardware which matches my idea. The tiny watch consists of the following hardware components.

 

The OLED

The 0.96” I2C OLED works great for this kind of project, as it does not draw a lot of power; it is bright and crispy clear, and small enough to be used for a wearable. The awesome thing is that because it uses the I2C bus protocol I only have to use two of the 5 available pins on the ATTiny85. Also because with I2C you can have many devices connected over the same pins I was able to also connect the DS3231 RTC module alongside the OLED.

 

The RTC Module

The original plan with time keeping was to have the time be sent via Bluetooth from the host phone. I would then convert the data from a single string to individual letters and number that would then be stored for computing. To keep the current time I would have to keep a counter going on at all times, adding to the obtained time from the phone. While this idea wasn’t too far fetch I ended up buying three different RTC modules to test for the project.

RTC

The first one I tested was the DS1307 which is a bit less accurate than the DS3231 RTC but it also had a AT24C32 a memory chip with 32 Kilobytes of storage. This was great but I wanted something more accurate so I found the DS3231 RTC module that also had the same memory chip with 32 Kilobytes of storage. This was an exciting time, I was thinking of all of the functionality I would be able to add to this device now that I had about 40 Kilobytes of total storage including the one from the ATTiny85.

IMG_20150807_150526.jpgIn the end I decided against the two modules with the added storage space, not because they weren’t good but because I felt like the final build would not be considered a legit ATTiny85 digital watch. The defining reason why I chose the custom DS3231 module was because of its size, the custom DS3231 module is literally 4 times smaller than the DS1307 module.

This picture on the left shows a size comparison of the three modules. As you can see the custom module that made it onto the TinyWatch is significantly much smaller than the other two RTC modules on the right.

 

Navigation Switch

The three way switch I used for this build is really remarkable; it has one axis with left and right, and a middle click for selecting menu items. It was also thin enough to sit directly on the LIPO battery charger without causing any problems. Before I had this navigation switch however I was using three tactile switches, each had its own pin on the ATTiny85. This was not an issue as I was only testing the menu systems without any of the sensors attached. What I quickly realized was that I needed to either decrease the amount of buttons I was using because I would not have enough pins to attach the Bluetooth, OLED, and RTC too.

After doing some research and banging my head against my desk for 2 days; I implemented a way to have as many buttons as I needed from only one pin on the microcontroller. While I was able to find ways of doing it online I needed a solution that would implement button denouncing in the mix as well, as I was getting way to many inputs from a single button click. The article I read online said that I could do this using different resistor values for each button, when a button is pressed the microcontroller reads the analog value of that resistor and decides what that value represents.

Navigation switch

The configuration looks like this; the button three inputs coming from the switch are the directional buttons, Left, Right, and select, the connection without a resistor is ground. There is also a 100k pull up resistor that runs from the pin to 5 volts.

 

 

 

 

 

 

Navigation Switch Diagram

This is the diagram for this configuration; notice that all of the inputs have different resistor ratings. This is important as it is what differentiates your button presses from each other. The 100k pull up resistor is needed for the button operations and should be kept as is.

 

 

 

 

LIPO battery and charger

The 3.7 V LIPO battery is soldered on to the output from the LIPO charger, the main power is also connected to both the battery and charger, so that if the battery is dead you can still use the watch when the power is connected to the charger. This charger has some neat features like automatic shut off once the battery is full, and LED notification for when the battery is charging and fully charged.

The LIPO charger is hot glued onto the LIPO battery itself as well as the leads are soldered in place. When the battery is charging the LED on the module glows Blue, once it reaches full capacity it changes to Red as seen on the above image. Also notice that the display still works while the charging cable is connected. This device also has a long standby time as it does not draw a lot of power while it is being used, and because this is a 650mAh it can go a long time without charging.

Programming Pins

I wanted the TinyWatch to be re programmable so I added header pins to the side of the watch that are connected to ground, power, pins 0, 1, 2, and 4 on the ATTiny85. There is a universal power switch on the device which has two functions. Firstly it turns the device On/Off, and secondly while the device is off the connection from the battery is disconnected from the rest of the component, allowing power only to come from the header pins thus. This prevents any interruptions from the different modules while the device is being programmed.

IMG_20150719_171720.jpg These are the programming pins on the left side of the device, from left to right they are ground, pins 10, 13, 12, 11, and power. These pin numbers are coming from the Arduino uno board, as it is what I used to program the ATTiny85.

TinyWatch Circuit Diagram

Circuit Diagram.png

 

The Software

Email me at almonte.brayan@gmail.com for the source code.

 

Leave a comment