Solar-Powered Outdoor Thermometer with Multiple DS18B20 Sensors

I’ve been pretty happy with how my ESP8266-powered outdoor thermometers turned out.  One of these has two sensors — one to measure ambient temperature, and one to measure the temperature of a hot tub.  It’s solar-powered (with an 18650 Li-Ion battery), uses a single GPIO pin, and never needs charging!

DS18B20 Temperature Sensor

DS18B20s* are great digital thermometers for DIY projects.  They’re about the same price as the more popular DHT11*, and while they don’t measure humidity, they have a really cool advantage: you can use multiple sensors on the same data pin!  They also support a parasitic power mode, which drops their standby power draw to close to 0.

Diagram showing how to set up DS18B20s in parasite power mode. Image from tweaking4all.


I updated the ESP8266 firmware I’ve been using to support multiple sensors, and added a nice web UI:

This allows me to push readings from multiple sensors connected to the same GPIO pin to different MQTT topics.  You can also push readings to an HTTP server.

The finished setup

In deep sleep mode, this project is suitable for battery life.  My outdoor thermometer uses an 18650 cell with a 5v solar panel and battery protection circuit.  I’ve never needed to charge it.  It’s been running for months.

Tips on power efficiency:

  1. Use an efficient voltage regulator.  Many dev boards use an AMS1117, which has a very high quiescent current.  You’re probably best off with a buck converter*, but an HT7333 or similar would be a lot better too.
  2. Use parasitic power mode!  Just wire Gnd and Vin on the DS18B20 to Gnd, and add a 4.7 KΩ pullup resistor to the data line.
  3. Disable any LEDs that are on for long periods of time.  I just used a pair of pliers to break the power LED.

I use a 3.5mm aux cable soldered to the probe wires to connect the DS18B20 probe to the ESP8266 circuit:

This is nice because it’s easy to add length with an extension cable or split the line with a standard aux splitter:

Here is a sloppy circuit in Fritzing.


  1. GitHub page for firmware
  2. DS18B20 datasheet

Components Used*

  1. 5V battery protection circuit for 18650 cells
  2. 5V 180mA solar panel (mine is actually 160mA, but can’t find the product link anymore)
  3. 18650 Li-Ion Battery (recommend getting Samsung or Panasonic)
  4. ESP8266-07 and Breakout Board (soldering required. Wemos D1 Mini works if you want to avoid soldering).
  5. Waterproof DS18B20 Temperature Sensor
  6. Buck Converter (not necessary if using Wemos D1 Mini)
  7. Optional: 3.5mm extension cable (cut in half, solder one end to ESP8266 board, other to DS18B20)

* Contains Amazon affiliate link

Join the Conversation


Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.

  1. What sort of temperature range does your device have to endure? I am finding that esp32 module on a DOIT seems to fail at -5 C. I don’t know, yet, if it is the esp itself, or some of the supporting hardware that freezes up.

    1. I live in an area with very mild weather year-round. It’s generally between 15C and 25C. On rare extreme days, between 5C and 40C.

      I made one of these for a family member that lives in much colder weather (winters regularly have days that don’t get above -30C), and it did not do well there either. Ended up putting the ESP8266 in the garage (which stays above 5C), and snaking the probe outside.

    1. In my experience, PlatformIO is a strictly superior development environment (and by a vast margin). There are pre-compiled binaries if you don’t want to set it up 🙂

      If you do much Arduino dev at all, pio is definitely worth setting up.

  2. I love it,, Works great on a Nodemcu,, I would love to be able to send to my mqtt in Celsius.

    Could you also ,please explain the Voltage parameter,, mine changes from 2 to 1 ,, and decimals also not constant,, sometimes 4 sometimes 2,(possible connection error?) I would love to get e.g. 25.28 only, thanks,,


    1. Reporting temperatures in Celsius wouldn’t be difficult. Change would be here:

      Voltage is read from the only Analog pin on the ESP8266 — A0:

      you can read more about A0 here:

      you’d have to connect Vin from your power source to A0 in order to read voltage (keep in mind that you’ll need a voltage divider if maxV is > 3.3v).

    1. Hi Martin, I doubt we could find a way to make it work. While it’s not hard for me to assemble stuff like this, it takes me a long time.

  3. Excuse my ignorance but why doesn’t the Wemos D1 need a buck converter ? If your battery gives 3.7v and the ESP takes 3.2v, doesnt it needs to step it down ?
    I got a Wemos D1 mini and i dont want to brick it.

    1. It’s a good question.

      The D1 Mini — and every other dev board I’ve used — has a built-in voltage regulator. As long as you supply the Vin pin, voltage will be regulated down to 3.2v.

      You probably are better off with a buck converter, though. The built-in regulators are basically always linear regulators, which are far less efficient than buck converters.

  4. Hi Chris,

    very interesting. Want to use this setup for my volunteer project in Kenya.

    I am new to this stuff. How can I upload this code using the arduino ide, Wemos D1 mini as my hardware?

    Thanks for your assistance.

    Regards Hubert

    1. Hi Hubert,

      There are pre-compiled binaries available on the releases page:

      You can upload these in any number of ways. I cover some of them in this blog post about a different project:

      If you’re on windows, probably the easiest tool is the NodeMCU flasher:

      If you’re on OS X or Linux, is pretty good.

      Good luck! Sounds like a cool project.


  5. Hi Chris,

    is exactly what I look for since a long time. But I am an absolute beginner with the 8266 stuff.

    Can you publish the code to be copied into the arduino ide?