I would like to make a little fan controller for my car. I am new to MCs and need some direction on where to get started. I figured this would be a simple, and also useful project.
Pretty much i need to make a device that will interface with one of the coolant sensors in my car. It has a pair of dual speed fans that normally the ECU would control, but it has an EPROM from another car that does not have electric fans (oops), but anyway i would like something i can tweak.
My ideal setup would be to have it fire the low speed settings at about 150f and then high speed if the temps hit 165 using a pair of 40a relays. To some this may sound low but i have installed a low temp thermostat that opens at 144f.
oh and almost forgot, the A/C bypass that will need to kick the fans on when the A/C compressor is activated.
So here i am starting from scratch including my experience with MCs, so what im looking for is maybe an example or two when it comes to the programming side, the rest i should be able to handle.
I had a problem with a jeep and explored how jeep controls the fan.
They use a variable temperature sensor and a PWM signal to a H bridge.
The fan can run at a variable rate maintaining a more constant temperature rather than on/off full speed fan as with using a relay and a on/off temperature contacts.
It would make a good project but it you just need it now they sell a kit at Auto-parts stores probably less than what you can make one for.
I have seen the fan kits, but they are almost $200. My fans have 2 inputs each, low and high. I'm sure i could pump a PWM signal into the the High line.
As for cost of making one, i think i have pretty much everything i need laying around.
It's your car, and I don't know the specifics, but I do know that you can cause an engine harm by running it too cool as you can by running it too hot.
Anyhow, though - I wouldn't worry about PWM - the heat capacity of water and such means that PWM won't make a bit of difference, just use a couple of automotive Bosch-style SPST relays control the fans on/off or high/low, whatever - and leave it at that. Such an interface should be really simple to do using a couple NPN transistors, some resistors, and a couple of diodes for the flyback on the relay coils.
Put the diodes on the relays (or relay sockets, which would be better) as close to the relays as possible. Mount the relays somewhere on in the engine compartment (if you have spare spots for relays in the relay and/or fuse box, use them), and put the controller box out of the way somewhere else (I would actually get everything built, put on a PCB with a separate ATMega, and pot it in electronic potting epoxy to help protect against vibration).
Thanks Cr0sh. I have TONS of relays i have for various tasks, even ones with built in diodes :).
What i really need is some sample code to start with where i can specify my temps and such. I'm new to programming, but the hardware side i have covered.
I figured the temp sensors will go into one of the analog inputs, and use 2 of the digital outs for triggering the transistors and relays.
Both fans on high shouldn't pull more then 35amps, that's what they are fused to. I have relays rated for 40 and 50 amps to handle any starting loads.
Once all is put together and working ill etch a PCB and pot it all to protect it from the elements.
as for the motor running cooler, i will gain more power and greater reliability, but a small loss of MPGs. The ECU with the modified EPROM along with some other tweaks i have done to the ignition system make the top end run hotter then spec. Thus the need for more aggressive cooling.
I figured the temp sensors will go into one of the analog inputs, and use 2 of the digital outs for triggering the transistors and relays
Definitely use relays with shunt/flyback diodes; it sounds like you have that covered.
As far as the temp (and other) sensors are concerned, you may have to do some level shifting, depending on the sensor; I have heard that some automotive sensors output swings based on battery voltage (ie, 12-13.8 volts), while others output for the engine control computer, which may be in the range of 0-5 volts, or different. You would have a couple of options here: You can either "level shift" the output of the sensor so that it remains in the 0-5 volt range of the Arduino, or you could find out what the maximum output voltage is for all the sensors, then input that voltage on the AREF pin to change the reference voltage for the ADC in the Arduino. Other than that, your configuration sounds workable. Good luck with the project!
Oh, and i understand the diodes and the important role they play protecting the circuitry. If you ever cracked open an ECU you will see a small army of diodes going across the PCB for the output pins.
Alright, so i started playing around and found this example switch case.
Using a pot i can switch between the separate cases and activate the outputs, for now are LEDs. I know there must be a more efficient way to set some solid case value ranges.
so far with my modifications its gives me a good idea on how i would need to program it to control the 2 fan speeds depending on the coolant temps. One thing i did notice is when the value of the pot was between the values for two cases it would rapidly flash between, this could cause issues with the fans and relays.
EDIT: I added a 5 second delay to each case to prevent rapid switching on and off.
The fun part will be adjusting the values to match the temps.
I'll keep reading, and playing and see what i can come up with.
const int sensorMin = 0; // sensor minimum, discovered through experiment
const int sensorMax = 600; // sensor maximum, discovered through experiment
const int lspeed = 13;
const int mspeed = 12;
const int hspeed = 11;
void setup() {
// initialize serial communication:
Serial.begin(9600);
pinMode(mspeed, OUTPUT);
pinMode(hspeed, OUTPUT);
}
void loop() {
// read the sensor:
int sensorReading = analogRead(0);
// map the sensor range to a range of four options:
int range = map(sensorReading, sensorMin, sensorMax, 0, 3);
// do something different depending on the
// range value:
switch (range) {
case 0: // your hand is on the sensor
Serial.println("dark");
digitalWrite(lspeed, LOW);
digitalWrite(mspeed, LOW);
digitalWrite(hspeed, LOW);
break;
case 1: // your hand is close to the sensor
Serial.println("dim");
digitalWrite(lspeed, HIGH);
digitalWrite(mspeed, LOW);
digitalWrite(hspeed, LOW);
break;
case 2: // your hand is a few inches from the sensor
Serial.println("medium");
digitalWrite(mspeed, HIGH);
digitalWrite(hspeed, LOW);
digitalWrite(lspeed, LOW);
break;
case 3: // your hand is nowhere near the sensor
Serial.println("bright");
digitalWrite(hspeed, HIGH);
digitalWrite(mspeed, LOW);
digitalWrite(lspeed, LOW);
break;
}
}
If your fans draw 35A under normal running - I'd check what they draw initially. I have a 15A motor that will ruin 30A relays in no time due to it's stall current. They lasted less than 6 months (switching no more than 6 times per day) before becoming stuck closed (now solved with a motor controller).