Click here to Skip to main content
15,867,308 members
Articles / Internet of Things / Arduino

Arduino Kitchen Timer & Thermometer

Rate me:
Please Sign up or sign in to vote.
5.00/5 (8 votes)
22 Aug 2021CPOL3 min read 10.9K   145   9   10
How to keep your KD from burning in the pot
This article makes use of a Arduino Nano, OLED screen, buzzer & buttons to help you cook up a storm

Image 1

Introduction

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.

Background

I burned jell-o once ... and I don't want to talk about it.

What You Need

  1. Arduino Nano - or other microcontroller
  2. OLED 128x32 screen
  3. DS18B20 Waterproof heat Sensor
  4. Piezzo buzzer
  5. Toggle switch
  6. Buttons
  7. Battery, wires & assorted of resistors
  8. A dash of oregano

Image 2

Button Controller

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.

C++
display.display();

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...

C++
#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.

C++
void EditSelector_Draw()
{
 display.fillRect(0, 
          DFN_Th_Target_Upper_Rec_Top, 
          1, 
          DFN_Th_Target_Upper_Rec_Height, 
          intEditState == DFN_State_EditUpper ? WHITE : BLACK);
 display.fillRect(0, 
          DFN_Th_Target_Lower_Rec_Top, 
          1, 
          DFN_Th_Target_Lower_Rec_Height, 
          intEditState == DFN_State_EditLower ? WHITE : BLACK);
 display.fillRect(DFN_Ti_Hour_Rec_Left, 
          DFN_Ti_Hour_Rec_Top + DFN_Ti_Hour_Rec_Height, 
          DFN_Ti_Hour_Rec_Width, 
          1, 
          intEditState == DFN_State_EditTimer_Hour ? WHITE : BLACK);
 display.fillRect(DFN_Ti_Minute_Rec_Left, 
          DFN_Ti_Minute_Rec_Top + DFN_Ti_Minute_Rec_Height, 
          DFN_Ti_Minute_Rec_Width, 
          1, 
          intEditState == DFN_State_EditTimer_Minute ? WHITE : BLACK);
 display.fillRect(DFN_Ti_Second_Rec_Left, 
          DFN_Ti_Second_Rec_Top + DFN_Ti_Second_Rec_Height, 
          DFN_Ti_Second_Rec_Width, 
          1, 
          intEditState == DFN_State_EditTimer_Second ? WHITE : BLACK);
 display.fillRect(DFN_Ti_Start_Left, 
          DFN_Ti_Start_Top + DFN_Ti_Start_Height - 1, 
          DFN_Ti_Start_Width , 
          1, 
          intEditState == DFN_State_EditTimer_Start ? WHITE : BLACK);
 display.fillRect(DFN_Ti_Reset_Left, 
          DFN_Ti_Reset_Top + DFN_Ti_Start_Height - 1, 
          DFN_Ti_Reset_Width , 
          1, 
          intEditState == DFN_State_EditTimer_Reset ? WHITE : BLACK);
 display.display();
}

Image 3

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.

C++
#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;

void Handle_Buttons()
{
 delay(50);

 intButtonPressed = GetButtonPressed();
 if (intButtonPressed == intButtonPressed_Last)
 {
  intLoopDelay_Counter --;
  if (intLoopDelay_Counter <= 0)
  {
   intLoopDelay_Reset -= 5;
   intLoopDelay_Counter = intLoopDelay_Reset;
  }
  else
   return;
 }
 else
 {
  intLoopDelay_Reset
   = intLoopDelay_Counter
    = intLoopDelay_Max;
 }

 intButtonPressed_Last = intButtonPressed;

History

  • 22nd August, 2021: Initial version

Not much else here... now, if I could only figure out how long to cook a two-minute egg...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO unemployable
Canada Canada
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.

Comments and Discussions

 
Questionhello Pin
Member 1487595413-Feb-22 3:48
Member 1487595413-Feb-22 3:48 
AnswerRe: hello Pin
Christ Kennedy13-Feb-22 4:20
mvaChrist Kennedy13-Feb-22 4:20 
GeneralMy vote of 5 Pin
Ștefan-Mihai MOGA29-Sep-21 19:11
professionalȘtefan-Mihai MOGA29-Sep-21 19:11 
GeneralRe: My vote of 5 Pin
Christ Kennedy29-Sep-21 21:52
mvaChrist Kennedy29-Sep-21 21:52 
QuestionBluetooth Pin
BernardIE53178-Sep-21 1:48
BernardIE53178-Sep-21 1:48 
It may be amusing to Bluetooth or Wi-Fi the temperature etc. to your work-station - Cheerio
AnswerRe: Bluetooth Pin
Christ Kennedy8-Sep-21 2:25
mvaChrist Kennedy8-Sep-21 2:25 
QuestionMy vote of 5 too Pin
Barry Dowdeswell23-Aug-21 19:17
professionalBarry Dowdeswell23-Aug-21 19:17 
AnswerRe: My vote of 5 too Pin
Christ Kennedy23-Aug-21 23:05
mvaChrist Kennedy23-Aug-21 23:05 
GeneralMy vote of 5 Pin
Nikhil Dabas22-Aug-21 22:59
Nikhil Dabas22-Aug-21 22:59 
GeneralRe: My vote of 5 Pin
Christ Kennedy22-Aug-21 23:43
mvaChrist Kennedy22-Aug-21 23:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.