01-16-2017, 10:35 AM
|
#91 (permalink)
|
Administrator
Join Date: Dec 2007
Location: Germantown, WI
Posts: 11,203
Thanks: 2,501
Thanked 2,587 Times in 1,554 Posts
|
According to what I've seen, the thermostat opens up at 197F. So, I plan to leave the grill block closed until about 206F, and then close it once the temperature drops to about 197ish. I'm sure it'll require some tweaking. This will just be initial programming to get things running and test it out.
|
|
|
The Following User Says Thank You to Daox For This Useful Post:
|
|
Today
|
|
|
Other popular topics in this forum...
|
|
|
01-16-2017, 10:38 AM
|
#92 (permalink)
|
Administrator
Join Date: Dec 2007
Location: Germantown, WI
Posts: 11,203
Thanks: 2,501
Thanked 2,587 Times in 1,554 Posts
|
In fact, I have the initial code written. Its nothing fancy at all, just enough to get things working with a tiny bit of troubleshooting / indication built in.
Code:
/* Grill Block Controller
* Program watches the engine coolant temperature sensor
* voltage output. It opens and closes the grill block
* according to the set temperatures.
*/
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// Pin declaration
int tempPin = 0; // analog pin to read temperature sensor voltage from ECU
int ledPin = 13; // led indicator light to show if grill block is open or closed (on = open)
// Variable declaration
int temp = 0; // variable to store the engine coolant temperature
boolean blockOpen = false; // variable to store grill block position
int closeTemp = 128; // variable to store the temperature at which the block closes
int openTemp = 110; // variable to store the temperature at which the block opens
int closeDeg = 0; // variable to store the degrees the servo will rotate to when grill block is closed
int openDeg = 125; // variable to store the degrees the servo will rotate to when grill block is open
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
myservo.write(closeDeg); // default the grill block to closed position
pinMode(tempPin, INPUT); // set tempPin as an input
pinMode(ledPin, OUTPUT); // set ledPin as an output
digitalWrite(ledPin, LOW); // turn off led indicator
}
void loop() {
temp = analogRead(tempPin); // read the engine coolant temperature
if (temp >= openTemp && blockopen == false) // if engine temp is above open point and grill block is currently closed
{
myservo.write(openDeg); // open grill block to openDeg setting
blockopen = true; // set new block position
analogWrite(ledPin, HIGH); // turn on ledPin to indiate that grill block is open
}
if (temp <= closeTemp && blockopen == true) // if engine temp is below close point and grill block is currently open
{
myservo.write(closeDeg); // close grill block to closeDeg setting
blockopen = false; // set new block position
analogWrite(ledPin, LOW); // turn off ledPin to indicate that grill block is closed
}
}
|
|
|
The Following 2 Users Say Thank You to Daox For This Useful Post:
|
|
01-17-2017, 12:41 AM
|
#93 (permalink)
|
EcoModding Apprentice
Join Date: Jul 2016
Location: The Land Downunder
Posts: 229
CT - '11 Lexus CT200h Luxury
Thanks: 26
Thanked 80 Times in 61 Posts
|
Looks good. I would also put a sleep statement in at the end of the loop so that the loop is only executed once every 5-10 seconds or so. This will slow things down a bit and prevent any oscillations. It will also act as a bit of a noise filter on the temperature signal.
Simon
|
|
|
01-17-2017, 12:56 AM
|
#94 (permalink)
|
MPGuino Supporter
Join Date: Oct 2010
Location: Hungary
Posts: 1,807
iNXS - '10 Opel Zafira 111 Anniversary Suzi - '02 Suzuki Swift GL
Thanks: 829
Thanked 708 Times in 456 Posts
|
Looks like it's going to oscillate between open and closed, between 110 and 128 degrees.
I like sleep. Sleep is good. Currently teaching my version of MPGuino how to sleep.
|
|
|
01-17-2017, 07:11 AM
|
#95 (permalink)
|
EcoModding Apprentice
Join Date: Jan 2011
Location: Australia
Posts: 179
Thanks: 9
Thanked 16 Times in 13 Posts
|
Quote:
Originally Posted by Daox
According to what I've seen, the thermostat opens up at 197F. So, I plan to leave the grill block closed until about 206F, and then close it once the temperature drops to about 197ish. I'm sure it'll require some tweaking. This will just be initial programming to get things running and test it out.
|
I question this!
If it were me, the thermostat being fully open at 197, I'd open it before this - say 190.. if the thermostat opens, the radiator will provide cooling providing the airflow isn't restricted (by the grill block). Close it at 180, so that the thermostat should be reasonably closed. (Play with the numbers so that you are operating in half of the thermostat range - grill block closed as thermostat closes)..
It'll use more energy to leave it closed til the fans are required (206 is too close, you'll miss free cooling from airflow!) - (fans use electricity).
__________________
|
|
|
The Following User Says Thank You to toc For This Useful Post:
|
|
01-17-2017, 08:22 AM
|
#96 (permalink)
|
EcoModding Apprentice
Join Date: Jul 2016
Location: The Land Downunder
Posts: 229
CT - '11 Lexus CT200h Luxury
Thanks: 26
Thanked 80 Times in 61 Posts
|
Quote:
Originally Posted by t vago
Looks like it's going to oscillate between open and closed, between 110 and 128 degrees.
|
Nope. The numbers are opposite to the temp because the sensor is an NTC thermistor. 110 equates to 206 degrees.
Simon
|
|
|
01-17-2017, 09:53 AM
|
#97 (permalink)
|
Administrator
Join Date: Dec 2007
Location: Germantown, WI
Posts: 11,203
Thanks: 2,501
Thanked 2,587 Times in 1,554 Posts
|
Quote:
Originally Posted by toc
I question this!
If it were me, the thermostat being fully open at 197, I'd open it before this - say 190.. if the thermostat opens, the radiator will provide cooling providing the airflow isn't restricted (by the grill block). Close it at 180, so that the thermostat should be reasonably closed. (Play with the numbers so that you are operating in half of the thermostat range - grill block closed as thermostat closes)..
It'll use more energy to leave it closed til the fans are required (206 is too close, you'll miss free cooling from airflow!) - (fans use electricity).
|
I do think it will require tweaking. However, I would ideally (at least for now to start testing) like it to operate as such (I'll leave specific numbers out as tweaking will definitely be required):
Grill block closed at start up.
Engine warms up.
Thermostat starts to opens up, radiator starts to warm up, but still provides some cooling.
Thermostat is fully open, radiator is fully saturated with heat.
Just before coolant fan turns on, open grill block. At this point you have the highest delta T you will see, and your radiator will be used the most efficiently.
As thermostat closes, close grill block. As you mentioned, this will require tweaking this temperature.
Repeat until keyed off, then close grill block.
If I set the close temperture to 180F, I don't think it will ever close because the coolant will not get that cool unless I am blasting the heat. The thermostat on the Insight is a 195F thermostat. So, maybe close it at 190-195 instead? I ideally want to only push air through the radiator when it is saturated, but before the e-fan turns on. 206F may well be too late. I fully agree we want to avoid using the cooling fan. However, I'd also like to reduce the amount of cycling as much as I can too for longevity sake.
Eventually, it would be great to setup a comparison loop that opens and closes the grill incrementally as needed. But, that part is on the back burner until I get this thing in and tested.
|
|
|
01-17-2017, 09:56 AM
|
#98 (permalink)
|
Administrator
Join Date: Dec 2007
Location: Germantown, WI
Posts: 11,203
Thanks: 2,501
Thanked 2,587 Times in 1,554 Posts
|
I agree slowing down the readings would be a good idea. There is no reason to read as fast as they will. For now, this is for testing, so I think it'll be fine. I don't see coolant temps fluctuating where I'll get any kind of oscillations. They'd really have to fluctuate a lot for that to happen. If by chance that is an issue, I'd like to know about it during testing.
I've not delt with sleep functions. I know there are several levels of sleeping. If you guys have suggestions I'm all ears.
|
|
|
The Following User Says Thank You to Daox For This Useful Post:
|
|
01-17-2017, 10:08 AM
|
#99 (permalink)
|
Master EcoModder
Join Date: Dec 2011
Location: New Zealand
Posts: 5,077
Thanks: 2,903
Thanked 2,560 Times in 1,586 Posts
|
How difficult would it be to have intermediate steps between fully open and fully closed?
|
|
|
01-17-2017, 10:50 AM
|
#100 (permalink)
|
MPGuino Supporter
Join Date: Oct 2010
Location: Hungary
Posts: 1,807
iNXS - '10 Opel Zafira 111 Anniversary Suzi - '02 Suzuki Swift GL
Thanks: 829
Thanked 708 Times in 456 Posts
|
Quote:
Originally Posted by Daox
I agree slowing down the readings would be a good idea. There is no reason to read as fast as they will. For now, this is for testing, so I think it'll be fine. I don't see coolant temps fluctuating where I'll get any kind of oscillations. They'd really have to fluctuate a lot for that to happen. If by chance that is an issue, I'd like to know about it during testing.
|
You won't need to worry about wild temperature swings to see oscillations.
Quote:
Originally Posted by Daox
I've not delt with sleep functions. I know there are several levels of sleeping. If you guys have suggestions I'm all ears.
|
You'll likely want to have some periodic interrupt source in order to utilize sleep, and you'll probably want to use SLEEP_MODE_IDLE. I'd suggest using the timer2 overflow interrupt with a clock prescaler of 1024. That'd give you an overflow frequency of slightly over 61 Hz (that is, assuming a 16 MHz processor speed).
|
|
|
The Following User Says Thank You to t vago For This Useful Post:
|
|
|