Monday, June 23, 2014

Asynchronous operations triggered by arduino serial data

Another interesting and useful thing to know about Jubito is that its continuously monitor the serial port where arduino is connected. That allows as to control any message that arduino prints out. There is two ways to use that kind of data. One is by creating a new instruction set, which explained in this post, and the other one is by firing events. The second way is very efficient for asynchronous operations such as motion detection.

Let's make an example.


The above screenshot illustrates a MotionDetected message captured from a PIR sensor. In order to trigger an event or a sequence of actions we have to create a handler with the same name.

On Control Panel select Instruction Sets/Add New Event Handler


Then give the corresponding serial message as the name of the event handler


Action's can be vary depending your needs. In this example I will create a simple email notification. In the action field type...

judo mail send me@gmail.com me@gmail.com `Motion Alert` `A motion is detected at %calendardate% %time24%`

This will produce a message that would tell...
A motion is detected at 23/6/2014 14:07

Syntax of judo mail send API call...
judo mail send <from> <to> `<subject>` `<body>`

Read more about functions & judo API

To avoid signaling you every time that motion is detected you can use %whereami% function within evaluation which is explained in this complete example of security system.

The bottom line is that we can produce a variety of asynchronous operations that would be driven by received serial data.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.