Close
0%
0%

Kronoino : An AVR powered Digital Wrist Watch

A digital watch using the ATmega 328P and seven-segment displays

Similar projects worth following
I always had a thing for watches. Although I liked mechanical watches as a kid when I learned about the physics of piezoelectricity, I started to appreciate digital watches. Now, I do not believe that watches are just a device for timekeeping or an elaborate piece of jewellery to attract a mate. To me, watches are something more. I can't articulate what exactly but I like watches. Recently, I an idea to build an Arduino project that involves building a datalogger that would monitor the conditions inside a termite mound. This requires many things one of which is the ability to last for months on a low power battery. This calls for tinkering with fuse bits, powering down various peripherals of the avr chip, and of course, interrupts- just the things needed to make a watch. So I decided to build it as a practice project.

Building a watch involves overcoming three main difficulties:-

1. Making things small

2. Reducing power consumption

3. Timekeeping Accuracy 

An obvious option when shrinkifying electrical circuits is to go with SMD components. However, I couldn't go with this option because my hands shake like that of a Parkinsons patient strapped to an electric chair. And I did not have the option of printing PCBs as the coronavirus lockdown has made it difficult to order things and actually seeing them delivered within a reasonable waiting time. I had to go with PDIP design on a perfboard. I wanted to learn more about reducing power consumption because I need that skill for a long term datalogging project I have on my mind. This is kind of a practice project( and also a desperate attempt to keep my mental sanity during lockdown through some mind massage). 

Timekeeping accuracy is not a big deal when you can use a RTC module but I didn't have that option either because I did not have one on hand. 

While researching on the internet on what other people have built, I came across SparkFun' s BigTime Watch Kit. This solved the problem with having an RTC by eliminating it and using one of the AVRs timers and an external crystal to act as an RTC. Great ! The BigTime Watch Kit is OpenSource so the Firmware and all other files were available for download on GitHub. 

This is what my watch is going to be based on.

20200924_160318.jpg

Circuit Schematic

JPEG Image - 1.60 MB - 09/26/2020 at 18:00

Preview
Download

VID_20200923_142740_mpeg4_001.mp4

Breadboard Circuit in operation

MPEG-4 Video - 5.45 MB - 09/26/2020 at 08:20

Download

ino - 19.27 kB - 09/23/2020 at 21:00

Download

  • 1 × ATmega 328P Any AVR from the Atmegaxx8 family with over 5kb flash should work fine. Make sure it is a P version as the consume less power
  • 2 × 1 -Bit Seven Segment Display A 2-bit version would be helpful but I did not have any on hand so I wired two into a multiplexing configuration. I used common anode version but a common cathode would work just fine. You would need only to replace logic low with logic high
  • 1 × Arduino Board Any board will do as long as the micro controller is not an SMD. We would need to remove the microcontroller to program the standalone chip. If you have an FTDI cable then you would not face this problem
  • 1 × CR 2032 3V Lithium coin cell Any 3V coin cell would do
  • 1 × Holder for the coin cell You can buy one or improvise one from wire or paper clips, etc

View all 9 components

  • And it ticks! (every 8 seconds)

    Brainy.Baboon09/26/2020 at 18:52 0 comments

    I added a strap and some velcro. I would probably replace it with a NATO strap later. A bit of clear plastic covers the enclosure. It is a bit clumsy because its 10 times the volume and 5 times the weight of my usual Sonata. 

    I will add some code for visual effects every time it displays a number. 

    Currently it consumes 1 microamps of current when idle. This reading is correct only up to one decimal place. I measured it with a DT830. 

    At this rate of consumption, it should last at least a year on this CR2032 coin cell which is rated for 200 mAh but realistically probably would provide only a 100 mAh.

    I am only a beginner in electronics and this is not my comfort zone. I would appreciate if someone finds an error and writes in the comment. I would consider myself fortunate to have learned something.

  • Some perfboarding at midnight

    Brainy.Baboon09/26/2020 at 18:18 0 comments

    My attempt at shrinkifying everything you saw on the breadboard to fit the enclosure I made from regular epoxy.

    I decided to add an IC socket as that would not consume any extra space and its good practice to add a socket whenever possible. I also added four female headers(to Reset, RX, TX, GND) so that I can program the Atmega without having to remove it from the circuit. And the three red wires could have been connected below the perfboard but I think they would look good on the face of the watch. They add a certain character to it. Don't they? 

  • Building the enclosure

    Brainy.Baboon09/26/2020 at 08:44 0 comments

    I could not 3D print the housing/enclosure because of a lack of finances and the sheer impracticality of ordering anything during a pandemic. I devised an alternative. I made the housing out of regular epoxy. The kind used in sealing pipes and such.  Regular epoxy is quite harmless once it is cured. I used it on aquatic snails that had sustained shell damage/deterioration and with no observable ill effects. However, I would warn anyone trying this to monitor themselves for any signs of allergies from the epoxy rubbing against their skin. 

    I made cut outs from cardboard and stacked them together into a shape resembling the cavity of the enclosure and then draped epoxy around it. 

    The cut-outs

    After the epoxy cured, I removed the cardboard by soaking it in water.

    It need a bit of filing and sanding. Some imperfections were repaired by adding more epoxy

  • Builiding it on breadboard

    Brainy.Baboon09/26/2020 at 08:13 0 comments

    Building the prototype on breadboard. I connected two common anode seven segment displays to act as one multiplexing unit capable of displaying the two digits for hours and minutes alternately.

    Two seven segments can be connected into a multiplexing configuration by connecting their corresponding segment pins together. This is exactly how the commercial multi-digit displays are made. The common pins for each display are left unconnected as these will be used for switching on or off each digit.

    On breadboard the connections look like this

    This is the schematic for the rest of the circuit.

    Yeah, I like to be generous with decoupling capacitors on my circuit.

    You may have noticed that the watch uses only one button to change the time. This makes the connections a lot easier but it also means that the hours and minutes can only progress in one direction. Not so user-friendly.

    After some troubleshooting (mostly faulty jumper wire connections), I got it working!

    The video of breadboard circuit in operation can be found in the files. 

  • The beauty of clock crystals

    Brainy.Baboon09/23/2020 at 12:16 0 comments


    Any clock needs to extract from the imperfect, random world around it, a precise and periodic signal. There are many ways to do it. One of the most convenient ways of having a periodic phenomenon is to use an oscillating system. Unsurprisingly, most timekeeping devices, from grandfather clocks to atomic clocks use periodic oscillations as a time base.  From pendulums to springs to fancy grains of sand to atoms we humans have tried everything. One of our most successful attempts has been at harnessing, what I call, the physics of piezo-electricity. One of the applications of this magical phenomenon is in making crystal oscillators. Piezoelectric crystals, when hit, will oscillate at their natural resonant frequency, like every other object, but they also produce a voltage (or current) every time they are deformed. They can also be made to deform by applying a voltage. With some additional circuitry it is possible to take some of the electricity produced by the crystal and feed it back into the crystal( we make up for the loss by amplifying the current using a transistor). There we have it! An oscillating system that goes on forever. Steve Mould has got a really good video explaining crystal oscillators.

    When using an AVR chip we have the option of using the internal Resistor-Capacitor(and op-amp) oscillator as the time base but this is not reliable over extended periods. We will be using the 32,768 Hz (or 32kHz) crystal oscillator as the time base. The choice is motivated by many reasons. For one, it is ubiquitous, from digital watches, battery-powered wall clocks to laptops, these are everywhere. Another advantage is that they are low power and do not require loading capacitors for stability.  Unlike the battery-powered clocks which use a series of flip-flops to bring down the 32,768 Hz to 1Hz, we are going to use the AVRs timers to generate an interrupt every once in a while and update the seconds counter accordingly. As the timer counts using the external clock signal coming from the crystal we have got ourselves an accurate time base. Just how accurate?

    Assuming my crystal has an accuracy of 100 ppm which translates as 100/1,000,000 (hundred over a million) which is equal to 0.0001. 

    As there are 86,400 seconds in a day, our error will be +/-(0.0001 x 86,400)= +/- 8.64 sec at room temperature.

     We can use the AVRs Timer2 which can use an external clock signal. We will use the Timer1 (which will use the internal R-C oscillator at 8MHz) for the delay utility.

     TIMER2 is set up in void setup() to overflow every 8 secs. 

      TCCR2A = 0x00;
      TCCR2B = 0x00; 
      TCCR2B = (1<<CS22)|(1<<CS21)|(1<<CS20); 
      ASSR = (1<<AS2); 
    

    This generates an interrupt and we update the counters accordingly:-

    SIGNAL(TIMER2_OVF_vect)        
    {               
      seconds += 8;
      minutes += seconds / 60; 
      seconds %= 60; 
      hours += minutes /60;
      minutes %= 60; 
    }
    

View all 5 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates