-
1Configure AdafruitIO
Go to AdafruitIO account or register (io.adafruit.com) if you do not have one. The account is free of charge with some limitations. However, for this project the free account is sufficient.
> Create a Dashboard and name it e.g. MyHome
> In the dashboard create a Block
> Select "Line Chart" type
> Create a data feed channel, e.g. MyTempSensor
And here we get this Line Chart, which looks like on the image below:
The graph is empty and we need to feed it with the data from our sensor. In order to do this we also need to create a Webhook for the MyTempSensor feed:
> Go to the Feeds tab and click on MyTempSensor (or whatever you named it)
> Create a Webhook (right-bottom corner)
> +Create URL link as shown below
Now we have the webhook URL link which we need to copy-paste to IOT Cricket configuration.
NOTE: You can close this window and reopen it again by clicking on Webhooks link - the URL remains the same.
Optionally, before moving on to Cricket's configuration of our sensor, you can test if the webhook works by feeding data with a curl commands e.g.:
curl -X POST -d '{"value":"20"}' -H 'Content-Type: application/json' https://io.adafruit.com/api/v2/webhooks/feed/YOUR_TOKEN
-
2Configure device (IOT Cricket)
In this project we use the IOT Cricket WiFi module for our sensor device to report a temperature every 5 minutes (to save battery we can later lower the frequency to 1 hour and disable force-update). Later you can use IOT Cricket to build other battery powered WiFi sensors, alarms, buttons, switches and connect them too.
In the first step we connect batteries to Cricket.
Cricket comes with a built-in temperature sensor so we do not need to attach any external sensor for now. We need to configure it to send temperature value to our AdafruitIO webhook by setting both url and data for HTTP_POST connectivity method.
We press the Cricket's built-in button for 5 seconds, which opens the toe_device hotspot. Then we connect to the hotspot from either a laptop or a phone and pass our WiFi credentials (see the detailed steps here)
Then configure it with the following settings as shown below.
- Select HTTP_POST connectivity type
- url: copy/paste the URL from the AdafruitIO webhook e.g:
https://io.adafruit.com/api/v2/webhooks/feed/YOUR_TOKEN
- payload: we need to define in JSON format what data we want Cricket to send to our webhook. We use a #temp tag which Cricket replaces to an actual temperature value before sending it out. If we used an external sensor then we would have to use #io2 instead of #temp. The complete payload definition looks like this:
{"value":"#temp"}
- Enable RTC and set it to wake up every 5 minutes
- Enable the Temperature sensor
So our complete configuration looks like on the image shown below:
Now we can exit the configuration and our device is ready! Cricket sends data, every 5 minutes, to our AdafruitIO webhook which is feeding the graph as shown below:
-
3Summary
In this project we have shown how you can easily build your own battery powered WiFi sensor device, transmit and visualise its data by using both the Cricket WiFi module and AdafruitIO without writing a single line of code.
For this project we chose AdafruitIO but there are many other great services, which you might also want to consider. To mention a few: Blynk, Thingsboard, ThingsPeak, Horavue, Zapier, IFTTT, Google Sheets, etc. Those services let you play with the data out of the box. There are even more advanced systems which might require a bit more effort to set up but in return they bring almost endless possibilities such as Home Assistant, OpenHAB, Domoticz, NodeRED, Grafana, where you can do a lot more advanced projects. However, the basic principles of how you build and integrate your devices remains almost the same.
The ecosystem of software and services which can be integrated with either HTTP or MQTT is HUGE! There are a lot of great systems as mentioned above to let you come up with a great user experience. Not only can we plot a graph from a single temperature sensor, but we can have great dashboards visualising data from many various types of sensors and events.
Now, the sky is our limit of what other WiFi devices we can build using IOT Cricket modules and integrate them with our dashboards.
Thanks for getting up to here. We hope you enjoyed this tutorial!
Things On Edge team
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.