Show Posts
Pages: [1]
1  Using Arduino / Sensors / Re: Interfacing analog thermostat with Arduino on: June 10, 2011, 12:45:29 am
Also, the new code (still just in proof of concept phase):

void CheckThermostat()
{
 int x;
// analogReference(INTERNAL2V56);
 
 int val = digitalRead(A0);
 lcd.setCursor(0,1);
 lcd.print(val);
  switch (val)
  {
    case HIGH:
    lcd.setCursor(0,2);
    lcd.print(Room_1.read());
    if (Room_1.read() != 89) {
      for (x=0;x<90;x++)
        {
          Room_1.write(x);
          lcd.setCursor(0,2);
          lcd.print(Room_1.read());
          //delay(20);
         }
    }   
        break;
    case LOW:
    lcd.setCursor(0,2);
    //lcd.print(Room_1.read());
    if (Room_1.read() > 10) {
      for (x=89;x>0;x--)
        {
          Room_1.write(x);
          lcd.setCursor(0,2);
          lcd.print(Room_1.read());
          //delay(20);
         }
    }
       break;
   }
 
 }//CheckThermostat
2  Using Arduino / Sensors / Re: Interfacing analog thermostat with Arduino on: June 09, 2011, 11:32:22 pm
Figured it out!

I needed a 1k ohm pulldown resistor on the analog pin.


+5v (red wire)--------------Thermostat------(yellow wire for A/C)----------()-------------Pin(A0)
                                                                                                           |
                                                                                                           |
                                                                                                           1K resistor
                                                                                                           |
                                                                                                         ____
                                                                                                          __
                                                                                                           _    (ground)

Then set pinMode(A0,INPUT);  and use digitalRead(A0); to get a HIGH or LOW state.

Problem solved.  Works like a charm.
3  Using Arduino / Sensors / Interfacing analog thermostat with Arduino on: June 09, 2011, 09:46:41 pm
Several people have asked this question, but none have been answered.  Here's the project.

I am connecting thermostats from each room in the house to the arduino (disconnecting them from the HVAC).  I want to use the thermostats as a trigger.  If the thermostat is in 'cool' mode and the thermostat triggers to call for cool air, the arduino will control a servo to open the vent in that room and turn on the A/C compressor and fan if not already on.  Don't go too far into trying to figure out the details because the immediate problem is that I can't read the status of the thermostat.  The wiring at the thermostat is as such:  White = heat, yellow = A/C, Red = 24VAC, Green = fan.  When the system is on cool and the thermostat is triggered, yellow is shorted to red, so I'd like to  use that as a switch to tell the arduino to turn on the AC compressor and fan, and open the vent for that room.  I can get it to work for heat by connecting white to A0 and red to +5v.  The value when the circuit is closed (analogRead()) is 1023.  When the circuit is open (ie, the room is warm enough) the value jumps randomly from 0 to 9000+ and sometimes randomly hits 1023 triggering the servo.  It doesn't work at all on cool.  I can't figure out how to solve this problem.  smiley-sad

I suspect it may be an issue with ground since the analog pin compares it's input to the arduino ground.  There are no grounds on thermostats.  It's basically an SPST switch.  Or at least that's how I understand it.

Anyone with helpful info would be much appreciated!

Servo Room_1;  //create servo object for each room


void setup()
{
  Room_1.attach(smiley-cool;
  Serial.begin(9600);
  lcd.begin(16, 4);    // set up the LCD's number of columns and rows:
  lcd.print("Servo Control...");   // Print a message to the LCD.
 }

void loop()
{
   
   CheckThermostat();
   delay(1000);
 
 
}  //loop()

void CheckThermostat()
{
 int x;
 
 
 int val = analogRead(A0);
 lcd.setCursor(0,1);
 lcd.print(val);
  switch (val)
  {
    case 1023:
    lcd.setCursor(0,2);
    lcd.print(Room_1.read());
    if (Room_1.read() != 89) {
      for (x=0;x<90;x++)
        {
          Room_1.write(x);
          lcd.setCursor(0,2);
          lcd.print(Room_1.read());
          //delay(20);
         }
    }   
        break;
    default:
    lcd.setCursor(0,2);
    //lcd.print(Room_1.read());
    if (Room_1.read() > 10) {
      for (x=89;x>0;x--)
        {
          Room_1.write(x);
          lcd.setCursor(0,2);
          lcd.print(Room_1.read());
          //delay(20);
         }
    }
       break;
   }
 
 }//CheckThermostat
4  Using Arduino / Installation & Troubleshooting / Re: Had it one day and already bricked it. Need to reset.... on: June 04, 2011, 04:10:32 pm
Thanks!  That worked!  Needed all 5 steps, but it worked.   smiley-mr-green
5  Using Arduino / Installation & Troubleshooting / Had it one day and already bricked it. Need to reset.... on: June 04, 2011, 03:24:19 pm
I made a mistake that is letting the Arduino Mega take over the serial port and I can't upload anything to it now.  it's just looping and running the servo and trying to do Serial.println() with no delays.  How can I reset the Mega so that it has no code (like from factory). 

Thanks,

Anthony
Pages: [1]