Now days microcontroller platform for IoT devices are becoming more and more powerful so much so that they can now sport an HTTPS stack and hence send telemetry to an HTTPS capable data broker like initialstate.com. Which means no need for any linux based gateway/hub - you can do away with your Raspberry Pi as a go between your microcontroller node and the internet.
You ask why would some one want to do that? Simple - lesser the number of components in your system, lesser the points of failure.
So, I wanted to explore if it was possible to use a Particle Photon to send data directly to initialstate.com and recently it just became possible when a few good folks ported an SSL library to Spark Photon.
|My Particle Photon with SHT11|
- Get a Particle Photon and connect it to SHT11. SHT11 is a digital temperature and humidity sensor. It works at 3.3V logic levels and can be powered by the photon itself. The photon will draw power from any nearby device (computer, smartphone charger or router) which has a spare USB port. Here are the connections:
- Install the Particle app on your android phone and use it to create an account for yourself and link your particle photon to your home WiFi network.
- Get an initialstate.com account and create a bucket. Make sure to note down the two API keys (Access key and Bucket Key)
Noting down your initialstate.com access keys
- Now open https://build.particle.io and login with your particle account. Create a new App. add two libraries to it: HTTPSCLIENT-PARTICLE and SHT1X
- Write the following code into the .ino file that has been created by default. Make sure to modify the code so that it has your own initialstate.com access keys.
This is how your Web IDE should look like.
Note the place where you need to add your own initialstate.com Access keys.
- Download the firmware (using the Web IDE - over the air) into your photon and wait for a few seconds then open your initialstate.com tiles view, you note the data being uploaded every 40 seconds.
|My Particle Photon and SHT11 is installed inside my house.|
This is the lines app view showing temperature and humidity data graphed over the past two month
- For background on how hubs are used to do HTTPS/TLS, read Your Very Own Raspberry Pi Smart Home Hub
- Webhooks when used with your Particle devices can bypass the use of Raspberry Pi kinda gateway/hub as well - AND THAT WOULD DEFINITELY BE A BETTER WAY to send data to initialstate.com than the one I have specified above because of one main reason - HTTPS stack uses up precious code space on your particle microcontroller which is not ideal, you need that re
- Arduino Yun has a microcontroller and a microprocessor (running Linux) on it. You can use that to send DHT11 readings to initialstate.com as well.
- I tested the above code on Particle Cores - The web IDE threw compilation errors. In case of Particle Core, you can use webhooks like so.
- Forum post regarding matrixSSL ported to Particle Photon by glowfi.sh team is here
- Github repository for https library for Particle Photon is here.