Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By poor_red_neck
#55344 This is going to be a long post. Never good at transcribing thoughts... Here we go.

ESP8266's are Wemos Minis.

my IoT project is "A/C & Heat Zone Control". Basically, what I'm going to do is have ESP8266s in each of my rooms in my home. There will be another ESP8266 in the attic controlling 7 servos attached to the air handler. These servos are to be attached to the butter fly valves that control air flow to each room.

Each ESP8266 in the individual room, is using a Honeywell thermistor connected to the analog input on the ESP8266. There's some math to convert the resistance value to temp K, then convert to F. It then averages this over the course of 10 readings and outputs to a variable "averagetemp". I've tried the DHT11 and there isn't much resolution for what I wanted. So I went with a Honeywell thermistor (black tear drop type) and have been very happy with the accuracy and resolution of this. May try a DHT22 to see if the accuracy is better but right now the thermistor in my experience has been more accurate than the DHT11.

The ESP8266 in the attic will use the servo library to control 7 independent servos to open and close airflow to individual rooms.

Here's my requirement/vision for controlling the "system."

Each room will have 4 main "values"
averageTemp
openTemp
closeTemp
status

In the summer, open temp is the higher temperature at which the servo moves to open the valve and allow more air flow. The valve stays open until the close temp is reached, at which point the valve will close, limiting air flow.

I'd like the openTemp & closeTemp to be dynamic and able to be changed via a web page. This is where I'm struggling. I need a way for each ESP8266 to communicate to the "master" ESP8266 in the attic that controls the servos.

I have a Windows PC at home that has multiple functions. Plex media server, mySQL server, apache web server w/PHP, Samba server. I use this for media distribution inside and outside my home, as well as other home automation things not related to this project.

Avenues I've explored are:

Some form of basic communication: Maybe the easiest way, but would lose the ability to control a room's temperature with a webpage (and thus a mobile "app"). Each room's ESP8266 would have a basic webserver that writes a very simple page that would write the room's current temp. The ESP8266 in the attic would then read that page and look for the particular string (room name?) and then act based on that data. The downside is the openTemp and closeTemp wouldn't be adjustable as it would be hard coded into the ESP8266.

json file: Each room's ESP8266 will write to a specific json file (masterbedroom.json, guest1.json, livingroom.json) that will contain names:vaues for averageTemp,openTemp,closeTemp,status (if the valve is currently opened or closed). The ESP8266 in the attic will read each json file every X minutes and then move the servo if needed.

mySQL database: Have the room's ESP8266s write to a mySQL database. I think I prefer this route, as it would allow logging of the data to see if a particular room is running hotter than the others most of the time, if a particular room is "hunting" back and forth temp wise, etc etc. I really like this solution, but I'm having a hard time with implementation. All the example code out there for arduino and mySQL is using AT commands, not running arduino IDE natively on the ESP8266. I've seen some PHP file examples out there than can take a simple HTTP GET request and use that to write to a mySQL page.

MQTT I've only just started reading about this. Looks cool, but I know nothing about it. Same goes for ThingSpeak's API. I don't like this having to rely on a 3rd party website. If it goes down... I'm screwed. I'd really like for this to work within my home network, with my own hardware, however the features of ThingSpeak or AdaFruit's MQTT does look nice. I just haven't read much into it yet.

Unfortunately I know just enough about all of this to know that it's possible. With enough example code out there, I could get it to work. I'd like some guidance on which route would be the preferred, to achieve the main features I'm looking to have.

I hope this makes sense, and I sincerely appreciate any assistance given.
User avatar
By mrburnette
#55435 Oh, my .... I really hate to be the first one to respond to such a complex project. At least you have thought it through conceptually.

IMO:
There is no positive requirement for posting to an external website except for grinding the data... nice plots, etc. If you have and ISP Internet connection at home, your own hardware can perform the same feats as the 3rd party websites. Just configure a PC behind the router with a non-DNS address and then open the appropriate port to the router firewall. You can google this for all the details.

The PC can run Linux or Windows or OSX ... find a similar project on the Internet and move into that circle with your gateway to the world. No sense to reinvent the wheel. IF you have a landline phone, you can even use the modem for emergency dial-up control.

Investigate the Android make program by MIT: App Inventor, I think it is in version 2 at this time. If you have an iPhone, research what may be available.

I built an ESP8266 wireless thermometer, maybe be some useful code. The very cheap 10K Vishay thermistor works great when compared to my NIST traceable digital thermometer ... exactly the same readings (one would expect this since the ESP8266 is software and can be calibrated!)

I am not fond of your idea of using ESP8266's in every room. Seems like an overkill... 500 pound gorilla in every room. A $1 Arduino and RFM12B can do the same thing and do it on a far reduced power consumption budget ... the ESP8266 will never match the RFM12B (or 69) ... take a look at this website to get an idea of how the RF technology can be implemented far easier than the multiple ESP8266 clients (just my opinion):
https://lowpowerlab.com/

When you design the actuator (servo) for the air dampers, you may wish to consider microswitches (or Hall sensors) to provide the uC with the knowledge that the damper is in the correct position! Residential power systems are just not stable enough to rely upon them for 100% uptime and power dips and surges can cause the Arduino to essentially go bonkers. You must take this into account with a proper (and safe) power-up routine.

Fun project, I think. Good luck,

Ray
User avatar
By dwindey1
#55533 I have a similar project in our house. I have a few ESP8266's minitoring and switching different systems (Electricity, Gas and water monitoring, Temperature monitoring (6 devices) and 3 smart sockets). The simpelest way to run all af them together is using a Raspberry Pi + wifi as a server.
The ESP's send and receave messages with the Pi. On the Pi an Apache server, PHP and MySql are installed and do all the work.
Relativaly simple and only using about 7W of power.
User avatar
By KevinA
#55600 I hope you can interface with your HVAC system: A HVAC system is designed around the CFM of airflow, restrict the airflow during the summer the condenser ices up, restrict the airflow during the winter the heat chamber over heats shutting down the system. If you close off three rooms out of eight wouldn't the excess air flow just vent into the rooms that wren't closed off? Maybe, depends on duct size, most the time the system is designed to carry so many CFM per duct, the total shouldn't exceed the HVAC device. This is why the HVAC people have to stamp your building plans, they are the 'only' people the building department feels can calculate CFM flow.

You have to control the CFM by controlling the blower motor. You also need to measure the CFM in each duct. Your idea of using servos will work for a while, in the long run a NEMA 17 stepper motor with a limit switch so in the event of power failure they are reset their position and the NEMA 17 will have the power to keep going after the unit ages.

You will have to control the A/C compressor and the fuel to regulate the HVAC and prevent freezing and overheating also.

Ran across http://tech.scargill.net/nextion-update/#comment-25298 good stuff.

I checked American Standard, they have nothing like this, they have a two stage system that runs at 70% or 100%.
With your ESP8266 devices use UDP to a server with an SD drive for logging, lot less code and more reliable. I found some A/C to DC blocks with 400ma that would work as a power source and they are only $1.83