Digital clock in your Native Language

If you are wondering what is the language in that clock, it is Bengali. It is the 6th most spoken language in the world, and International Mother Language Day started as a tribute to this language movement. And the above time translates to 16:37.

If you are starting with Raspberry Pi, or picked up electronics as a hobby, this electronics project can be a nice fit. It can also be a novel gift idea (trust me). Building this project is extremely simple as it uses all ready-made components. I will put links to detailed tutorials and project repositories in this article.

You need to develop both software and hardware for this project. I have used Python to develop the software. Code is available in this github repo.

Hardware part has three building blocks.

  1. Raspberry Pi.
  2. Digital display.
  3. A Power module.

The power module in the above clock is a mini UPS. This is essential in India where frequent power cuts are common. If you have access to a reliable power source or you want to use an external UPS, then you can skip this part. I will put a link to the power module soon.

Choose your Raspberry Pi

We can use a Real Time Clock (RTC) module with Raspberry Pi Zero, but that would add extra complexity. For hardcore electronics folks, you may try that as well.

Also, with the Pi always connected to your home network, you can directly upload and run the code, or use a remote shell to modify your code in the Raspberry Pi and test. You don’t need to take the SD card out and put it back every time with your code change. It will save some precious development time.

And using the inbuilt Wi-Fi, you can run a tiny flask webserver there, and create a simple webpage to control the clock. For example, the brightness can be adjusted using a tiny web portal. Limitless possibilities when the Pi is connected to the network.

The Raspberry Pi Zero W comes with a header soldered edition, Zero WH. If you are not comfortable with soldering (this one is tiny and could be tricky), order a Zero WH. Then you can use jumper cables, and no soldering is required.

Pi Zero W and Pi Zero WH

But if you are using Zero W, you need some header pins. You have to solder the pins which you need to use for this clock. There is an awesome blog on Raspberry Pi Soldering in this link.

Pi Zero and Header Pins

Choose the Display

You need a LED display driver to drive the LED display. I have used MAX7219 as a LED display driver. One single MAX7219 chip can drive one single 8x8 LED display, but they can be chained to create a very large display. This below display is with 4 MAX7219 drivers chained, and costs around 5 US $.

MAX7219 Display, 4 drivers stitched together

MAX7219 uses Serial Peripheral Interface (SPI) communication protocol. While it is fun to read details of this protocol, it is not necessary to read this to build this clock. All you have to do is, to connect MAX7219 pins according to this chart below.

Raspberry Pi and MAX7219 connection chart

You can see all Pins (VCC, GND, DIN..) are marked clearly in the Max7219 board. Connector cable usually comes with a Max7219 board.

Also, it is possible to create a much larger display, and with bigger real estate, you can create beautiful fonts. More about daisy chaining here. But do not draw power supply from the Raspberry Pi board if you are planning to use a larger display. Feed power to the drivers separately.

Power supply module

Once you connect the power supply module to raspberry Pi, your hardware is ready, and we can jump into coding. If you have purchased a Pi Zero WH and a readymade display board like the one above, setup should be done within 10 min.

Display connected with Raspberry Pi

Developing the software

Install OS for your Raspberry Pi

First we need to install OS for Raspberry Pi Zero. Depending on the development platform you use and the OS you want to install in Raspberry Pi, the steps can vary. This is an official Raspberry blog on how to install an operating system image on an SD card.

“Raspberry Pi OS Lite” should be installed if you are using Pi Zero, any other ‘heavy’ OS will degrade the performance significantly. All further instructions in this article will assume ‘Pi OS Lite’ as the underlying OS.

Boot your Pi and basic configurations

Once you have installed the OS in the SD card, boot your Raspberry Pi with the SD card. The default user is pi , and the password is raspberry. You need a monitor and a keyboard for easy setup.

Enable SSH in your Raspberry Pi. All Raspberry Pi OS has SSH disabled by default. Use “raspi-config” UI. Type “sudo raspi-config” after login. Choose 3. Interface Options -> 2. SSH. This is the Raspberry Pi documentation on enabling SSH.

Set your time-zone. You may refer to latest Raspberry Pi doc in case the option gets changed, and the screenshots have become obsolete.

Connect to Wifi

We are relying on Time Servers to keep the clock in sync. Raspberry Pi has to be connected to the internet in order to talk to Time servers. You can use the same “raspi-config” UI tool to connect to your wireless network. Steps are intuitive. This Raspberry Pi blog explains in detail about various ways to connect your Raspberry Pi to wireless networks.

Enable SPI

SPI (Serial Peripheral Interface) communication has to be enabled to interface MAX 7219 drivers. Use the same “Interface Options” in raspi-config tool to enable SPI.

Design your font

We need to create hex code equivalent for the digits we need to display in the clock. There are many hex code generators for dot matrix display. I have used This wonderful tool. Screenshot of the tool below. Source code is here. You may need to tweak the options depending on the display orientation, chaining.

These hex codes need to be replaced in the font file which I will explain in the coding section. There is a helper method which you can use to test your fonts in Raspberry Pi, details in coding section.

Setup Python and required libraries

Raspbian OS Lite should come with Python3 installed. But you need to install a few required python modules. Also, some libraries are required as well (libttf, libjpg). Maybe the code can be trimmed to remove some of those dependencies, but it is much easier to install a few libraries than spending time to resolve dependencies.

These following commands will install Python3, pip3 (Python’s de facto package manager) and other libraries. User ‘pi’ is added to ‘spi’ and ‘gpio’ groups. You can read luma led installation doc in detail.

sudo apt-get update
sudo usermod -a -G spi,gpio pi
sudo apt install build-essential python3-dev python3-pip libfreetype6-dev libjpeg-dev libopenjp2-7 libtiff5
sudo pip3 install luma.led_matrix

If you are planning to use this same Raspberry Pi OS for other python program development, consider creating virtual environments. Detailed discussion is out of scope for this article.

Code your clock

Get the code from here. Create a folder “clock” in your Raspberry Pi home directory. Code repo has only two python files -> and You can download the code into your dev machine and then SFTP it to the desired directory. Enabling SSH in Raspberry Pi will automatically enable SFTP.

Try running the code using this below command and the clock should come to life.


But the clock is in Bengali which you need to change now. Replace the hex code you generated in the You can keep other lines unchanged and just change the digits. You can use “test_font()” method in the code to test your font.

That’s it, your clock is ready.

Create startup script

The clock needs to start every time the Raspberry Pi boots up. Add this below line to /etc/rc.local file before “exit 0”

sudo python3 /home/pi/clock/ &

Congratulations on building your smart clock. Consider this as a beginning, and add as many imaginations as you have. Try adding a speaker and a Webserver through which you can upload mp3s for alarm. Do let me know what customization you did in the comment section.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store