Mains-powered WiFi temperature sensor


WiFi Temperature Sensor Assembled

This projects combines the low cost of WiFi modules with the convenience of battery-free operation using mains power. The aim was to get a reliable outdoor temperature reading for integration into a home automation system.

There are three main components:


NodeMCU is a platform for developing WiFi-connected devices. It contains an ESP8266 module (the shiny part in the picture) which is very popular for DIY projects. The advantage of using NodeMCU modules is that they are ready-to-go. They can be connected through USB for power and programming. No other components are needed.

NodeMCU really refers to the firmware which is pre-loaded and allows to program the module using Lua. This is great but an even better alternative is to use the Arduino core instead. This core is available from within the Arduino IDE, meaning that the NodeMCU module can be programmed in the same way as an Arduino.

Power supply

The NodeMCU unit can be powered by 3.3V or 5V, including directly from a USB port. To convert to this from mains we need a power supply. Since this involves high voltage and requires safety precautions, the easiest way is to use a complete module that does the whole job. A normal USB charger could do this perfectly but since the project will be installed outdoors, a direct connection to mains makes more sense as it is easier to weatherproof.
The power supply module in the picture works great and can be found on Tindie.