I want to make a wifi-enabled temperature sensor and place it inside my HVAC system to measure and push the temperature to a central server, every minute or so.

I have a LoLin NodeMcu v3 unit laying around, and I am wondering if it is possible to use this one - and have it last for many years inside the HVAC system?

I realize the LoLin unit has a onboard wifi chip, I also realize LoLin takes 3v input. Aside from that, I am pretty blank.

Yesterday I tested the LoLin board by programming it with the following code, which lists networks in the vicinity. It worked great:

#include "ESP8266WiFi.h"

void setup() {
  // Set WiFi to station mode and disconnect from an AP if it was previously connected
  Serial.println("Setup done");

void loop() {
  Serial.println("scan start");

  int n = WiFi.scanNetworks();// WiFi.scanNetworks will return the number of networks found
  Serial.println("scan done");
  if (n == 0)
    Serial.println("no networks found");
    Serial.println(" networks found");
    for (int i = 0; i < n; ++i)
      // Print SSID and RSSI for each network found
      Serial.print(i + 1);
      Serial.print(": ");
      Serial.print(" (");
      Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*");

  // Wait a bit before scanning again

The actual question

Is the LoLin board a feasible board for making a low power wifi enabled temperature sensor? Or should I rather make board that communicates with a wall-connected parent unit via radio?

  • 1
    What part of that is your actual question? – Majenko Oct 28 '16 at 10:55
  • Execllent question @majenko. Thanks for pointing that out ;-) – nitech Oct 28 '16 at 10:59
  • How are you thinking of powering it? – Majenko Oct 28 '16 at 10:59
  • I was thinking a battery. Any battery. – nitech Oct 28 '16 at 11:01

Yes, the NodeMCU can connect to a temperature sensor and forward that on to your WiFi access point to send to the internet.

Yes, the NideMCU can run from batteries.

Can it do it off one battery for many years? Only if that battery contains a small nuclear reactor.

Running something from battery for many years requires incredibly close attention to detail and incredibly tight component specifications, even down to the precise battery chemistry used. It's a very very difficult task for which people are very highly paid.

When you start looking at periods like that you begin to run up against the problem of battery self-discharge. Getting your power consumption down to an absolute minimum is a must, but even then if you have near zero power consumption the battery is still going to go flat by itself. So you have to invest time and effort into selecting a battery technology with a very low self-discharge.

All that is pretty moot though with the NodeMCU since:

  • WiFi is a power hungry technology. You can expect hundreds of mA while transmitting, and doing that once a minute for, say, 10 seconds (reconnecting to the WiFi takes time) will give you quite a high average power consumption just from the WiFi
  • The NodeMCU is far from optimised WRT power consumption. Linear voltage regulators, poor choice of components for low power consumption, etc, abound.

So yes you can run it from batteries, but be prepared to replace the batteries very often. By "very often" I mean every couple of days.

That means you basically have two options:

  1. Don't use the NodeMCU but instead use something designed to be incredibly low power and run for long periods on battery (typically it won't use WiFi but something more efficient like nRF24L01+)
  2. Don't use batteries. Hard-wire your NodeMCU into a mains-connected power supply.
| improve this answer | |
  • 1
    Great answer @majenko. Thanks for taking the time to educate newbies like me :-) – nitech Oct 28 '16 at 11:13
  • 1
    You're welcome. Incidentally, my current wireless keyboard uses the nRF24L01+ (actually a Nordic MCU with built-in nRF24L01+) and runs from two AAA batteries. I have had it a number of years now, and it is still on the same batteries it came with. So it is possible if done the right way, but it takes expertise to do it. – Majenko Oct 28 '16 at 11:15
  • Interesting. I had a chat with representatives from Nordic Semiconductors at NDC Oslo a few years ago, and I had the impression they could sell me IoT-devices with years of battery capacity (off a coin battery). They were probably Bluetooth 4 (?) devices. – nitech Oct 28 '16 at 11:19
  • 1
    Most likely nRF24L01+ based devices using a gateway to the internet. There's a new technology these days specially for IoT - LoRa - which is low power and long range designed to work with municipal-grade carrier gateways. There's a big one in Munich. – Majenko Oct 28 '16 at 11:24

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