This article makes use of a Arduino Nano, OLED screen, buzzer & buttons to help you cook up a storm
You ever sit at your soldering station wondering why you're still hungry when you put some pasta in a pot to cook and only remember too late that you never took it off the heat? You wind up eating cold cereal for weeks because the fire department warned your landlord and no one will trust you with a hot plate again. At least you won't have so many dishes to clean, and you'll get all the riboflavin and niacin you need in your sugar rich calcium diet.
Alternately, if you're tired of Frootie-O's or you've run out of milk, you can now trust yourself in the kitchen again, thanks to the all new, cooking thermometer with a god-awful buzzer to boot. It won't slice or dice but it will warn you until its battery dies, then you're on your own.
I burned jell-o once ... and I don't want to talk about it.
What You Need
- Arduino Nano - or other microcontroller
- OLED 128x32 screen
- DS18B20 Waterproof heat Sensor
- Piezzo buzzer
- Toggle switch
- Battery, wires & assorted of resistors
- A dash of oregano
This project makes use of five buttons which are configured together with a combination of resistors that create a different voltage using voltage dividers that the microcontroller then measures through an input analog pin. The different voltage levels generated by the voltage dividers associated with the different buttons mean the Arduino can determine which button was pressed using only a single analog pin. To learn more about this method, have a look at my Arduino Exercise Reps Counter article.
Using the Code
Although I built this project half out of boredom and half because I had a spare thermometer from my Arduino Home Distillery project, the third half reason was necessity (I ran out of Kam) which got me motivated to finally get it all done. In terms of overall time spent, I'd guess it took about five hours to build, stretched over a period of a few weeks. but then, at my desk ... weeks can pass and it's all just a blur anyway, so I'm really not too sure. None of it was very difficult though the OLED's need to be told to 'put it on the damned screen' when you've told it where to draw what but still don't see anything had me cursing for a while.
N.B.: The author is not responsible if your OLED remains unchanged when you neglect to issue the command.
One thing you may find interesting was the means by which the user can edit the several parameters available to him. There are low-temp, high-temp, timer settings and two on-screen commands start and reset. One of the five buttons does nothing but cycle through these different parameters. As the user cycles through these options, they are each in turn highlighted. These are the different choices available...
#define DFN_State_EditUpper 0
#define DFN_State_EditLower 1
#define DFN_State_EditTimer_Hour 2
#define DFN_State_EditTimer_Minute 3
#define DFN_State_EditTimer_Second 4
#define DFN_State_EditTimer_Start 5
#define DFN_State_EditTimer_Reset 6
#define DFN_State_Num 7
...when a new selection is made, then all the highlighters are drawn to tell the user which option they are about to change. All the different regions on the screen are mapped out with similar
#define preprocessor tags and have their own methods called when they need to be drawn.
intEditState == DFN_State_EditUpper ? WHITE : BLACK);
intEditState == DFN_State_EditLower ? WHITE : BLACK);
DFN_Ti_Hour_Rec_Top + DFN_Ti_Hour_Rec_Height,
intEditState == DFN_State_EditTimer_Hour ? WHITE : BLACK);
DFN_Ti_Minute_Rec_Top + DFN_Ti_Minute_Rec_Height,
intEditState == DFN_State_EditTimer_Minute ? WHITE : BLACK);
DFN_Ti_Second_Rec_Top + DFN_Ti_Second_Rec_Height,
intEditState == DFN_State_EditTimer_Second ? WHITE : BLACK);
DFN_Ti_Start_Top + DFN_Ti_Start_Height - 1,
intEditState == DFN_State_EditTimer_Start ? WHITE : BLACK);
DFN_Ti_Reset_Top + DFN_Ti_Start_Height - 1,
intEditState == DFN_State_EditTimer_Reset ? WHITE : BLACK);
In the image above, the green lines represent the user parameter edit selection highlighters which are drawn by the
EditSelector_Draw() shown above.
The de-bouncing method used to accept user inputs with the push-buttons lets the user hold a button down and gradually accelerate the speed at which entries are made by counting the number of times the
loop() method is executed while the same button is held down.
#define DFN_LoopDelay_Max 15
int intButtonPressed = -1;
int intButtonPressed_Last = -1;
int intLoopDelay_Max = DFN_LoopDelay_Max;
int intLoopDelay_Reset = DFN_LoopDelay_Max;
int intLoopDelay_Counter = DFN_LoopDelay_Max;
intButtonPressed = GetButtonPressed();
if (intButtonPressed == intButtonPressed_Last)
if (intLoopDelay_Counter <= 0)
intLoopDelay_Reset -= 5;
intLoopDelay_Counter = intLoopDelay_Reset;
intButtonPressed_Last = intButtonPressed;
- 22nd August, 2021: Initial version
Not much else here... now, if I could only figure out how long to cook a two-minute egg...
Christ Kennedy grew up in the suburbs of Montreal and is a bilingual Quebecois with a bachelor’s degree in computer engineering from McGill University. He is unemployable and currently living in Moncton, N.B. writing his next novel.