Introduction

A while back I created an IoT application that gathers environmental data using an Adafruit Huzzah. The Huzzah is a hobby electronics development board build around the ESP8266 processor from Espressif and it is capable of establishing its own Wi-Fi connection. Why the ESP8266 processor? I was looking for something inexpensive. I decided to proceed with the assumption I wanted something with which I could set up many instances.

When I first started this project, the Raspberry Pi Zero had just come out. It was all the rage. It was a $5 development board and essentially a small computer. This was definitely cheaper than the $10 price of a Huzzah.

But there were other costs. The $5 cost only covered the board itself, and possibly some headers. You still needed a way to power it, an SD card to put the operating system on, some way to connect it to the network, and so forth. If I assumed the cost of certain items – breadboard, sensors, wires, USB cable, power – were the same for both the Huzzah and the Pi Zero, then I could compare just the basic, stripped down/runnable cost of both:

There may be cheaper parts I could find for the Pi Zero, but I doubted the cost would get much less than the Huzzah. So I proceeded to work with it.

The application I would write was fairly simple. It would gather temperature, humidity, and light levels and send them to a RESTful service or website at specific intervals to be logged in the database. The data could be later analyzed & used to determine changes over time.

Again, why the ESP8266? Partially because I needed some sort of realistic project to hold my interest, but also because I was curious how temp and humidity changed over time in our office.

Breadboard Setup

I ordered the ESP8266, a DHT22 temperature and humidity sensor, and a photocell from Adafruit and wired them up on a breadboard I already had from a different project.

The DHT22 uses one wire to an input on the Huzzah, as does the photocell. The Huzzah has only one analog input and it wants only 1 volt, which is a bit different from regular Arduinos that’ll accept a voltage similar to what the board outputs: 3.3 volt or 5 volt. So I also included some resistors to drop the voltage I was feeding into the photocell to roughly 1 volt:

Vin * R2 / R1 + R2 = Vout

Or

3.3v * 1.5k Ohms / 1.5k Ohms + 3.3k Ohms = 1.0312v

It’s a little more than a volt, but this was as close as I could get with resistors I had on hand. I figured the board could handle the excess if it ever came close, which seemed unlikely unless I was shining a light directly on the photocell.

If you’re like me and you can’t remember what the colors on a resistor mean, Digi-Key has a nice calculator for that here.

I also included a couple of LEDs to give me some feedback. Since I would not otherwise know whether it’s working or encountering errors, I added one for each – a blue for successful/activity, and a red for errors. I did not bother adding resistors for these. Their voltage requirements are close to 3.3 volts and, well, I have a lot of them.

I won’t go into too much more detail on the physical setup in this article. If you want specific pinouts for either the Huzzah produces or the DHT22 sensor, you should check Adafruit’s site and their tutorials, which are excellent. They have tutorials specific to the both Huzzah and the DHT22.

I arrived at an arrangement on my breadboard that worked. Here’s a photo of the final setup:

Since it’s a little difficult to show exactly where everything is connected in this photo, here’s (roughly) the same thing in Fritzing:

And that’s it! The setup was ready for me to load a sketch.

Give the other posts in this series a read:

IoT with an ESP8266 (Part 2) – Arduino Sketch

IoT with an ESP8266 (Part 3) – ASP.NET Core Project and Database Setup

IoT with an ESP8266 (Part 4) – IoT Web Application

IoT with an ESP8266 (Part 5) – IoT with Azure