>> BUILDING A WEATHER STATION WITH THE PARTICLE.IO PHOTON
A great way to compare IoT hardware is to build similar solutions and give
them a good test.
ControlEverything.com put together a
Weather/Nav Kit (Kit-4)
which I picked up while ordering the Photon and Electron micro-controllers
from particle.io. I had previously build a
temperature
monitoring solution using an Arduino UNO and some DS18B20 temperature sensors,
however due to the simplicity of the platform I commonly ran into
minor issues. The particle.io Photon on paper seems
to be quite robust; so what best way to find out by doing a field test with
the unit and replicate the environment previously built and do a comparison.
The Kit-4 setup comes with four sensors; however for this project I was
only interested in using three of them, namely SI7020-A20 (temperature and
humidity), CPS120
(barometric pressure) and SI1132
(light sensor).
The kit is simply to put together, simply connect the components together
and the project then utilizes the I2C
protocol for communication. Each sensor has a separate address and protocols
however they are well documented - we will not be using the magneto sensor.
Of course; I could just as easily publish the values to the particle.io
cloud - but in this specific case I only want to use the cloud for
firmware distribution, my goal is to have the data sent to my own server
for storage and analysis like was done previously with the Arduino UNO
project. As expected; some great documentation exists for the Photon;
specifically
TCPClient.
The final hardware configuration, complete in a nice protective box looks like:
Viola; everything works as expected - basing my efforts on the previous build.
While doing the Arduino version; we were also forced to implement a
watchdog timer
to capture when the device becomes unresponsive or locks up in some way.
A great example exists in the
documentation
and much like other platforms handle watchdog timer integration it is quite
easy to implement within the sketch - effectively two lines of code required:
// configure the watchdog timer, is 15 seconds before check-in, reset
ApplicationWatchdog wd(15000, System.reset);
...
void loop()
{
// pet the watchdog timer
wd.checkin();
}
Just another tribute to the particle.io platform - the fact they based so
much on the familiarity of the Arduino platform means that developers who
are familiar with it can migrate their solutions quickly and effortlessly.
It literally took me a total of two hours to grab what I needed from the
samples and migrate the existing code into the new project.
The end result - utilizing the
highcharts.com
graphing library:
Hooking it up to my existing cloud service and graphing system - we can see
that after running for a few hours; everything seems to be working smoothly.
It will be interesting to see how the software driven watchdog timer and
system level network connectivity solution handles every day usage and deal
with usage over prolonged periods of time.
I may need to re-consider where the weather station is placed, the light
sensor picked up the outdoor light that remains on all night and the
temperature seems to have picked up radiant heat from the unit itself
(may need to expose the sensors more). It seems the LED lights interfere
with the light readings as well so it may make sense to cover them - overall;
the system reports data constistently and the is holding up well under
the conditions.
The complete source code to the sketch (removed private elements) is here: