A Smart Connected Timer

by thethingbox in Circuits > Raspberry Pi

2525 Views, 12 Favorites, 0 Comments

A Smart Connected Timer

TimesQuAir Mart Timer

You always need timers, especially in your kitchen, to control timings, and to get warned when something's ready. Let's take the 10 minutes necessary to build a smart connected timer. In this recipe, the timer will take information from NFC, and will play a sound and send a SMS to tell the end of time. But as soon as the basics are there, you'll be able to imagine and implement whatever input or output for this smart timer!

Power the TimeSquAir and Connect to Its Node-RED Interface

0.JPG
Timer.JPG

If it's the first time you use a TimeSquAir, no worry, it's very simple: make sure your TimeSquAir is connected to your local network, power it up. When the TimeSquAir has finished its power up sequence, connect o its Node-RED interface through a computer, connected to the same local network. We will then build a new worksheet.

Set the Attributes Minutes and Seconds

1.JPG
2.JPG
3.JPG

Let's set, for a first flow, the two attributes of "msg" that will be the minutes and seconds variables.

For this example, we can put msg.minutes to 2 and msg.seconds to 30. Our first timer example will count down 2 minutes and 30 seconds!

The Main Timer Loop

4.JPG
5.JPG
6.JPG
7.JPG

Now, let's enter the heart of our timer, with the main loop. Principle is obvious: each time we enter the loop, we test if the seconds are at zero:
- if not, we go to the next step, which is the countdown machine,
- if yes, we test if minutes is also to zero:
- if yes, that means the timer has finished and we can go to the output
- if no, we can subtract one minute, and set the seconds to 60, in order to continue the count down.

The Count Down Machine

8.JPG
9.JPG
10.JPG

This is a very simple machine! After waiting for 1 second, we substrat one second and re-enter the main timer loop.

We use this part to display the remaining time on the LED panel of the TimeSquAir. To do this, we merge the msg.minutes and the msg.secondes in the msg.payload attribute. The only trick is to test if we are between 0 and 9 for the seconds in order to add a "0" for the display (for example, not display 2:7 when there is still 2 minutes and 7 seconds left, but 2:07, which is more convenient).

The Output

11.JPG
12.JPG
13.JPG

When the time has came to 0 minutes and 0 seconds, it's "time" to launch an action. In this example, we play a sound, that is stored in the memory of the Raspberry. But it could be whatever you want, whatever you need! It could send a SMS, say something through the vocalizer, send a mail.....

The NFC Input

14.JPG

We find rather cool to make a set of NFC tags for the common timer values we are used to face. Examples: a hard-boiled egg, your favorite pastas, rice, potatoes, your best siesta time, your favorite sport exercises time frames...

Just tap a tag on the TimeSquair, and connect it to your wanted minutes and seconds values. Activate, and you're done!

Learn More

tsa.jpg

Learn how to link things together with TimeSquAir and IBM's Node-RED and discover the other Instructables related to the ThingBox and TimeSquair