A simple temperature sensor (ESP8266-01 and DS18B20)

In the spirit of building from scratch (as much as possible) while keeping the project manageable I choose a small tiny member of the ESP8266 family.

The ESP8266 is a small integrated micro-controller (a little blue thing with a lot of even smaller things stuck on top) which we can easily say has been a game-changer. It is small, cheap, versatile easy to find, and – no surprise – is at the core of many many projects of IoT (both commercial and DIY ones).

There are other very popular ones – like ESP32 – but from ESP8266 a number of other products were created.
One of them the ESP8266-01 was my choice. It is really (really) small (the ‘long’ side measures 2.5cm), but it packed with a surprising set of skills. One of the most remarkable is that this little guy has a wi-fi integrated module and – yes – it can run as a standalone and go on the Internet.

The one and only ESP8266-01

I chose it because I wanted to build something small which could run on batteries and live in a small case. Looking back this choice has light and shadows (as always) but this something I will tell you about later on.

Now the sensor itself, many projects you will see around use the DHT22 a humidity/temperature sensor – which has nice drivers by Adafruit – but I read that this sensor doesn’t particularly like if the ESP cyclically goes to sleep for a while (in order to save battery) and then restarts its work.

As my idea was to build an energetically efficient sensor I thought that this wasn’t a good thing (then I found out that many procedures to put the ESP to sleep work like a charm on the ESP8266 but not on the ESP8266-01).
So I decided for another very popular and well made sensor (only temperature) the DS18B20, which also comes in waterproof version (for very adventurous stuff).

 

The next things I needed were:

  • a breadbord
  • jump wires
  • a 4.7k resistor
  • batteries (2xAA with batteries holder)

I will tell you immediately how to put everything together but first you will need another thing that you may have or not (I didn’t) a way to talk to your ESP8266-01, a USB to TTL serial converter. Basically a thing that you plug in your computer on one side and connect to the ESP8266-01 on the other.

The good thing is that if you buy it once you can use for as many project as you want and with different micro-controllers. Some controllers – like some ESP32 and some ESP8266- come with a micro USB port of which I can see the enormous practicality.

However, I bought one equipped with the apparently very suitable CP2102 chip. To be precise I bought this one.

Well!! Now we have everything, let’s do it!!

Go back to: A first project of home automation || Go to: Build the sensor