Air Conditioning state monitoring sensor


  • Hero Member

    First, special thanks to @Chester for thinking the way to do that and @Sparkman, my hero, for correcting my silly mistake.

    These sensors are for checking if the kids (or me, just hypothetically :-) ) left the air conditioning running in their rooms. What makes it work is that the flaps move in a particular way when you turn the air conditioning off in my wall unit and they "close down" to a position that is impossible while its running.
    This is the sensor (looks almost professional!):
    upload_-1 (4).jpg
    I have since added also battery monitoring although I have to tweak it a bit as it shows 66%.
    The reed sensor sense the presence of a magnet on the flap.

    This is the sensor in position. Couldn't find my kids blue tack so had to use blue tape.
    upload_-1 (5).jpg

    I have carefully measure everything to fit into one of the super cheap aliexpress project boxes. what I didn't take into account was that the battery adds extra 4mm to the height. Darn.

    Here you can see the magnet:upload_-1 (6).jpg

    and this is the sketch:

    #include <MySensor.h>
    #include <SPI.h>
    
    #define REED_PIN 3
    #define INTERRUPT REED_PIN-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
    #define CHILD_ID 1
    #define SLEEP_TIME 28800000
    int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
    
    
    
    
    MySensor gw;
    MyMessage msg(CHILD_ID, V_LIGHT);
    
     
    void setup() {
      
      analogReference(INTERNAL);
    
      pinMode(REED_PIN, INPUT); 
      digitalWrite(REED_PIN, HIGH); //internal pullup
    //  pinMode(A0, INPUT); 
      Serial.begin(115200);
    
      gw.begin();
      
      gw.sendSketchInfo("AirCon Sensor", "1.0");
      gw.present(CHILD_ID, S_LIGHT);
      
    }
    
    int old_value = -1;
    int oldBatteryPcnt = 0;
    
    
    void loop() {
    	int value;  
    	int bValue;
      
      // Listen for any knock at all.
      
    ///  gw.process(); // Process incomming messages
      
    //  	t = analogRead(A0);
      	value = digitalRead(REED_PIN);
      	
    	Serial.println(value);
      	delay(500); //debounce
      	if (value != old_value){
      		old_value = value;
      		gw.send(msg.set(value));
      	}
    
    	//Battery
    	bValue = analogRead(BATTERY_SENSE_PIN);
        int batteryPcnt = bValue / 10;
        Serial.print("Battery : ");
    	Serial.print(batteryPcnt);
    	Serial.println("%");
    	if (oldBatteryPcnt != batteryPcnt) {
        	gw.sendBatteryLevel(batteryPcnt);
        	oldBatteryPcnt = batteryPcnt;
    	}
    
    	gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
     
    } 
    


  • Great to see it working! Sometimes its definitely a case of going back to the simplest design idea to get the best result. Congratulations on getting the right solution :)


  • Contest Winner

    @Moshe-Livne

    props for the use of blue tape!

    all kidding aside, this is a great project!


  • Hero Member

    @BulldogLowell It does add a little 60`s look to the whole project, isn't it? I'll make these some pretty wood boxes. My problem is that temps here are now consistently under 10 degrees. white glue turns to cheese when its that cold. Have an idea for this as well... will post when it's ready.


  • Hero Member

    @Chester That is why having a forum is so great! I don't think I would have thought about this myself - I tend to oversolve problems.



  • you make yourself always down



  • you gave me more solutions i think about before you here


  • Hero Member

    @Didi Thanks! Still, I tend to oversolve. I know that and try to fight it but whenever I see a problem my first instinct is an RPI with 1/2 TB storage, a few motors and sensors. Simple!



  • Nice! Although i would probably have opened the unit and see if i could tap into the signal of one of those 'operation' LED's.
    That way the whole MySensors node would be invisible ;)


  • Hero Member

    And here they are, mounted properly:
    IMG_20150727_142235_HDR[1].jpg



  • Looking neat!


  • Hero Member

    @Moshe-Livne Looks great, but I kind of miss the blue tape :stuck_out_tongue:

    Cheers
    Al


  • Hero Member

    @Sparkman I cater for the community members needs:
    IMG_20150729_131313[1].jpg


  • Hero Member



  • :laughing:


  • Hardware Contributor

    Good idea. Append IR control


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.