DIy segment 2

01- DIY- AVR Projects- Seven Segment Digital Clock Making || Multiplexing Tutorial Leave a comment

Hello everyone.

This is a new series that we decided to start in parallel with the ongoing AVR Tutorial series that we have on our Blog. The reason behind this was that we wanted to practically demonstrate every concept being taught in that series with real-world examples. Therefore in this series, we will make various Do-It-Yourself projects based on the AVR microcontroller. So without any further ado let’s begin.

At the time of writing this post, we have already covered interfacing of LEDs and Seven Segment displays with the AVR ATmega16 microcontroller. Therefore using that knowledge we are going to create a digital clock capable of displaying hours, minutes and seconds. Now, we have not yet covered advanced concepts such as timers, counters, serial communication and real-time clocks in our AVR series. Therefore the clock that we make here will be very basic in its hardware as well as its code. It will also be prone to error in long time usage. But you can always come back to this project and improve upon it once those advanced topics have been covered. For now, let us make this basic digital clock.

As we need to display hours, minutes and seconds we are going to need six seven segment displays in total; two for each case. Now, if you remember from our interfacing post; we used a complete PORT (more specifically PORTA) to connect to the data lines of the seven segment display. In the microcontroller, we have in total four PORTS while we need to use six seven segment displays. Here we reach a problem. We do not have enough pins in our AVR ATmega16 microcontroller to connect all the six displays. so what to do here…?

To solve this issue we will take help of a technique known as multiplexing. In short, it is a method by which multiple analog or digital signals are combined into one signal over a shared medium. The aim is to share a scarce resource. For example, in telecommunications, several telephone calls may be carried using one wire or in our case, one data line can be shared between all the six seven segment displays. This removes the need for separate PORTS for each display.

I would now like you to go through the video below, where I explain the concept of multiplexing in detail along with the circuit and the code. I have also given a reference circuit diagram and code snippet for your convenience below the video. So do check them out too:



Download the Makefile needed for compilation and copy it into the folder where you have saved the source file.

Circuit Diagram:


Shop Smart with us for Best Prices:

If you want to continue on with this series I would ask you to visit our YouTube channel and subscribe to receive continuous notifications. You can also subscribe to our Newsletter below to get email notification of each post as and when they are posted.

You can also follow us on social media platforms such as  Facebook and Twitter.

Thanks a lot for reading through this post. Feel free to follow through this series and comment your queries in the comment box below. Also feel free to contact us regarding any out of stock product and we will try to get back to you as soon as possible.

Leave a Reply