Advice on room Thermostat configuration

Hi @wolph42, good choice of starting point with the Wemos D1 Mini. The dual (or even triple) bases are very handy, as is the relay shield. The multi bases have holes in them, so it makes mounting everything easier too.

My favorite environmental sensor is the BME280. This measures temperature, humidity and atmospheric pressure. Not to be confused with the BMP280 which is almost identical doesn’t measure humidity. These are digital sensors, so wouldn’t be connected to the analogue input of the Wemos.

I really like the Nextion touch screen displays. These are full colour and you can design your own graphics (I use PowerPoint) and have a very user friendly device without too much effort. There’s a bit of a learning curve with these displays, but there’s plenty of resources out there to allow you to get to grips with them easily. The Nextion uses serial communications to talk to the Wemos, so you can use hardware serial (which means you lose debug messages via the normal USB connector on the board) or software serial.

This is the approach I’ve taken with my heating/cooling controller that controls aircon, ceiling fans and wall mounted electric heaters and I think it works very well. The Nextion is intuitive to use for anyone who’s ever used a smart phone, especially if you design the user interface well. Here’s a couple of (not very good) pictures of my setup:

The Nextion uses a 5v supply, so I power the whole thing using a 240v to 5v supply.
Because the Wemos generates some heat (along with the PSU if its in the same case), you need to locate the temperature sensor remotely, otherwise you won’t get satisfactory readings. My BME280 is actually located away from the wall mounted controller and connected to its own Wemos board. It sends data to the Blynk cloud server, which is then picked-up be the main controller that has the Nextion connected to it. There are also other sensors on the roof to give outside readings as well.

Obviously this is a bit of an overkill for a straight forward thermostat, but mine started simple and seemed to mushroom into a being that developed into a life of its own! I now have Amazon Alexa integration and the next stage will be to display weather station data on another page of the Nextion display.

Once you’ve decided on your hardware, you need to give some thought to the logic behind the code you use to sample the temperature and control the relay. You need to avoid the relay switching on and off quickly when you’re at or close to your target temperature. You need some latitude so that your heater doesn’t turn on until the temperature has dropped slightly below target (say 0.2 degrees C) and the heater then stays on until the temperature has risen slightly above target. This actually mimics the way that mechanical thermostats work, as they have quite a bit of ‘inertia’.

Hope this helps, or at least doesn’t make your hardware choices too much more complicated!

PS - Before you ask, the outdoor wasn’t really 28.5 degrees when I took the photos, that was a bit of dummy data.

Pete.