Make Clock Using seven Segment Display with Odinub

Hello Everyone in today’s project we will make digital clock that shows time on seven segment display.

First of all let’s walk out through what is seven segment display?

A seven-segment display is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix displays.

Seven-segment displays are widely used in digital clocks, electronic meters, basic calculators, and other electronic devices that display numerical information.

To make use of seven segment display we make a library that has number function for 4 digit seven segment display using Odinub.

You can use this library only for your Odinub board.

To make a use of this library you have to install library on your board for that you have to connect your odinub board to the wi-fi  for that follow this simple steps.

Then clone the code located on this site with this command.

sudo git clone add-link

The library defines a class object TM1637Display with public methods for controlling the device through two digital IO pins. 

Now Let’s move with the project that shows the time on seven segment display in incremented format.
For that,

Hardware requirement_
Odinub Board
Odinub GPIO Converter
4-digit Seven Segment Display
Jumper Wires
Power Supply

Circuit diagram_
Let’s connect the seven segment display with the board.
Connect DIO pin will be GPIO_20 (23)
Connect CLK pin will be GPIO_2 (21)
Connect VCC pin to 3.3v (1/3)
Connect GND pin to GND (6/8)

Pin Configuration:


Now moving ahead with the programming side. First of all create a python file using this command.

sudo nano <file-name>.py


Now you can import GPIO library which is pre-installed in your Odinub board.

Import nubio

Then import time for delay purpose.

Import time

Import datetime to get the time.

Import datetime

Then import tm1637 library for use the seven segment display with odinub.

Import tm1637

First of all we have to create instance of TM1637 like this to use the functions of that class.


then clear the display of seven segment using this function.


Where, display is instance of TM1637 class. 

Then set the GPIO pins as an input.


now make instance of datetime class like this.

now =

and then separate the hour, minute and second like this

hour = now.hour
minute = now.minute
second = now.second 

and then make list of current time to show the time on seven segment display

currenttime = [ int(hour / 10), hour % 10, int(minute / 10), minute % 10 ]

Then we will use Show() method to show the time. We have to pass list of time as an argument because this method takes list as an argument.


I have attached the code at the end of the project.

Don’t forget to save the changes by pressing CTRL + X and then Y.

Now run your code using this command. And take a look of your own digital watch.

sudo python <file-name>.py


With the hope you enjoyed the article Go and make your own digital watch using seven segment display.