Introduction: Arduino Kitchen Timer With an Introduction to Timer Interrupts

Picture of Arduino Kitchen Timer With an Introduction to Timer Interrupts

Welcome to my first instructable,

I decided to make a rather simple project to enter the instructable world. This project is about making a simple kitchen timer with a Arduino Uno. Thus I will give a little introduction to the 2.2" tft display, and to timer interrupts.


I will start out with how to assemble the hardware and putting the parts together. Afterwards I will introduce you to the tft display, it´s libraries and the timer interrupt which is the key to the kitchen timer.

The use of an soldering iron and a 3D-printer is recommended but not absolutely necessary.

Step 1: Assembling/Printing the Parts

Picture of  Assembling/Printing the Parts

The parts you need for this project are:
-A case for the timer. I designed myself a case with the open source program SketchUp and printed it with a 3D printer. I attached the .std files if you are interested to print yourself the same case. However you don´t necessarily need to print a case. An old Tupperware case should do it´s job as well.

-Secondly you need an Arduino. I used the Arduino Uno for this instructable.

-The 2.2" adafruit tft display.

-A piece of a strip-board.

-4 buttons to configure the time

-1 flip switch to be able to turn the timer off and on

- 9V battery with the matching wire, to ensure the power of the timer

-Piezo element to play the alarm melody

-4 M2x15 screws with the matching nuts to fix the display to the cover

-4 4x15 screws to fix the cover to the case.

-Some Arduino wires

Step 2: Embedding the Buttons in the Case

Picture of Embedding the Buttons in the Case

In the 3D model which I attached in step 1, you can see that there is a groove to assure the position of the buttons. Make sure that you place them the right way, so that you know where to connect the ground and the Vcc. In addition, you can glue them to ensure that they won´t slip away when solder the wires to the buttons.

Step 3: Fixing the Display to the Timer Cover

Picture of  Fixing the Display to the Timer Cover

Bring the tft display in the right position. When you got that, you are able to fasten the tft display with the 4 M2x15 screws and the matching nuts to the cover.

Step 4: Drill a Hole in the Case and Fix the Power Switch

Picture of Drill a Hole in the Case and Fix the Power Switch

Drill a hole with the right size in the case. For the flip switch I am using 6mm were fine. Solder the wires to flip the switch before you fasten it to the case.

Step 5: Placing the Piezo Element

Picture of  Placing the Piezo Element

Glue the piezo element on the inside of the case.

Step 6: Wiring

Picture of Wiring

The wiring is customized to my proper code, if you use a different code the wiring is different as well.

The buttons are connected with the pins: 4,5,6,7 and with the strip-board which is connected to GND.

The piezo element is connected to the pin 3 and with the strip-board which is connected to GND.

The wiring of the display:- GND of the display to GND of the arduino

-VIN to 3.3V or 5V (display support both)

-D/C to pin 9

-RESET to pi 8

-CS to pin 10

-MOSI to pin 11

-MISO to pin 12

-SCKL to pin 13

The 9V battery is connected to the flip switch and the GND of the Arduino. The flip switch again is connected to the VIN of the Arduino.

I decided not to work with a breadboard to save some space. This way you have to solder all the wires, but it is worth the effort.

Step 7: The Code

The code is the tricky part of the project that´s why I am describing this step a bit more detailed than the others.

There are some comments in the code which explain what is does. But first I will introduce you to the libraries you need. I used a adafruit 2.2" 18-bit color TFT LCD display with microSD card breakout. It is a very good display for Arduino and works with the master/slave principle which means that you need less ports than on a 8 bit LCD. That is good if you don´t have much pins like on the Arduino Uno. To use the display you need to download the following libraries:

-Adafruit_ILI9340

-Adafruit-GFX

To use the timer interrupts you need the TimerOne library.

To use the piezo element you need the Tone-V0005 library.

You need to put there libraries in your Aduino library folder in order to use them.

A good test to see if the display works is the graphicstest program which is included in the library.

The timer interrupt:

A timer interrupt always tiggers a methode after a certain time, the so called ISR(Interrupt service routine).Timer interrupts allow you to perform a task at specifically timed intervals regardless of what else is going on in your code. In this case we want to trigger that interrupt every second and reduce the global variable of the time by 1 second. This way the time is reduced by 1 every second no matter what else is going on in the code.
In the ISR, the interrupts are detached which means interrupts can´t be triggered in the ISR. The delay() function also works with interrupts. That´s the reason you can´t call that function in an ISR. If you absolutely need a delay in your ISR you can work with millis

For the exact syntax check out the code.

If you have questions, feel free to ask.

Step 8: Enjoying the Timer

When you have uploaded the code and finished the construction you can turn the timer off and on with the switch flip and configure the time with the 3 buttons and start/stop the time with the forth. When the time left is at 00:00:00, you can hear the Star Wars theme music.

If you enjoyed the instructable feel free to vote for it in the HACK YOUR DAY CONTEST and to leave feedback in the comment section.

Thank you and have a nice day!

Comments

magkopian (author)2016-03-16

Very nice attempt for your first instructable, good job. I don't know much about 3D printing so I'd like to ask you a question. On an instructable that I uploaded a couple of days ago, I used a 135x75x50mm plastic enclosure which I bought from eBay and it costed me roughly 8€ including shipping.

I'm not sure about the exact dimensions of your own case but from the photos I think it's roughly the same size as mine. So my question is, ignoring the cost of the actual 3D printer, does it make sense from a cost point of view printing your own case if it's going to have such a simple design or buying an off the self one is a more cost effective solution?

mlorang (author)magkopian2016-03-16

Thanks!
My case weights about 60g. The 3D printer filament costs about 25€/kg which means that my case would cost roughly 0,06x25€= 1,5€. Apart from that it super cool to design your own parts which exactly match your desires.

magkopian (author)mlorang2016-03-16

Great, thanks for the response! I was thinking about getting a 3D printer for a while, but I was afraid that apart from the cost of the 3D printer, the actual printing process would be more expensive for making simple objects (like box enclosures for example) than buying off the self ones. So, if you can make something so large for just 1.5€ I think it does worth it after all.

As for designing your own parts even though I have no experience with 3D design I have with PCB design, so I agree that designing something by yourself is far more enjoyable.

mlorang (author)magkopian2016-03-16

I have to admit that it my brother's 3D printer and the case was my first 3D model. From what I heard from my brother the hard part about 3D printing is to find the right configuration and firmware. But once you got that you can print whatever you want ;)

wold630 (author)2016-03-15

Awesome first project! Thanks for sharing and welcome!! :)

mlorang (author)wold6302016-03-15

Thank you! :)

About This Instructable

3,446views

90favorites

License:

Bio: Computer Science student at RWTH Aachen, Germany
More by mlorang:Arduino kitchen timer with an introduction to timer interrupts
Add instructable to: