01-16-17, 10:20 AM | #1 |
Apprentice EcoRenovator
Join Date: May 2011
Location: Tortosa, Spain
Posts: 221
Thanks: 2
Thanked 81 Times in 46 Posts
|
IOT heatpump controller
Sadly my old Roca heat pump compressor died.
Fortunately my local scrap man turned up for a pickup and had a mid-size Daiichi external unit in the back of his van. I persuaded him to part with it on the off chance it worked, and as luck would have it it did, and it appeared to have been gassed down so still contained a charge, result! So it was time for a new controller I have come to several conclusions having built various controllers both for solar hot water and for heat pumps over the last few years:
So, not too long ago a wizzy little chip appeared on the market and took the world by storm - the ESP8266. This chip comes in various module flavours with different flash memory sizes and pin outs. For experimenting you can't go far wrong with the NodeMCU board as it comes with everything on the pcb, just plug it in to a USB port and you're ready to go. It even has an on board interpreter, LUA, however I'm not a fan so don't use that. The great thing about the esp is that it has all the Arduino code available so you can use it as if it were an Arduino, even using the Arduino IDE (although I personally use Visual Studio with the Visual Micro add-on). Most Arduino libraries work out of the box, others have been ported to the esp so it really is a dream. It has built in WiFi, loads of memory, Works well as a web server and can be upgraded over the air (ota), which means you can send your updated code to it from anywhere, no need to plug in cables or even physically touch the device. So, this was my choice for the new controller. I recently designed a pcb for a generator auto start system that can take either an Arduino NANO or an ESP12 so I used one of them for the main controller. The esp is mostly hidden as it needs 3.3V so I use a DC/DC converter from 5V which sits above the esp. The control board is sparsely populated, in reality there are only 6 resistors and a few connectors used. The esp only has one adc pin, this I use with a 10K thermistor for reading the actual temperature the water has reached . These you can buy for very little money with a waterproof case and connector lead from ebay. As I have moved to thermistors for Reading temperatures I obviously need more analogue inputs. For the extra inputs I'm using a PCF8591 I2C module (from ebay) with 4 x sensors. Also for controlling the relays another I2C device, a PCF8574A expander, (ebay again). I wanted the control box inside and the relays/sensors out so running a 4 core cable and using I2C to talk to the peripherals works perfectly. So, the esp is happy to serve up web pages so rather than as I have done in the past, add a display and keypad, as we are going IOT it should all be done via web pages, two to be precise, one to show status information and the other to perform setup operations, much prettier than an LCD display and much easier to use! This is the status page showing current operating parameters: And this is the setup page: Being connected into my local network I can open up the port the controller is using, set up port forwarding on my internal router and can then access my controller from anywhere I can connect to the internet. And yes, it does have login security! Acuario Last edited by Acuario; 01-19-17 at 01:30 PM.. Reason: Better images |
01-19-17, 12:30 PM | #2 |
Supreme EcoRenovator
Join Date: Mar 2009
Location: Portland, OR
Posts: 4,004
Thanks: 303
Thanked 724 Times in 534 Posts
|
Acuario Rules!!
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker... |
01-19-17, 12:33 PM | #3 |
Supreme EcoRenovator
Join Date: Mar 2009
Location: Portland, OR
Posts: 4,004
Thanks: 303
Thanked 724 Times in 534 Posts
|
One more thing...
Were you ever able to achieve success in controlling a variable-frequency mini-split?? -AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker... |
01-19-17, 01:10 PM | #4 |
Apprentice EcoRenovator
Join Date: May 2011
Location: Tortosa, Spain
Posts: 221
Thanks: 2
Thanked 81 Times in 46 Posts
|
That's a Project I have pending and made much easier now I've mastered the esp and real time os. The machine is still in my shed connected up and waiting.
The problem to date (apart from time...) has been finding a device powerful enough and flexible enough to use for the project, this I think is now solved with the esp. I didn't really fancy trying it with a pi or c.h.i.p. although if the esp gives me problems I may try one of them. By the way, aside from the heat pump controller I have "IOT'd" the controllers for both the solar hot water and solar central heating. With the hot water controller I added statistics for interest and have been surprised that even now in early January I've had just over 25 hours of running time in the last week. |
01-20-17, 09:02 PM | #5 |
Lurking Renovator
Join Date: Oct 2012
Location: Indy
Posts: 12
Thanks: 0
Thanked 2 Times in 2 Posts
|
Can you describe a little more how you would control a pump? I looked up the expansion module. Do you just use that to control a relay that sends power to the pump?
|
01-21-17, 12:25 AM | #6 |
Apprentice EcoRenovator
Join Date: May 2011
Location: Tortosa, Spain
Posts: 221
Thanks: 2
Thanked 81 Times in 46 Posts
|
The expansion module just gives me more outputs without the need to either use up GPIO ports on the esp or run extra cables. As it works on the I2C bus it uses the same 4 control wires as the ADC converter.
The outputs from the expander run 3 relays, 2 are on one of the little 2 relay boards that have all the driver circuit built onto the board. These run the fan and 3 way valve. The other is a solid state relay (SSR) for the compressor. This is an old unit that has a capillary tube so there is no need to control an eev. |
01-24-17, 11:03 AM | #7 |
Apprentice EcoRenovator
Join Date: Feb 2010
Location: Maryland
Posts: 120
Thanks: 26
Thanked 12 Times in 8 Posts
|
Wow!
Well, i had been sitting here looking at this $6 ESP8266 i ordered and wondered if i would live long enough to be able to learn to get it to report temps over wifi to the web and controll my geo h/w heater build - and you've already finished it - great work guy!
There is also a esp based bpard for about $10 that has expansions with relays to report temp and humidity logging and control of pumps etc thru the relays but they are i think relays that need to be constantly powered on ie not tripped. Google "Sonoff" they are all over the web. I wonder how this stacks up against Xringers X10RF web control?? If you get a chance, when you finish, a detailed (read handholding) description of how you hooked it up and programmed it would be a huge boost to those of us who didn't grow up with this stuff! Thanks! |
01-25-17, 06:08 AM | #8 |
Apprentice EcoRenovator
Join Date: May 2011
Location: Tortosa, Spain
Posts: 221
Thanks: 2
Thanked 81 Times in 46 Posts
|
I've seen the sonoff devices, good devices and can be re-programmed so could be used as a pre-built controller with a few additions.
The sonoff SC is the unit that has the humidity/temperature sensors but they have opted to use the atmega328P (read Arduino) for adc to overcome the esp limitation. There's a detailed look with modifications here: Sonoff SC with MQTT and Domoticz support - Tinkerman Also a guy called Peter Scargill has done lots with them IOT Technology Blog I'll post more details in a subsequent post. Acuario |
01-25-17, 10:30 AM | #9 |
Apprentice EcoRenovator
Join Date: May 2011
Location: Tortosa, Spain
Posts: 221
Thanks: 2
Thanked 81 Times in 46 Posts
|
Putting it all together - how it works
If you haven't read my posting on the dew point monitor it would be advisable before reading this as it may make more sense...
Part 1 - the hardware The schematics for all 3 parts of the project are incredibly simple. There are 3 parts, 2 for the controller and the separate dew point monitor. 1. Main controller This comprises of little more than a (not shown) 5VDC power supply, 5V to 3V3 power supply (not shown either), an ESP-12 and the resistors needed to make it work and a 10K thermistor connected to the adc input. The I2C bus (2 wires + 5V power) is fed out to the peripherals that are located inside the external unit. The RS232 connection is really only used to program the controller the first time (or if something really screws up!) as any code updates can be done remotely ota (over the air). 2. Peripherals The peripherals comprise 3 x pre-built modules, one to read the temperatures using thermistors and the other a port expander to switch the relays (2 on a pre-built board) on and off. The main relay for the compressor is a 40A solid state relay. 3. Dew point, temperature and humidity monitor Again ridiculously simple, an ESP-01 connected to a DHT-22 humidity/temperature sensor, a status LED and a button for WPS. Not shown is the 5VDC power supply. Part 2 - the software The whole system runs on the Arduino ESP8266 software API and is written in C for the main code and HTML for the web pages. All the libraries used in the project are open source. The libraries are:
The project also uses the ESP SPI file system (SPIFFS) for storing web pages and stuff required by the web pages. The code is broken down into modules with discreet functions:
A web server is also running in the background to handle any user input. Updates are sent to the web browser using a protocol called server-sent events. This protocol is handled on Chrome (and others) but not Internet Explorer or Microsoft Edge. The alternative would have been to use AJAX but that would have needed to be initiated from the browser so immediate updates wouldn't have happened. Another possibility that I tried out was web sockets but I kept getting timeouts so ended up abandoning them. Acuario |
01-18-21, 04:45 PM | #10 |
Supreme EcoRenovator
|
Ok so I decided to post in this thread as not to pollute the other, newer version thread.
I've recently been tinkering with more phase change monsters and have decided to have another go at the custom built interface. Nobody seemed to like the Arduino uno or nano modules, due to the limited functionality. Since these esp boards are super affordable, they look acceptable to me. The two main choices for the project look to be the esp8266 and the esp32 modules. I like the esp32 better, due to the more robust gpio and onboard flash memory. Double the price, but we're talking about 10 versus 20 dollars here. I believe the extra gimmicks are sufficient to satisfy the desires of a lot more tinkerers. I could get by with the 8266 and a few extra expansions, but with the 32, it would only need "muscle" controls, with many options available for sensing and communication built-in. The 3.3 volt logic levels are no big deal, since there are so many compatible expansion modules available. So here's the part where I respectfully beg for information. I'll take whatever you have to share. Since what you're using obviously works, I'd love to pilfer through source code and see how it ticks. I promise I won't break it and post up a bunch of stuff that doesn't work well. With the uno, the code had to be small and simple to conserve resources. Not a lot of people could follow the kiss method or understand some things I did to keep it small. Communication with the outside world was a point of contention as well. Flashy lights vs 7 segment vs what have you, everyone had different desires. With WiFi and i2c interfaces onboard, as well as a gaggle of spare output pins available, someone could plausibly go their own way and not have to redo the core functionality. |
The Following User Says Thank You to jeff5may For This Useful Post: | Fordguy64 (01-18-21) |
|
|