Zum Inhalt

ESP8266 Wifi Modul – Logging data to a server

While searching for something new overthere at banggood, I ordered some ESP8266 modules that are soldered to a dev board. The board is pretty awesome, has a solid quality and can be flashed without any trouble with a micro USB cable from your Arduino IDE. All you need to do is to follow some of the available tutorials on how to load the ESP Flash utility and you are ready to go.
While I was looking for a new project, I decided to use the ESP8266 for something I ever wanted – a simple temperature logging device at my balcony. I started to read a lot of tutorials and choose an old friend as a temperature sensor – the DS18B20. These are available in a waterproof housing and with up to 3m cable, which is perfect for measuring temperature not in the near of the powersupply.

DS18B20 basic working example

As the DS18B20 arrived, I started to test it with my Arduino Nano, to check if the basics are working, before I start over with the ESP8266.
First of all, I put a 4,7KOHM resistor between signal and vcc and connected it to pin 6. Everything works fine with this piece of code:

There are a lot of tutorials out there, so I don’t focus on this one.

Starting with the ESP8266

Because the DS18B20 is working really well, I started the development with the ESP8266. The onewire library used for the sensor is the same I used on my Arduino Nano – This worked instantly. What I wanted to do is, use the ESP8266 to read the temperature, connecto to the Wifi and send it to my server and then disconnect! All we need is the temperature, a connection to the wifi and a http client calling an url and printing stuff for debugging reason by serial interface (USB Cable). Another great benefit is the deep sleep mode of this modul (found it luckily while reading some information about the ESP8266). That means, this device can read the temperature, go to deep sleep, reset itself and run everything from the beginning, which is really nice and power saving!

Because I want to use it outside, I stripped the pins from the devboard to make it as flat as possible, and put it into a heat shrink to make it a bit more robust against humidity and temperature.

Here is the code for the ESP8266:

This is pretty little code for this functionality.
All you need to do is writing your own php script, to store the data in the database and put them on a website. Beside this, you can upload the temperature to one of these iot services, that fetch all your data and show them to you on a website. Just search for online data logging, and you can choose the best matching!

Some information on wiring everything up.

For deepsleep, just connect D0 with the reset pin.
For DS18B20 use D1 pin (and 3.3v + GND)

Benefits on using the dev board:
Updating is simply done by USB (disconnect the deepsleep connection, or you won’t be able to update it).
Power it with 5V

That it, pretty simple. Here are some pictures of this project

ESP8266 stripped pins


ESP8266 stripped pins
ESP8266 stripped pins
ESP8266 stripped pins closeup
ESP8266 stripped pins closeup
ESP8266 with DS18B20 with heat shrink
ESP8266 with DS18B20 with heat shrink (the red wire is the D0 -> rst connection, so i can cut and reflash it, without opening it)
ESP8266 with DS18B20 on breadboard
ESP8266 with DS18B20 on breadboard
Published inAllgemeinAVR - MiscCodingElektronik


  1. Ferdy Ferdy

    Hallo Marco,

    hast du schon mal versucht ein 433MHz Empfänger-Modul mit einem ESP8266 zu betreiben? Ich bekomme einfach keine Signale rein. Evtl. hast du ja eine Idee.

  2. Hi Ferdy,

    nein, mit 433er Modulen habe ich noch nie was gemacht, das war mir immer zu frickelig und die Diskussionen über die beste Antenne und wie man die Übertragung sauber ans Rennen bekommt haben mich eher abgeschreckt.
    Viele Grüße

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

I accept that my given data and my IP address is sent to a server in the USA only for the purpose of spam prevention through the Akismet program.More information on Akismet and GDPR.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.