Gadget Renesas

Linking Ideas and Electronics

がじぇるね工房

Let’s try IoT with GR-KURUMI

GR-KURUMIでIoTをやってみる編

####

Let’s try IoT with GR-KURUMI

Try to send data by connecting cloud service, IFTTT from GR-KURUMI, connected with XBee W-Fi.
IFTTT is the service if it identify the event, then make it happen.
IFTTT enable to link among plural services using internet.

Sending the event from GR-KURUMI to Maker channel in IFTTT, consequently make the event happen to send the message in Twitter.

Connecting DNS server to obtain IP address in IFTTT, also access NTP server to obtain exact time so that it precisely send the data within a specified period of time.
Please refer to「Using the function on GR-KURUMI, Wifi vol.」

Setting of Xbee Wi-Fi , please refer to API mode in wi-fi vol.

image01

Next stage, let us explain about setting of IFTTT side.

Sign in IFTTT to generate the recipe. IF:MakerChannel, THEN:Twitter
Get ready Twitter account in advance so that application can link with twitter.
GR-KURUMI access IFTTT with event name on generating recipe, as the secret key. Don’t forget to note the secret key. Every time we generate new recipe, we use the secret key. Set the format for the message to be sent in twitter. Please refer to the tweet text column in the chart for the format, three values would be sent out as messages.

Additional character lines can be added within the twitter restriction of 140 characters.※IFTTT enable to link among plural services. Besides twitter, we can send message to mail software or Dropbox as well. For setting up, basically, please refer to this method.
Let's practice.

####

Programming

In the case of sending data to Maker channel in IFTTT, the host name of destination is as follows.
maker.ifttt.com

This is a kind of domain name for human awareness, let’s access DNS to obtain global IP address from this.

To make sure to send the data to IFTTT, exactly within a specified period of time, set the clock on GR-KURUMI using NTP.

I believe that It’s so cool to drive the event by time.

※ Almost all programs use the common code as it is which you generated in 「Using the function on GR-KURUMI, Wifi vol.」

Sending the data to Maker channel, imagine the data upload into server with HTTP, specifically, sending below message to IP address obtained by DNS, with port number 80.

POSThttp://maker.ifttt.com/trigger/(event name)/with/key/(secret key) HTTP/1.1
Host: maker.ifttt.com
Content-Type: application/json
Content-Length: 79
Connection: close
A blank line
{“value1”:“Temperature:24.4”,“value2”:“BRIGHTNESS:0.0”,“value3”:“CountUp:57.0”}
Message is split into two parts by a blank line.

The upper lines : With HTTP header, explain the details.
The lower lines: the data in JSON format
Only plaintext can be sent, feel that “the secret key” doesn’t effective, but leave it alone this time.

Confirm the feedback from IFTTT side to see if upload is going well or not.
At the top, if you can see the figure of 200-299, like
HTTP/1.1 200 OK
that’ll be OK.Otherwise, problem may happen.

See the uploaded data of room temperature, brightness, the number of the counter into IFTTT every 5 minutes.
Checked with Twitter client with smart phone.

image02

####

Notice about IoT

On generating the recipe in IFTTT ,a unique code has been assigned for secret key.
However, actually, plaintext is sent to IFTTT without encryption, the contents as well.
It is tough for low-end microcontrollers to corresponding to encryption.

Linking with twitter, the contents may probably get leaked.

Based on this, judgement is required whether it come to the problem or not if the data you are going to send on internet get leaked.

MVP information

@chobichan

General hard engineer.. submitting his writing for technical magazine occasionally.
twitter account:
https://twitter.com/chobichan

Chobichan avatar

Follow him

All articles from @chobichan

share