![]() |
![]() |
#321 |
Supreme EcoRenovator
|
![]() I posted info in this thread.
My original intentions were for 3 sketches that could be loaded, for 3 modes of operation: 1: wall thermostat 2: slave outdoor unit device w/ defrost 3: Both #1 and #2 This is in post #140 of the thread. While I was coding and prototyping, BBP and a few others got involved and began developing their own solutions. I think the rig BBP came up with had a Uno board everywhere there was equipment. Maybe 4 or 5. Somebody else started developing comms, and RS485 was suggested, which added a translator shield. Somebody else did flow sensing with the paddle-wheel counters. I could literally imagine BBP running back and forth between modules with a laptop, applying changes until all the bugs were driven from his rig. I got the mode 1 board working and asked for help. No one came. So here it is: Post 275: some trial pics Github code Post 298: No visitors to Github, so I posted my code inline. The thing works off a generic (16Hertz) Uno board, the Dfrobot LCD keypad shield ( post #108), and a 1wire sensor DS18B20. I wired mine to a recycled power board for a portable dehumidifier for the TTL buffer and "sugar cube" relay control. Anybody could rig it through a relay shield like AC originally posted pics of. I grabbed all the libraries from hacktronics after running into bugs with other source libraries. Last edited by jeff5may; 12-11-15 at 09:10 PM.. |
![]() |
![]() |
![]() |
#322 | |
Supreme EcoRenovator
|
![]() Quote:
Looking at the relative simplicity of yours vs mine, I thought I'd help you in the right direction. Here's a barebone rewrite of your code that should do what you say you want. I didn't put any serial messages into the loop, nor light flashes, to simplify the heart of the control functionality. It is very basic on purpose: let me know if it works. Code:
/* * General Purpose Controller for a water-to-water heat pump, basic version) * Provides for: * 2 minute startup dalay for compressor protection * Temperature monitoring of: * Evaporator HX temp * Storage Tank Temp * Controlling line voltage power to appropriate components: * Outside loop pump * Inside loop pump * Compressor * NOTE: Indoor operation is assumed, no compressor crankcase heater. * * PIN ASSIGNMENTS: * Digital Pins: * D0 (reserved for USB & serial communication RX) * D1 (reserved for USB & serial communication TX) * D2 (* reserved for input loop flow data *) * D3 (* reserved for output loop flow data *) * D4 user input request for heat * D5 output to Compressor SSR * D6 output to Inside Loop Pump SSR * D7 output to Outside Loop Pump SSR * D8 output to Auxillary Output SSR * D9 (* not used *) * D10 (* not used *) * D11 (* not used *) * D12 (* not used *) * D13 LED (onboard) * Analog Pins: * A0 input Temperature of Evaporator HX * A1 input Temperature of Condenser Tank * A2 (* not used *) * A3 (* not used *) * A4 (* not used *) * A5 (* not used *) * */ #define One_Sec 1000 #define Quarter_Min 15000 #define Half_Min 30000 #define One_Min 60000 #define Two_Min 120000 #define Startup_delay Quarter_Min float temp_in_celsius_0 = 0, temp_in_celsius_1 = 1, temp_in_kelvin_0 = 0, temp_in_kelvin_1 = 0, temp_in_fahrenheit_0 = 0, temp_in_fahrenheit_1 = 0; // Associating Variable Names with pins int HeatDemand = 4; int Compressor = 5; int inPump = 6; int outPump = 7; int auxOut = 8; int LED = 13; void setup() { // Setting the mode of the digital pins pinMode(HeatDemand, INPUT); pinMode(Compressor, OUTPUT); pinMode(inPump, OUTPUT); pinMode(outPump, OUTPUT); pinMode(auxOut, OUTPUT); pinMode(LED, OUTPUT); // Initialize print Serial.begin(115200); // // ****************** Startup Delay to Protect Compressor ******************** Serial.print("begin startup delay"); delay(15000); Serial.println(", end startup delay"); // ***************************** End Startup Delay *************************** Serial.print("Activating Compressor"); digitalWrite(Compressor, HIGH); delay(5000); Serial.println(", Deactivating Compressor"); digitalWrite(Compressor, LOW); delay(500); Serial.print("Activating inPump"); digitalWrite(inPump, HIGH); delay(5000); Serial.println(", Deactivating inPump"); digitalWrite(inPump, LOW); delay(500); Serial.print("Activating outPump"); digitalWrite(outPump, HIGH); delay(5000); Serial.println(", Deactivating outPump"); digitalWrite(outPump, LOW); delay(500); Serial.print("Activating Auxillary Output"); digitalWrite(auxOut, HIGH); delay(5000); Serial.println(", Deactivating Auxillary Output"); digitalWrite(auxOut, LOW); delay(500); // Serial.println("starting loop"); // { //Reads the input and converts it to Kelvin degrees temp_in_kelvin_0 = analogRead(0) * 0.004882812 * 100; //Reads the input and converts it to Kelvin degrees temp_in_kelvin_1 = analogRead(1) * 0.004882812 * 100; /* Converts Kelvin to Celsius minus 2.5 degrees error temp_in_celsius_0 = temp_in_kelvin_0 - 2.5 - 273.15; Converts Kelvin to Celsius minus 2.5 degrees error temp_in_celsius_1 = temp_in_kelvin_1 - 2.5 - 273.15; */ //Converts Kelvin to Celsius minus 2.5 degrees error temp_in_fahrenheit_0 = ((temp_in_kelvin_0 - 2.5) * 9 / 5) - 459.67; //Converts Kelvin to Celsius minus 2.5 degrees error temp_in_fahrenheit_1 = ((temp_in_kelvin_1 - 2.5) * 9 / 5) - 459.67; /* //Print the temperature in Celsius to the serial port Serial.print("Celsius_0: "); Serial.print(temp_in_celsius_0); //Print the temperature in Celsius to the serial port Serial.print("Celsius_1: "); Serial.println(temp_in_celsius_1); */ //Print the temperature in Fahrenheit to the serial port Serial.print("Temp_0: "); Serial.print(temp_in_fahrenheit_0);Serial.print(" deg.F"); Serial.print(", Temp_1: "); Serial.print(temp_in_fahrenheit_1);Serial.print(" deg.F"); Serial.println(); } /* void loop() { temp_in_kelvin_0 = analogRead(0) * 0.004882812 * 100; temp_in_kelvin_1 = analogRead(1) * 0.004882812 * 100; temp_in_celsius_0 = temp_in_kelvin_0 - 2.5 - 273.15; temp_in_celsius_1 = temp_in_kelvin_1 - 2.5 - 273.15; temp_in_fahrenheit_0 = ((temp_in_kelvin_0 - 2.5) * 9 / 5) - 459.67; temp_in_fahrenheit_1 = ((temp_in_kelvin_1 - 2.5) * 9 / 5) - 459.67; if (HeatDemand) {outPump = true; ` if (temp_in_fahrenheit_0 > 34) { digitalWrite(Compressor, HIGH); if (temp_in_fahrenheit_1 > 90) digitalWrite(inPump, HIGH); else { digitalWrite(inPump, LOW); delay (Half_Min); } else { digitalWrite(Compressor, LOW); delay ( Half_Min); } } else {compressor = false; while(temp_in_fahrenheit_1 > 90) delay (One_Sec); digitalWrite(inPump, LOW); while (temp_in_fahrenheit_0 <34) delay(One_Sec); digitalWrite(outPump, LOW); } } delay(Two_Min); } Last edited by jeff5may; 12-27-15 at 04:38 PM.. Reason: direct digital write vs assigning variables |
|
![]() |
![]() |
The Following User Says Thank You to jeff5may For This Useful Post: | AC_Hacker (12-31-15) |
![]() |
#323 | |
Master EcoRenovator
Join Date: Aug 2012
Location: Toronto
Posts: 958
Thanks: 40
Thanked 158 Times in 150 Posts
|
![]() I would try to help but I blow up arduinos on a regular basis and although I do understand the steps needed, I have no concept of programming. Just saying.....guess I'm a torch monkey, haha
Quote:
|
|
![]() |
![]() |
![]() |
#324 | |
Supreme EcoRenovator
Join Date: Mar 2009
Location: Portland, OR
Posts: 4,004
Thanks: 303
Thanked 724 Times in 534 Posts
|
![]() Quote:
Since you have no LED outputs, are you figuring on the light bulbs to indicate if things are functioning? Can you give me a brief description of what you expect your code to do? Best, -AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker... |
|
![]() |
![]() |
![]() |
#325 |
Supreme EcoRenovator
|
![]() I don't have anything. This one is yours. Since I don't have yours, it might not even compile. If it works, try it out with sensors or potentiometers.
|
![]() |
![]() |
![]() |
#326 | |
Supreme EcoRenovator
Join Date: Mar 2009
Location: Portland, OR
Posts: 4,004
Thanks: 303
Thanked 724 Times in 534 Posts
|
![]() Quote:
May take a day or two, what with all the general festivities... Happy New Year Old Buddy! -AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker... |
|
![]() |
![]() |
![]() |
#327 |
Supreme EcoRenovator
|
![]() here is the flowchart I used to write the code.
I believe I may have put the check temperature step in so when there is no demand, temp doesn't get checked. it should be fairly easy to check out operating states of the control by feeding a heating demand signal in and watching the light bulbs. if you rig up some fake sensor inputs, the various trigger conditions could be checked. a serial print line could be inserted immediately following the temperature check to keep an eye on the sensor values and to tweak delay times. If the thing doesn't have enough serial logging or flashy lights for you, that frill can be inserted after the light bulbs do what they are supposed to. Good luck and happy new year. |
![]() |
![]() |
![]() |
#328 |
Supreme EcoRenovator
Join Date: Mar 2009
Location: Portland, OR
Posts: 4,004
Thanks: 303
Thanked 724 Times in 534 Posts
|
![]() Perfect!
Probably, tomorrow I'll d the deed. -AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker... |
![]() |
![]() |
![]() |
#329 | |
Apprentice EcoRenovator
Join Date: May 2011
Location: Tortosa, Spain
Posts: 221
Thanks: 2
Thanked 81 Times in 46 Posts
|
![]() Quote:
The RTOS I'm using is NilRTOS and I've had my test rig on the bench for a few weeks now and it's performing well so soon it'll get 'fitted' into a real machine for field trials. I'll post code on the other thread so as not to contaminate this one. I did choose an Arduino Mega for the controller as I quickly ran out of space on the UNO. Acuario |
|
![]() |
![]() |
The Following User Says Thank You to Acuario For This Useful Post: | AC_Hacker (01-03-16) |
![]() |
#330 |
Supreme EcoRenovator
Join Date: Mar 2009
Location: Portland, OR
Posts: 4,004
Thanks: 303
Thanked 724 Times in 534 Posts
|
![]() OK Jeff, I'm snowed in. No better time to muck about with Arduino stuff.
I've had to re-boot my Arduino-brain. Seems a memory leak has caused all my knowledge to run out. It's beginning to come back. Glad of the documentation I left in the code, I'd be a blob of jelly on the floor otherwise. -AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker... |
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|