Jump to content

Impossible Summer Project #3 - Car Thermostat


Recommended Posts

In an attempt to make something that is actually useful ...

 

I drive a 2000 Toyota Mr2 Spyder. It's a fun car, but it lacks many modern bits and pieces that cars in 2010+ have.

 

Because the car is tiny, my A/C works way too well. It goes from blistering hot to freezing in only a few minutes.

 

The Goal here to to make a thermostat (without using a modern PID thermostat), that will shut the A/C off when it is TOO cold, and turn it back on when it gets too hot.

 

This can also be adapted for the DJ booth as well, with a mini computer fan, but it will likely be more hassle than just turning a fan on and off when you need it.

 

  • Like 3
Link to comment
Share on other sites

I'm using a LM35 (similar to TMP36) temp sensor. It's fairly basic and there are more accurate humidity sensors out there, but the LM35 is small and cheap.

 

The goal is to use a 5v relay to switch 12v (Arduino cannot output more than 5v, and I'm assuming that my car using 12v for electronics).

 

-

 

The problem I have is I don't fully understand how my car's A/C button works. It is not like a physical light switch in the house, and even though you can toggle it on/off - it only makes contact when it is pressed and released. It does this in the same manner that AKAI MIDI pads use. I would guess that it uses resistance, and I assume that it sends 1-shot signals for on/off to the car's ECU. Maybe you could shed some light on this??

 

I'm going to take the console apart and try to figure out what is going on. I have wiring diagrams for the car but they are very basic....

Link to comment
Share on other sites

Guest rasteri

The problem I have is I don't fully understand how my car's A/C button works. It is not like a physical light switch in the house, and even though you can toggle it on/off - it only makes contact when it is pressed and released. It does this in the same manner that AKAI MIDI pads use. I would guess that it uses resistance, and I assume that it sends 1-shot signals for on/off to the car's ECU. Maybe you could shed some light on this??

The toggle action is likely part of the control circuit rather than being a mechanical function of the switch. They'll achieve this with either a T-Type latch or (more likely) software. You'll still be able to emulate the switch using a quick ON-OFF pulse from a relay, but then the Arduino has no way of knowing if it's turning the AC on or off.

 

If the switch has an indicator attached to it that lights up with the AC is on, you could perhaps hook the LED control lines to an input pin on the Arduino (likely via another relay for protection). Alternatively, you could assume the car will always start with the AC off, then have a flag in your program to keep track of ON/OFF states.

Link to comment
Share on other sites

rasteri you are fucking awesome! I find it odd that I can get more help here on DV than on either of my Car or Arduino forums.

 

Perhaps DV's porridge is "just right".

 

-

 

The A/C switch indeed lights up a LED when it is on, but the fan (a physical knob on my dash) must be on for the A/C to work at all.

 

You definitely bring up more concerns that I had originally thought of - I'm obviously not a programmer here ... I would like to keep the project as simple as possible but I have some learning to do.

 

The temperature&display would turn on with car, and the added "switching" code would be something like:

 

if (celsius >35) {
digitalWrite(4,HIGH);
}
else {
digitalWrite(4,LOW);
Link to comment
Share on other sites

Guest rasteri

I guess you'd probably want to write a function for toggling the AC and keeping track of if the AC is on or not, something like :

unsigned char AC_ON = 0; /* Assume AC is off when car is started */

void toggle_AC() {

  /* Never used an arduino so you'll have to substitute the real commands here  /*
  switch_on_relay();
  wait_half_a_second_or_so();
  switch_off_relay();

  AC_ON = ~AC_ON; /* This toggles the value of AC_ON */
}

Then in your main() function, call the toggle function whenever you have to change the state of the AC, eg :

if (AC_ON && celsius < 35){ // AC is on and car is too cold
  toggle_AC(); // Turn AC off
}
else if (!AC_ON && celcius > 35) { // AC is off and car is too warm
  toggle_AC(); // Turn AC on
}

The problem with this approach is that if someone hits the AC switch the arduino will get confused.

  • Like 1
Link to comment
Share on other sites

It was recommended that I use Boolean:

bool AC_ON = false; /* states that ac is off*/

void loop()
{
float celsius = (reading from your temperature sensors);

if(AC_ON && celsius > 26) /*the ac is off and it is to hot so turn on the ac*/
{
toggleON_AC (); /*turn on the ac*/
}
else if(!AC_ON && celsius < 26)/*it checks that ac is on and that the temp is below 26 so it is to cold turn off the ac */
{
toggleOFF_AC ();/*just turn off the ac relay*/
}
}

void toggleON_AC ()
{
switch_on_relay();
AC_ON = true; /*toggles ac state to "on"*/
}

void toggleOFF_AC()
{
switch_off_relay();
AC_ON false; /*toggles ac state to "off"*/
}

I'm still figuring out how much control I want over the system. The A/C on/off button only receives power if the fan is on (which is a physical switch that uses continuity between different pins to determine speed). This also begs the question of controlling fan speed in conjunction with how hot it is. Example: At 37C (100F), the fan will blow at max speed, but at 27C (80F) it will blow at minimum speed - but in both conditions A/C will be "on" regardless.

 

That is probably more than I can chew. I'd be more impressed to actually install the damn thing in the car and have it work, even without the extra clever programming.

Link to comment
Share on other sites

  • 1 month later...

Hey Rasteri, I figured that I owe you an update since you helped me with the programming.

 

I finally got around to installing it in the car, which was actually quite a bit of work. The current program simply reads temperature changes every 10 seconds. I will be adding more to it later.

 

It's not the most impressive thing out there, but I'm pretty sure I'm the first to use an arduino in the mr2 Spyder (as far as I know)

 

Video: http://vidmg.photobucket.com/albums/v136/seoulbrotha/MRS/2014-09-03175047_zps1796785f.mp4

 

Underside:

  • Like 1
Link to comment
Share on other sites

That's good you followed through with it, especially with something so complicated, learning new programming skills, etc.

 

I was working on a big web development project a few years back, and the very last part was in Spanish. I dusted off my Spanish skills, read the instructions over and over, and finally nailed it. Ironically, I just learned yesterday though said project finally collapsed, but now I have much better code, so bring it...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...