Main Content

A user-friendly interface in a simple timer

Make a user-friendly interface with an alphanumeric display, a rotary encoder and a finite state machine

This project explains how a finite state machine may be useful to make a user-friendly interface with an alphanumeric display and a rotary encoder. As an example we will realize a simple timer, but you will be able to create your own machines easily.

I wanted to put several devices into the same box. In this box I connected an Arduino Nano Every with a 2 x 16 characters LCD (Liquid Crystal Display), a rotary encoder, a RTC (Real Time Clock), a beeper and a temperature and pressure measuring module. And now, by turning the rotary encoder, I can access a clock and calendar, a thermometer and barometer, a tide clock, a timer and so on… By pushing the rotary encoder, I can adjust many parameters: the temperature unit (°C, °F or °K), the pressure unit (mmHg or hPa), the altitude which is used to calculate the pressure at sea level, the brightness of the LCD

The Arduino board is behind a hole of the box, so I can connect it to my PC and program it without opening the box. So I create and add new devices but I never open the box. Today I have opened it exceptionally just to photography it and show you what is inside.

I will not put this project into the project hub because it is not finished, and I think it will never be. Instead, I will explain how to do a simple device (a timer) using the same techniques, essentially the user interface based on the LCD, the rotary encoder and a finite state machine. Afterwards, you will be able to use the program as a frame to realize your own projects and to make very complex machines.

User manual of the timer
To use this timer, you program a delay by pressing the rotary knob during more than 3 seconds. You choose the number of hours, the number of minutes and the number of seconds by turning and pressing the rotary knob. Then the timer starts and you can see the delay decrease on the LCD. When the delay reaches 0, the timer beeps. You can stop the beeper by pressing the rotary knob.

This is very simple, so we can add some functions, just for the exercise. First, if you turn the rotary knob, you can see and adjust the brightness of the LCD. If you keep turning the rotary knob, you can see and adjust the tone of the beeper while hearing it. The last function is a pause in the timer countdown: if you press the rotary knob while the timer is running, the counting is suspended. It will restart when you press the rotary knob again.”

Link to article