IoT Light Sensor: It’s a Thing!


I wanted to mess around with the Sparkfun Thing, which, by the way, is the worst name ever for an electronics board. The ‘Thing’ is a breakout and development board for the ESP8266 WiFi system on chip that can be used with the Arduino IDE. It’s easily confused with the Sparkfun Thing – Dev Board, which is very very similar except it doesn’t have built in LiPo battery charging and instead has a built in programmer so you don’t need to use an FTDI chip. So if you’re working with either of these boards, be careful of the slight differences. Sparkfun has great hookup guides for each board, but check that you’re reading the right one. (Thing hookup guide v Thing – Dev hookup guide.)

Sparkfun also has this service called Phant, which is a simple way to post data to an online stream from a WiFi board. Between the Thing board and Phant, I was able to get set up posting data to an online stream in about 10 minutes, despite the fact that I have no prior experience with anything except Arduinos. Amazing. Good job, Sparkfun.

The hookup guide got me probably 95% of the way there. It suggests increasing the upload speed for faster uploads and it’s true that it’s a tad slower than a regular Arduino for uploading code. However, increasing the upload speed resulted in several failed uploads for me and sometimes there was no warning that it failed, my code simply didn’t work. I stuck to the slowest upload speed and had no more problems.

I was also interested in messing around with Sparkfun’s micro oLED display, so I got one of those and a RGB light sensor. My project idea was to make a small, internet-connected device that posted information about the light levels. I’ve always been curious about how much natural light my office gets; I figured with RGB values I should be able to see how the color changes throughout that day which would indicate natural light versus light from indoor lighting which would stay constant.

The display is amazingly small but also really cute and good resolution. Unfortunately, the built-in text Arduino libraries are broken when you’re using the ESP8266. There’s a bug filed for it on github from August 2015. I had a poke around the library but I don’t understand nearly enough of it to try fixing it. If you do, please go fix it! It’s surprisingly obnoxious to be unable to print text. There are work-arounds, but none of them seemed worth the effort. Things like drawing lines and rectangles work fine. I use the display to count down until the next data post, which has the added benefit of indicating when it’s lost connection.

After prototyping it on a small breadboard I moved it to a proto-board with headers. This will allow me to easy take out the boards if I want to reprogram the Thing or use the boards for a different project. I 3D printed a simple case for it with an acrylic top and now it lives happily on my desk.

The WiFi connection is thus far extremely reliable. I’ve had it chugging along for almost two months now and while occasionally I notice it has disconnected it always reconnects. At some point I want to have a quick look at connectivity using my data stream: I post data every 30 seconds, so by looking at the time between posts I can get a good sense of the reliability of the connection. A blog post for some other time.

I’ve also started messing around with plotting the data using Google Charts. That’ll be for my next post.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s