Sensor Network: The Hardware

on 26 August 2016 in ESP8266

After a lot of gambling around with a breadboard and afterwards soldering on a perfboard, I finished the first version of the sensor, which I want to spread in my flat. So the hardware is finished (for now – there are ideas for improvement). For the software I tested the individual parts.

The Hardware

The Hardware consists of

  • ESP8266-dev board from Olimex
  • HDC1008 temperature and humidity sensor from Adafruit (meanwhile discontinued)
  • FTDI board from Watterott (during the programming)
  • LED and resistor
  • pushbutton

Here is a photo of the finished sensor:

ESP8266 temperature and humidity sensor


And here is the circuit (I only had an ESP8266-07 in Fritzing, but it has essentially the same pins as the ESP8266-dev from Olimex):




The Software

After installing the ESP8266 software for the Arduino IDE. I tried the first sketch.


I took the first sketch form the fantastic site of Rui Santoz. There I learned how to install the ESP8266 in the Arduino IDE, and how to blink an LED from ESP8266. The code is on github: esp8266blink. Additionally the sketch reads the supply voltage and sends it to the serial port.


Now something more meaningful. The HDC1008 (or HDC1000) sensor gives the temperature and the humidity via I2C. Adafruit had a nice breakout board (which is discontinued meanwhile) and the library for it. So the sketch was no problem. It reads the sensor once a second and sends the data to the serial port.


The next was a little more difficult – connecting to WiFi and sending messages to the MQTT broker, which runs on my Raspberry Pi. I used the library from Nick O’Leary.

To be able to start the serial console I added a “sleep (5000)” at the beginning of the setup function. I could not get a connection. After a hint from Hubert from the Arduino Group Hannover I reduced this to 2000 msec, and everything worked as expected. The sketch connects to WiFi and sends a message once a minute.


Because some (or perhaps all) sensors shall run on battery, I have to save energy. To this end the ESP8266 offers a deep sleep mode. The sketch is again rather simple. It blinks the LED for a while and goes to sleep for 5 seconds.

The Future

The next step is to combine all the above, and then to write the software on the server side. I’m not quite sure, if I put the values into a database or into a plain text file.


One Response to “Sensor Network: The Hardware”

  1. […] testing the single modules for a sensor I finished the combination. Now the ESP8266 reads the temperature and humidity and […]

Leave a Reply