'MySensoring' a GE Electric Clothes Dryer


  • Hero Member

    GE Electric Dryer M# GTX18ESSJ0WW

    This is a very simple "Dry Cycle Completed" sensor. It's designed uses the same Optocoupler sensing design I used in the Kiddie Smoke Detector project. The only difference is that I'm using 2 AC to DC transformers. One to power the the Pro Mini, and the other to sense cycle completion.

    Parts:

    1. Some wire
    2. 2 Cheap AC/DC converters
    3. 1 Optocoupler
    4. 1 Resistor 4.7K
    5. 1 Step Down Regulator (for the radio)
    6. 1 Small Proto Board.

    Highlights:

    1. Use the Dryer 120v Signal buzzer to interface with the Pro-Mini. Simply power the 2nd (sense) AC to DC transformer with the signal buzzer, and use the 5vdc output to activate the optocoupler. (I'm sure you can probably just read the raw 5vdc, but I have 60 of these opto's so I wanted to use one.. 🙂 )
    2. Uses the same sketch as the Kiddie Smoke Project, with the only change being to CYCLE_INTERVAL (For my dryer 3 works well)

    Sketch:

    // Based on Author: Patrick 'Anticimex' Fallberg Interrupt driven binary switch example with dual interrupts
    
    #include <MySensor.h>
    #include <SPI.h>
    
    #define SKETCH_NAME "Dryer End Cycle"
    #define SKETCH_MAJOR_VER "1"
    #define SKETCH_MINOR_VER "1"
    
    #define CHILD_ID 3
    
    #define SIREN_SENSE_PIN 3   // Arduino Digital I/O pin for optocoupler for siren
    
    unsigned int SLEEP_TIME			= 32400; // Sleep time between reads (in seconds) 32400 = 9hrs?
    long CYCLE_COUNTER					= 3;  // This is the number of times we want the Audio Counter to reach before triggering a signal to controller.
    unsigned long CYCLE_INTERVAL		= 3; // How long do we want to watch once first detected (in seconds) 
    											//Adjust for your smoke detector, you want to pick up the siren signal at least 3 time to help stop false alarms. 
    unsigned long CYCLE_RATE			= 90; // How fast do we want to move checking the Pin state in the Status Check (in Millis) Adjust for your smoke detector
    											//Adjust for your smoke detector, you want to pick up the siren signal at least 3 time to help stop false alarms.
    unsigned long CYCLE_TIME_OKSTATUS	= 8; // How long do we want to watch for "all clear" once we have confirmed an Alarm (in seconds)
    unsigned long CYCLE_RATE_OKSTATUS	= 500; // How fast do we want to move checking the Pin state when checking for an OK status (in Millis)
    
    int oldValue=1;
    int value=0;
    
    
    MySensor sensor_node;
    MyMessage msg(CHILD_ID, V_TRIPPED);
    
    void setup()  
    {  
    	sensor_node.begin();
    	// Setup the Siren Pin HIGH
    	pinMode(SIREN_SENSE_PIN, INPUT_PULLUP);
    	// Send the sketch version information to the gateway and Controller
    	sensor_node.sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER"."SKETCH_MINOR_VER);
    	sensor_node.present(CHILD_ID, S_SMOKE); 
    	//Send the state -- Always send Alarm state on power up.
    	sensor_node.send(msg.setSensor(CHILD_ID).set("1"), true);
    	
    }
    
    // Loop will iterate on changes on the BUTTON_PINs
    void loop() 
    {
    	// Check to see if we have a alarm. I always want to check even if we are coming out of sleep for heartbeat.
    	AlarmStatus();
    	// Sleep until we get a audio power hit on the optocoupler or 9hrs
    	sensor_node.sleep(SIREN_SENSE_PIN-2,FALLING, SLEEP_TIME * 1000UL);
    	
    } 
    
    void AlarmStatus()
    {
    	
    // We will check the status now, this could be called by an interrupt or heartbeat
    int siren_audio_count	=0;
    long cycle_time			=0; 	
    unsigned long startedAt = millis();
    
    	Serial.println("Status Check");
    	//Read the Pin
    	value = digitalRead(SIREN_SENSE_PIN);
        // If Pin return a 0 (LOW), then we have a Alarm Condition
    	if (value != 1) {
    		 //We are only going to check for status for CYCLE_INTERVAL time I think this should help stabilize Siren Sensing
    		  while(millis() - startedAt < CYCLE_INTERVAL * 1000)
    		  {
    			  //We are going to check CYCLE_RATE fast
    			  if(millis() - cycle_time > CYCLE_RATE ) {
    				  // save the last time you Checked
    				  cycle_time = millis();
    				    //We will count each time SIREN_SENSE_PIN is 0 (Alarm - LOW) for the above time and at the above rate.
    					value = digitalRead(SIREN_SENSE_PIN);  
    						if (value != 1)
    						{
    							siren_audio_count++;
    							Serial.print("Audio Count: ");
    							Serial.println(siren_audio_count);
    						} 
    			  }
    		  }
    				// Eval siren audio hit count against our limit. If we are => then CYCLE_COUNTER then lets start a loop for "All Clear" reset
    				// If we continue to return an audio power hit, then we will continue to send to the controller. 
    				if (siren_audio_count>=CYCLE_COUNTER)
    				{
    					Serial.println("Alarm Detected");
    					
    					do 
    					{
    					  //update gateway with bad news.
    					  //sensor_node.send(msg.set("1"));
    					  sensor_node.send(msg.setSensor(CHILD_ID).set("1"), true);
    					  Serial.println("Alarm Detected Sent to gateway");
    					} while (IsAlarmAllClear()!=1);
    				
    				}
    	}
    	//Pin returned a 1 (High) so there is no alarm. 
    	else
    	{
    	  IsAlarmAllClear();
    	}
    }
    
    int IsAlarmAllClear()
    // We are looking for an gap in time that we no longer see an audio power hit to the optocoupler. 
    
    {
     int alarmOn				=0;
     long cycle_time			=0;
     unsigned long startedAt	= millis();
    
    	//We are only going to check for status for CYCLE_TIME_OKSTATUS time	
    	while(millis() - startedAt < CYCLE_TIME_OKSTATUS * 1000)
    	{
    		//We are going to check CYCLE_RATE_OKSTATUS fast
    		if(millis() - cycle_time > CYCLE_RATE_OKSTATUS) {
    			// save the last time you Checked
    			cycle_time = millis();
    			int value = digitalRead(SIREN_SENSE_PIN);
    			if (value != 1) //We are still in an alarm state
    			{
    				alarmOn++;
    			}
    		}
    	}
    			if (alarmOn < 1)
    			{
    				// We don't have any sign that we are still in an alarm status
    				//Send all clear msg to controller
    				//sensor_node.send(msg.set("0"));
    				sensor_node.send(msg.setSensor(CHILD_ID).set("0"), true);
    				// Used to update the node - NOT used for battery check.
    				sensor_node.sendBatteryLevel(random(1, 100) );
    				Serial.println("All Clear");
    				return 1;
    			} 
    			else
    			{
    				// We are still in an alarm status
    				//The calling function will handle sending NOT CLEAR to controller				
    				Serial.println("NOT CLEAR");
    				return 0;
    			} 	 
    

    }

    Here are a few, pretty bad pictures:

    20150613_090149.jpg

    20150613_090245.jpg

    20150613_090424.jpg

    20150613_090429.jpg

    20150613_090436.jpg

    20150613_090418.jpg

    2015-06-13_11-12-02.png


Log in to reply
 

Suggested Topics

  • 8
  • 2
  • 29
  • 2
  • 44
  • 3

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts