loading

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!

Step 1: Power the TimeSquAir and Connect to Its Node-RED Interface

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.

Step 2: Set the Attributes Minutes and Seconds

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!

Step 3: The Main Timer Loop

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.

Step 4: The Count Down Machine

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

Step 5: The Output

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

Step 6: The NFC Input

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!

Step 7: Learn More

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

About This Instructable

691views

10favorites

License:

Bio: The ThingBox Project - A ready to flash Raspberry Pi image that contains Node-RED and Internet Of Things software for non developers.
More by thethingbox:Telegram Bot and TimeSquAir: the Bedrock Install Zwave Soft Remote on TimeSquAir Install Zwave LED Bulb on TimeSquAir 
Add instructable to: