EcoRenovator  

Go Back   EcoRenovator > Improvements > Geothermal & Heat Pumps
Advanced Search
 


Blog 60+ Home Energy Saving Tips Recent Posts Search Today's Posts Mark Forums Read


 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 11-16-15, 01:20 AM   #1
Acuario
Apprentice EcoRenovator
 
Join Date: May 2011
Location: Tortosa, Spain
Posts: 221
Thanks: 2
Thanked 81 Times in 46 Posts
Default Home made heat pump controller

I need a heat pump controller for a flat that I have in the nearby city. I have installed under floor heating as it is probably the most comfortable and efficient heating there is (and it can also work for cooling).

There are commercial heat pumps around but I have enough experience with my own home setup to be able to build my own unit.

One of the 'problems' with building your own whatever is the case and display, especially if it is visible to everyone. I did think about a touch screen LCD display or an OLED display and some buttons but anything I was going to make would look home-made and I wanted something a bit better.

Looking on ebay I found lots of fancy looking thermostats with nice displays and buttons but nothing that could run both heating and cooling, also there was no way o communicate with these units as they were self contained.

After some hunting I finally came across a thermostat, a BAC-1000, on AliBaba that has a RS485 interface so I can communicate with it, works for heating and cooling, looks good and is touch control. It also fits into a standard electrical outlet box - perfect!



One down, several to go.

My initial list of hardware requirements for the controller were:
  • Wall mounted thermostat for user control
  • Sensors for compressor and evaporator
  • Sensors for water flow/return
  • Humidity sensor to avoid dew forming in summer when in cooling
  • Real time clock
  • Relays for compressor (solid state), fan (2 speeds), reversing valve, circulating pump
  • Ethernet interface for status
  • RS485 interface for thermostat
  • Small display for local status information
  • Keyboard for programming

And obviously a processor board to run it all :-)

For many years I have been using pic processors to control my projects and have avoided the Arduinos. My reason has mainly been the lack of range of Arduino boards and the poor support for debugging, there's nothing like single stepping through code to see where you messed up.

I decided to take the plunge though and bought myself a UNO, loaded up the Arduino IDE and wrote a few lines of code. All worked well however the IDE is very basic so I went looking for alternatives. I use Visual Studio extensively so I was really happy to find someone had developed an plugin for VS for programming Arduinos - Visual Micro Arduino Plugin (new version, simpler & more powerful). The plugin works well and is being actively supported, it also includes a debugger that can be activated and although it's not single step it can help - I've not yet tried out much of it's functionality.

The great thing about the Arduino is the number of libraries there are available for almost any peripheral you can think of. Most work first time however some need a bit of coaxing into life. Compared to the pic it's luxury.

I started putting together some modules for the controller using the various libraries I found and then ran out of memory space on the UNO, it really is very limited. So I moved up to a Mega 2560. The great thing is all the code works just the same.

Anyone who programs these small boards will know the typical program structure is a single loop that contains all the logic and calls to read the various sensors, write to displays, set relays etc. All good if you have a fairly simple program with few peripherals but this project quickly exceeded this, especially with the Ethernet interface which runs a web server for (initially) displaying status information.

The solution to this problem is a 'Real time operating system' (RTOS). This allows you to have what seems like separate programs all running at the same time on the same processor, just like your pc or mac. Each 'program' runs in its own thread and has its own memory allocated to it. The individual threads can interact with each other or just run autonomously but they can share the same program variables. The RTOS I found and use is called NilRTOS, it is very small and has been ported to the Arduino.

So, for example, a thread running to read temperature sensors can set values for variables 'sensor1, sensor2, sensor3' etc. and a thread that is running completely separately that displays stuff on an lcd can display these values.

Using this approach allows the ever more complex single thread program to be split up into individual mini 'programs' or threads, each one independently running a peripheral and with the main program loop now free to handle the control of the heat pump without worrying about what is going on around it with the lcd, the Ethernet, reading sensors etc. Hopefully this is clear!

The threads I have in my controller are:
  • Temperature sensors (digital ones - ds18b20)
  • Temperature sensors (analogue 10K NTC thermistors)
  • Display (rather than LCD I use a small OLED display)
  • RS485 to communicate with the BAC thermostat
  • Ethernet for the web server
  • Humidity sensor - I use a DHT11 temperature/humidity sensor
  • Defrost algorythm

... to be continued

Acuario


Last edited by Acuario; 11-16-15 at 12:19 PM.. Reason: Forgot defrost thread
Acuario is offline   Reply With Quote
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:53 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Ad Management by RedTyger
Inactive Reminders By Icora Web Design