You Are Here: Home » AVR ATmega Projects » Clock Projects » Build your own stopwatch using Maxim MAX7219 Serially Interfaced, 8-Digit LED Display Drivers

Build your own stopwatch using Maxim MAX7219 Serially Interfaced, 8-Digit LED Display Drivers




One of the basic usage of the TIMER peripheral on every microcontroller is to provide the accurate timing mechanism. Using the TIMER peripheral as the basic timing, we could easily develop a stopwatch and display it to the 8-Digit seven segment numeric LED display. Thanks to the Maxim MAX7219 chip which enable us to interface this 8-Digit seven segment LED display much easier using just three wires of the SPI (serial peripheral interface) to display the hour, minute, second, and hundredth of seconds to the 8-Digit seven segments LED display.Build your own stopwatch using Maxim MAX7219 Serially Interfaced, 8-Digit LED Display Drivers

On this tutorial we will learn to utilize the Atmel AVR ATMega328P microcontroller SPI peripheral to communicate with the Maxim MAX7219 chip. The AVR ATmega328P SPI peripheral will be configured as a master and Maxim MAX7219 as the SPI device slave; you could read more about the SPI in Using Serial Peripheral Interface (SPI) Master and Slave with Atmel AVR Microcontroller project on this blog. A simplified electronic schematic of this project is shown in this following picture.Schematic Build your own stopwatch using Maxim MAX7219 Serially Interfaced, 8-Digit LED Display Drivers

The following is the list of hardware, software, and references used to build this project:

1. One Maxim MAX7219: Serially Interfaced, 8-Digit LED Display Drivers
2. Two common cathode 4-Digits seven segment LED display
3. One Resistor: 10K Ohm
4. One Capacitors 0.1uF
5. AVRJazz 28PIN development board from ermicro which is based on the AVR ATmega328P microcontroller.
6. Atmel AVR Studio 6.0 for coding and debugging environment
7. STK500 programmer from AVR Studio 6.0, using the AVRJazz 28PIN board STK500 v2.0 bootloader
8. Atmel AVR ATmega328 and Maxim MAX7219 Datasheet

The stopwatch project that we are going to build has these following features:

  • Stopwatch counting up to hundredth of second when the SW1 is pressed
  • Pressing the SW1 once will freeze the counting display while continuing counting in the background, pressing the SW1  again will continue to display the stopwatch counting
  • Adjust the intensity of the 8-Digits seven segment LED display using the trimmer potentiometer (TP).
  • Reset the stopwatch counting by pressing the SW0.

In order to accomplish this project, we will use the AVR ATmega328P 16-bit TIMER2 peripheral in compare match mode as the heart beat of the counting mechanism, the pin change interrupt is used to detect the SW1 switch, and the ADC peripheral is used to adjust the 8-Digit seven segment LED display brightness. This project also serves as a good example of how we use many of the powerful AVR ATmega328P microcontroller features at the same time. The following is the complete C code for this project:

For more detail: Build your own stopwatch using Maxim MAX7219 Serially Interfaced, 8-Digit LED Display Drivers

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Building the I2C Smart DC Motor Controller with Atmel AVR Microcontroller – Part 1
Building the I2C Smart DC Motor Controller with Atmel AVR Microcontroller – Part 1

The idea of building my own I2C (read as I square C) smart DC motor controller is came to me...

Close
Scroll to top