Saturday, February 20, 2016

First IoT Gizmo

I made my first internet-connected sensor.  I suppose this makes me an Internet of Things expert, right?

While I'm no expert, I did learn a lot along the way.  One of the biggest learnings was how stupid-easy it was to set up a place to dump my data.  I used data.sparkfun.com to publish data "stream".  This freely available platform is based on phant, which appears to be developed by Sparkfun.  Sign up was fast, easy, and didn't even require me to give away all my personal information!

Here's what their UI looks like:

A handy button labeled "Export to Analog.io" produces an ultra-schnazzy chart:


There is a phant library accessible in the Arduino IDE library manager.  I looked into this briefly but determined it to be of little use in the case of ESP8266.  The library looks to be focused on constructing the message payload that you could just send out over TCP port 80, which makes sense if you're running on an Arduino and may have different TCP/IP stack implementations depending on what adaptation gizmo (e.g., ethernet shield, WiFi shield, etc...) you're using to connect it to a network.

Since the ESP8266 features a full TCP/IP stack out of the box and the libraries include a HTTP client, it was easier just to use that.  I was in a rush to see it working, so created data with a GET request.  As a professional software engineer who works in RESTful services, this made me die a little bit on the inside.  I have to keep reminding myself that this is a hobby, and that it's OK to lower my coding standards back down to the undergrad-level of "get it to work."

The gizmo itself consists of an ESP8266 and a 18B20 one-wire temperature sensor.  The 18B20 is much more expensive than the pile of LM35 sensors I had laying around.  Since the ESP8266 has no onboard ADC (well, no ADC that you can use on a GPIO pin), one is forced to use a digital sensor.

This was my first attempt at one-wire interface.  One-wire is a bit of a misnomer because you also need a ground (which in my case was a wire), thereby increasing your wire count to two.  Since the circuitry for parasitic power wasn't work it for me, my wire count was again incremented putting us at three.  Long story short, it worked out just fine.

Here's the gizmo:



No comments:

Post a Comment