Giter VIP home page Giter VIP logo

digital-clock-abt's Introduction

Clock ABT

A digital clock with three buttons: A, B, and T.

Components

  1. ATtiny13A.
  2. A DIY board with a push button of RESET.
  3. DS1302 RTC module.
  4. 4-bit 7-segment LED module, drived by two 74xx595 chips.
  5. Three additional push buttons used to config the clock, and a board to place them.

Requirements

  1. USBasp or any other programmer.
  2. Atmel Studio 7.

Circuit

The circuit is pretty simple, here is the simplified diagram demonstrating the connections among main components:

Buttons

Buttons are used to adjust time manually.

It will enter in time edit mode after the MCU reset, use button A and B to move editing position left and right and select which bit to edit, button T is used to increment the number at editing position.

Tiny13a has not enough IO pins to connect three buttons individually. Here is a trick which needs one wire only: the voltage divider circuit. The circuit output different voltage when a button is pressed, thus the button pressed can be figured out when the V_out is read by ADC. The ADC input pin is labeled KEY_IN.

DS1302 And 595

These two modules are connected together to reduce IO occupation. The principal is that the DS1302 needs a steady high signal on CE line during operation, once the signal goes low the operation is terminated. While 595 only needs a positive pulse to output data in the shift register. The pulse can be short enough to avoid triggering DS1302 and SCLK and DS can remains high or low during the pulse, which means operation to 595 will not interfere DS1302.

Of course the data in 595 will be messed up when transferring data with DS1302, it doesn't matters, you just write again after the transfer is done.

Program and Display Format

Hour is displayed as a hex number, thus 'A' means 10 clock. A mark of AM/PM showed to the right, and minute is two decimal numbers.

You can see there is still a pin remains unconnected, which allows further expansion, as long as the flash space is enough ...

which has only 4 bytes left.

If you use ATtiny25 or higher, an alarm feature should be easily implemented.

And what is that aaz stuff ? That is a thin wrap library which hides mostly all special register operations behind inline functions with zero overhead, to cure the pain of my human memory and enhance the readability, I hope.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.