I want to deploy few temperature sensors in my flat: few rooms, two balconies, one outside. Sensors should send data into my server (thinking about Rpi with Prometheus DB and Grafana dashboard). Battery powered. Should run at least for 6 months on batteries (10/5 mins interval between measurements is enough. Must be compatible with IoT platforms as I'm not sure yet which I'm going to use and want to be flexible.

I've started to look for such products but prices seems very high. Paying 30-50 USD/EUR for a single sensor sounds ridiculous. Another way - assemble sensors by myself on ESP-01 or similar modules + DHT11/DHT22. This also will enable me to experiment, e.g. use any protocol I want for data transfer. I see only benefits here :-)

Can you please help me understand if I'm missing something when comparing home-made sensors vs. produced by companies? Why should I pick produced product over DIY on ESP8266? I totally understand Plug&Play is a benefit for users who has no knowledge how launch and maintain server or build IoT thing. But is that the only reason or I'm missing something? Thanks.

  • I would do it myself, just for the fun of it ;-) Of course, I would use ESP32 for the network access, rather than ESP286 – Mawg says reinstate Monica May 7 '20 at 15:38

You can of course experiment with it for your own use, but here are some of the pitfalls you may encounter:

  • Sleep modes. There’s often a world of difference between what the specs say and what you can achieve. Many cheap modules have regulators which draw more current than you would like. Whatever development environnement you use may add a lot of overhead. Wireless connections are power hungry. Sensors may take time to come to a steady state...

  • Accuracy. Temperature sensors often need careful calibration. And a bad design may mean your MCU or other components will be affect the readings.

  • Cases. This may sound stupid, but it’s actually often difficult to find cases that are both cheap and adapted to your needs.

Also, once you factor in the board, the sensor, the battery, the case, and especially all the time you’ll spend, it probably won’t be cheaper than an off the shelf solution.

But if what you want is to learn and have fun, definitely go ahead!


The choice of the wireless technology (and then the MCU) is difficult. Wi-Fi has the advantage that it is ubiquitous, so adding a device to a Wi-Fi network is easy. It has the drawback that for sleeping devices, you often end up having to re-associate, get an IP over DHCP, establish a connection, send your data, wait for ACKs... Depending on your setup the whole wake-up-connect-read sensor-send-go back to sleep cycle could easily take a few seconds.

Don’t know the exact figures for ESP8266-based boards (and it will depend a lot on whether you use the low-level ESP-IDF or a higher level environment such as micropython), but let’s suppose it draws 50 mA average during the awake cycle, 10 uA during sleep and you have a 5 second awake time every 5 minutes, that translates to:

(295 * 0.010 + 5 * 50) / 300 = 0.84 mA average power draw.

With a 2500 mAh battery that will last for about 4 months.

If you have a bad regulator (or a bad design around that regulator), or if your sensor needs more time to “settle” after wake up, or if your MCU draws more power on average (Wi-Fi is power-hungry), then it gets even worse. And I haven’t factored in the sensor itself at all.

Better choices especially with these short intervals could be BLE or Zigbee. But guess what... there are already cheap BLE or Zigbee temperature sensors... the drawback is that you need something to connect them to. Depending on how many sensors and where they are this may be an issue or something very simple and cheap to solve.

Also, don’t underestimate the issue of accuracy. The internet is lettered with stories of temperature sensors which are affected by the heat output of the MCU they are attached to.

But again, if you want to have fun experimenting with all that, please do, you’ll learn lots of things on the way!

  • Thanks for answer. Case is not a problem as I can design one in couple of hours, 3D print and put the design online (especially as you mentioned it is difficult to find proper ones). Time also does not count if I'll be able build all things and forget at least for couple of years (except changing batteries). If I understand calibration correctly - this can be done pretty easily - just adding offsets for different sensors. Unless different sensors increase by different ratio per degree (not sure if such problems exists).... – Pawka May 1 '20 at 17:05
  • ...(continuing previous comment). Sleep modes are probably the most concerning part from the list you've mentioned. How often it is a problem and where I could get more resources? How long I can run ESP-01 on some battery (on average)? Should I pick another chip instead of one with WiFi module? Thanks. – Pawka May 1 '20 at 17:08

This is the thing that causes most hardware kickstarter projects to fail.

Just because you can build one (or 10) sensors at home for a couple of $s in parts and few hours soldering/coding doesn't mean that this will scale to producing 10s to 100s of thousands of sensors and packaging/shipping them to customers.

Industrial product design, design for manufacturing, setting up production lines, setting up packaging, organising shipping and getting devices certified (e.g. European CE marks) all have both a financial and time (which needs to be paid for) cost that has to be recouped in the cost of the product.

If you want to learn about how these things work then building your own is probably the way to go.

If you want something that just works and don't want to spend the next month of weekends fiddling with it to get consistent temperature/humidity readings and working out how long the batteries will last. Buy off the shelf sensors.

If you were looking to deploy a large fleet (say across a city/office building) then buying off the shelf sensors will be the way forward as you (hopefully) get a consistent (calibrated) devices with a known interface.

And finally, probably the most important bit, what are you actually going to do with this data? Is it just going to end up in some database and never looked at again? Or will it be fed into some per room heating control? If these things are actually going to have an impact on your heating/power bill? In that case how long will off the shelf sensors pay for themselves....

  • 1
    Thanks for answer. I totally understand what is involved into price (also salaries, marketing, logistics, etc.) But my question is more about the personal goal - if I can build such thing, why I should purchase similar produced sensor? What benefits I'll get? Especially it my whole fleet is 5 sensors. – Pawka May 1 '20 at 16:57
  • Sorry, missed a bit out of the last section as I had to run – hardillb May 1 '20 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.