Kitchen timer on arduino
I want to say right away:
1 – I don’t know programming languages. That’s why I use Sergey Glushko’s wonderful program FLProg.
2 – I don’t brag about the code, which most likely turned out to be crooked and unoptimized.
3 – I just want to share my opinion on how a timer can work in my understanding.
4 – The circuit is powered by a network power supply, so be careful and follow safety precautions to avoid electrical injury.
In an unequal fight with time, my mechanical timer in the kitchen stove decided to leave the chat. At first it made increasingly hoarse sounds and then went silent altogether…
I needed a timer, I had several solutions to choose from:
1 – Temporarily assemble the most budget on NE555 and CD4017 for 50 minutes with a step of 5 minutes. But as you know, there is nothing more permanent than once made temporary and rewound with blue electrical tape (in modern realities, scotch tape!).
2 – Buy ready-made from the Chinese on Ali.
3 – Try fiddling with the Arduino.
I decided to try the last option…
My initial wishes were as follows:
1 – Indication on the seven-segment indicator TM 1637, it is clearly visible even in high light conditions.
2 – When the timer is not used, the display does not light up, like in sleep mode.
3 – By default, the time change step is +/- 5 min with the possibility of switching to a step of +/- 1 min.
4 – Saving the last set time in volatile memory for more convenient use of the timer when the time intervals used are close.
5 – After the timer has finished working, the indication is duplicated by a sound signal until the <STOP> button is pressed.
6 – <PAUSE> mode with the ability to continue the countdown or reset to the previous or zero time value.
7 – Automatically change display brightness depending on lighting conditions.
8 – Sound confirmation of pressing any button.
9 – Automatically switches to standby mode if idle for more than 10 seconds.
10 – Power supply from a +5V network power supply. You can also use an old charger from a push-button telephone.
Having received all the components from the Middle Kingdom, I picked up the <tambourine> and started dancing at the keyboard in the FLProg program.
The result was probably some ugly, but quite functional code.
The basic diagram came out like this.
The archive can be downloaded here or in the description under the video.
You can see the work
But as they say, appetite comes with eating and I wanted to expand the functionality a little and my wishes have already become like this:
1 – By default, the display shows the current time and, with a period of 1 minute for 5 seconds, the temperature from the real time clock sensor is shown.
2 – By default, the timer setting interval is +/- 5 min with the possibility of switching to a step of +/- 1 min.
3 – Save the last set time in volatile memory for more convenient use of the timer. If you often use the same or close time from the previous setting.
4 – After the timer expires, the display will flash zeros 00:00 and a sound signal will be given every 30 seconds until you press the <STOP> button. Based on personal experience, this is a very useful function!
5 – <PAUSE> mode with the ability to continue the stopped time, return to the last set time or reset the time to zero 00:00.
6 – Setting or adjusting the time must start from the current time display, not from zero or the default value.
7 – Possibility of selecting separate setting of HOUR and MINUTE up or down using the <+> and <-> buttons.
8 – So that when setting or changing the time, the clock readings change in a ring, for example:
When the value 23:00 for HOUR was reached, the next value on the display was 00:00 and vice versa in the smaller direction.
When the value 00:59 was reached for MIN, the next value on the display was 00:01 and vice versa to the smaller side.
9 – Sound confirmation of pressing any button or changing the timer mode during the setup process.
10 – Light indication of the timer mode, for example, button illumination in active mode.
11 – Automatic transition to <TIME> mode if inactive for more than 10 seconds.
12 – In my case, power is supplied from a +5V network power supply. It is also possible to use an old push-button phone charger.
And so, having made tea with lemon, I began with my crooked hands to finish my wishes to the already existing sketch…
The sketch has become even larger and perhaps even more clumsy….. But it has been working quite adequately for more than a year since it was published in my kitchen. Something is constantly being baked in the oven and when we cook on the stove we also use a timer….
Scheme.
The archive can be downloaded here or in the description under the video.
This whole mess works something like this:
After power is supplied (in my case, after plugging into the network), the temperature indication from the clock sensor is first displayed on the display, then the current time is displayed in the HOUR:MIN format.
Setting and correcting time:
1 – Before uploading the sketch, you need to set the correct date and time in the real-time clock module in the FLProg program using the tab <TOOLS – SETTING UP THE RTC> Then upload it to the clock. After that, you can flash the Arduino.
2 – Time correction is performed using buttons S3, S4, S5. Press button S5 <INTERVAL / TIME> for more than 3 seconds, the timer will enter the <TIME SETTING> mode. At the same time, LEDs HL4, HL5 in buttons S3 <+>, S4 <-> will light and LED HL1 in button S5 <INTERVAL / TIME> will light. By pressing button S5 <INTERVAL / TIME>, the choice between HOUR and MIN is switched to set the desired time, using buttons S3 <+>, S4<-> set the current time for HOUR and MIN respectively.
3 – To save the changes made, press the S5 <INTERVAL / TIME> button for at least 3 seconds.
<TIMER> mode.
To switch to the <TIMER> mode, press the S1 <START> button. The HL4, HL5 LEDs in the S3 <+>, S4 <-> buttons will start blinking.
The display will show the last time you set or zeros 00:00 if this is the first time you turned on or the timer was disconnected from the network. Next, press the S3 <+>, S4 <-> buttons to set the desired timer operation time, by default the time change step is +/- 5 min. If you hold the S3 <+>, S4 <-> buttons pressed, the dialing speed will increase after 10 seconds.
If you need to set the time in increments of +/- 1 min, then briefly press the S5 <INTERVAL / TIME> button, the HL1 LED in the S5 button will light up and the time setting step will change to +/- 1 min when you press the S3, S4 buttons.
To return to the +/- 5 min step, briefly press the S5 <INTERVAL / TIME> button again, the HL1 LED will go out and the dialing step will return to the original one.
After setting the desired timer time, press the S1 <START> button again briefly, at which point the HL4, HL5 LEDs will go out, the HL3 LED in the S1 <START> button will light up, and the display will begin counting down the time you set in the format:
HOUR : MIN if the current timer time is greater than the hour 01:00.
MIN : SEC if the current timer time is less than the hour 00 : 59.
<PAUSE> mode.
While the timer is running, briefly press the S2 <STOP> button, the HL3 LED in the S1 <START> button will start blinking and the countdown on the display will stop. To continue the countdown, briefly press the S1 <START> button again, the HL3 LED will stop blinking and the timer will continue the interrupted countdown. If you press the S2 <STOP> button for more than 3 seconds in the <PAUSE> mode, the timer will stop and return to the last set value. If you press the S2 button again for more than 3 seconds, the last time of the timer will be reset to 00:00.
Countdown end mode.
After the set time has elapsed, zeros 00:00 will blink on the display, the HL2 LED in the S2 <STOP> button will also blink and a sound signal will be given periodically from the BUZZER 1 buzzer at intervals of 30 seconds until you press the S2 <STOP> button.
The HL2 LED in the S2 <STOP> button will light up and the HL3, HL4 LEDs in the S3 <+>, S4 <-> buttons will start blinking. The display will show the last set time of the timer.
In this case, you can turn on the timer again with the same time by briefly pressing the S1 <START> button.
Change the timer time using buttons S3 <+>, S4 <-> to the desired time and turn the timer on again using button S1 <START>.
Exit from the <TIMER> mode to the <TIME> mode by briefly pressing the S2 <STOP> button
Do not press anything and the timer will automatically enter the <TIME> mode after 10 seconds.
Details:
Microcontroller:
ARDUINO NANO 328, I used a completely Chinese clone LGT8F328P.
Real Time Clock:
DC3231 Chinese module for Arduino.
Seven-segment indicator:
Clock type on the TM 1637 microcircuit, module for Arduino.
Transistors:
VT1-VT6 any low-frequency, low-power in SMD case sot-23 npn structures with collector current from 100 mA. For example BC547.
Resistors:
R1-R12 low-power resistors, nominal values according to the diagram, SMD size 0806.
Capacitors:
C1 electrolytic, with a capacity of 100-220 μF and an operating voltage of at least 16 V. For example, K50-35.
C2 any small-sized, ceramic with a capacity of 0.1 μF and a voltage of 25 V. SMD size 0806 or 1206.
Buzzer:
Active buzzer with built-in generator for 12 V. From 5 V it beeps quite loudly!
Buttons:
S1-S5 any buttons you have, preferably with built-in LED backlight.
Power unit:
Any small-sized power supply with an output voltage of +5 V and a current of 0.5 Chinese Amperes.
A charger from an old push-button telephone would also be quite suitable.
The timer works as intended, but here’s the problem…. I already need a multi-channel timer… One timer is no longer enough…. I’ll think about it…..