Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. "Washing machine ended" sensor

"Washing machine ended" sensor

Scheduled Pinned Locked Moved My Project
21 Posts 11 Posters 15.1k Views 11 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Moshe LivneM Offline
    Moshe LivneM Offline
    Moshe Livne
    Hero Member
    wrote on last edited by
    #1

    2015-07-04.jpg

    Simple sensor using http://www.aliexpress.com/item/1pc-lot-SW-420-Normally-Closed-Alarm-Vibration-Sensor-Module-Vibration-Switch-30512/32259757483.html. the sensor is attached to the top of the machine with one of those sticky dots. I found out it achieves the best and most accurate readings this way. (http://www.aliexpress.com/item/100pcs-lot-Balloon-attachment-glue-dot-attach-balloons-to-ceiling-or-wall-Globo-paste/2029756655.html)

    The sketch is a bit messy and probably could use a little love and constants but it works for me.
    The basic logic is:

    1. check for vibrations every 100ms
    2. if vibrations were detected, mark the period as "vibration" (a period is 5 minutes)
    3. if there was a vibration period after long period of quiet report "start of cycle"
      4 if there was a longish period of quite after a vibration period, report "end of cycle"
    4. in domoticz the change of state trigger a hangouts message to me.

    the sketch was tested on almost all cycles in my machine. It might fail if i load the machine late at night for early morning start as the opening and closing of the door might be detected as false positive. i might add a big red reset button to clear the state if it bothers me too much.

    here is the sketch:

    // Sensor to detect washing machine end of cycle
    // Connect vibration sensor to digital pin 3 
    
    
    #include <MySensor.h>
    #include <SPI.h>
    
    
    #define CHILD_ID 3
    #define BUTTON_PIN  3  // Arduino Digital I/O pin for vibration sensor
    #define SAMPLING_PERIOD 300000 // 5 minutes period. YMMV
    MySensor gw;
    int oldValue=-1;
    unsigned long period_start = millis();
    int state = -1;
    
    
    MyMessage msg(CHILD_ID,V_TRIPPED);
    
    
    void setup()  
    {  
      gw.begin();
    
     // Setup the button
      pinMode(BUTTON_PIN,INPUT);  
      // Activate internal pull-up
      digitalWrite(BUTTON_PIN,HIGH);
      
      gw.present(CHILD_ID, S_DOOR);  
    }
    
    void report_state(int state)
    {
    	  	Serial.print("reporting state: ");
    		Serial.println(state); 
    	    gw.send(msg.set(state));
    	
    }
    
    int prev_state = -1;
    int prev_state_length = 0;
    
    //  Check if digital input has changed and send in new value
    void loop() 
    {
      // Get the update value
      int value = digitalRead(BUTTON_PIN);
    
      if (value != 0 && state != 1) { // vibration detected for the first time during the period
      	state = 1; 
      }
    
      if (millis() - period_start > SAMPLING_PERIOD) {
      	period_start = millis();
      	Serial.println(state);
        if (state != prev_state) {
      		if (state == 1 && prev_state_length > 4) { //a vibration period after long period of quiet means a cycle started
      	    	report_state(state);
    	    	prev_state_length = 1;
      		
      		} 
      	} else if (state == 0 && prev_state_length > 2) { // a long period of quiet means cycle ended
      		if (prev_state_length == 3)
      			report_state(state); // report only once 
      	}
      	
      	if (state != prev_state)
      		prev_state_length = 1;
      	else
      		prev_state_length++;
    	prev_state = state;
        state = 0;
      	
      }
      
     
      delay(100);
    } 
    
    
    1 Reply Last reply
    4
    • Moshe LivneM Offline
      Moshe LivneM Offline
      Moshe Livne
      Hero Member
      wrote on last edited by
      #2

      Just wanted to say that so far not even a single miss....

      1 Reply Last reply
      0
      • greglG Offline
        greglG Offline
        gregl
        Hero Member
        wrote on last edited by
        #3

        Nice work!

        For version 2, get it to fold and put the clothes back in wardrobes! ;-)

        Moshe LivneM 1 Reply Last reply
        0
        • greglG gregl

          Nice work!

          For version 2, get it to fold and put the clothes back in wardrobes! ;-)

          Moshe LivneM Offline
          Moshe LivneM Offline
          Moshe Livne
          Hero Member
          wrote on last edited by
          #4

          @gregl this kind of machinery usually involves a ceremony and a ring and is very expensive to run.... :-)

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gloob
            wrote on last edited by gloob
            #5

            To detect a start of the machine properly you could check if the vibration at least is present for some seconds to prevent the misreading on the evening.

            Edit:

            What kind of Arduino "shield" are you using. Looks like an Arduino Nano on an adapter shield.

            Moshe LivneM 1 Reply Last reply
            0
            • K Offline
              K Offline
              kalle
              wrote on last edited by
              #6

              Nice work and maybe you can power up your arduino with one of the pin from inside the Washing machine (LED panel) to the Nano raw pin. Normaly it is really easy to disamble the plate one the top of the machine to gain access ;-)

              Moshe LivneM 1 Reply Last reply
              0
              • G gloob

                To detect a start of the machine properly you could check if the vibration at least is present for some seconds to prevent the misreading on the evening.

                Edit:

                What kind of Arduino "shield" are you using. Looks like an Arduino Nano on an adapter shield.

                Moshe LivneM Offline
                Moshe LivneM Offline
                Moshe Livne
                Hero Member
                wrote on last edited by
                #7

                @gloob true and it was on my todo list. However, loading the machine did not trigger the sensor yet. If it ain't broken....
                Yes it is a funduino "shield". Very handy for prototyping although really not needed here. It just have lots of vcc and gnd...

                1 Reply Last reply
                0
                • K kalle

                  Nice work and maybe you can power up your arduino with one of the pin from inside the Washing machine (LED panel) to the Nano raw pin. Normaly it is really easy to disamble the plate one the top of the machine to gain access ;-)

                  Moshe LivneM Offline
                  Moshe LivneM Offline
                  Moshe Livne
                  Hero Member
                  wrote on last edited by
                  #8

                  @kalle i thought to use the vibrations to power it! Like one of these nifty self powering rocker switchs

                  1 Reply Last reply
                  0
                  • Cliff KarlssonC Offline
                    Cliff KarlssonC Offline
                    Cliff Karlsson
                    wrote on last edited by
                    #9

                    How is the sensor configured in domoticz? is it added as a switch or motion sensor ?

                    1 Reply Last reply
                    0
                    • V Offline
                      V Offline
                      vil1driver
                      wrote on last edited by
                      #10

                      gw.present(CHILD_ID, S_DOOR); = added as a door lock :p

                      1 Reply Last reply
                      0
                      • Cliff KarlssonC Offline
                        Cliff KarlssonC Offline
                        Cliff Karlsson
                        wrote on last edited by Cliff Karlsson
                        #11

                        I am having some real problems with my Sw-420 vibration sensor. I fastened it directly to the outside of the drum (inside the over) so It vibrates alot when it is running. But the damn sensor wont play. I have to set the sensitivity almost to min to have it not light up when it is still. And when it is running it flickers from time to time, but I would guess it should stay on because it vibrates the whole time.

                        If I turn up the sensitivity then it wont turn off, sometimes I need to tap it when there is no movement to have the light go off. I tried placing it in several different directions but can't get anything to work well. I have tried three different sensors and they all behave the same. Any tips?

                        Moshe LivneM 1 Reply Last reply
                        0
                        • Cliff KarlssonC Cliff Karlsson

                          I am having some real problems with my Sw-420 vibration sensor. I fastened it directly to the outside of the drum (inside the over) so It vibrates alot when it is running. But the damn sensor wont play. I have to set the sensitivity almost to min to have it not light up when it is still. And when it is running it flickers from time to time, but I would guess it should stay on because it vibrates the whole time.

                          If I turn up the sensitivity then it wont turn off, sometimes I need to tap it when there is no movement to have the light go off. I tried placing it in several different directions but can't get anything to work well. I have tried three different sensors and they all behave the same. Any tips?

                          Moshe LivneM Offline
                          Moshe LivneM Offline
                          Moshe Livne
                          Hero Member
                          wrote on last edited by
                          #12

                          @Cliff-Karlsson sorry for the delayed reply.
                          It needs to be set just on the verge.... So, turn it slowly until it is 0,give it slight turn back. These sensors do not have good signal amplification (its ok for the price i guess) so they work in a vwry narrow ranfe

                          1 Reply Last reply
                          0
                          • C Offline
                            C Offline
                            chuckconnors
                            wrote on last edited by
                            #13

                            @Moshe-Livne Thanks for posting this. I definitely plan on trying this for my washer but am curious if you think that it would work for the dryer as well. Is the SW-420 sensitive enough to be able to detect the more subtle movement of the dryer?

                            Moshe LivneM 1 Reply Last reply
                            0
                            • C chuckconnors

                              @Moshe-Livne Thanks for posting this. I definitely plan on trying this for my washer but am curious if you think that it would work for the dryer as well. Is the SW-420 sensitive enough to be able to detect the more subtle movement of the dryer?

                              Moshe LivneM Offline
                              Moshe LivneM Offline
                              Moshe Livne
                              Hero Member
                              wrote on last edited by
                              #14

                              @chuckconnors I seriously doubt that. the washing machine has much move violent movements. For the dryer I think I would go with current as it is continuously drawing current (lots of current!) while working. In retrospect I would do the same with the washing machine if it was not under warranty. get a small junction box, expose about 3cm of the cable and use non invasive current sensor, all inside the box. Problem is, as always, power for the arduino.
                              another option that I considered is taking a good quality power strip, with lots of space in it and putting the sensor and the arduino inside it or only the current sensor (as the wires are exposed usually inside the strip) and the arduino device and charger on the outside. many modern strips have good quality USB sockets so no need for charger.
                              just my 2c... not saying you should touch mains, etc bla bla bla....

                              1 Reply Last reply
                              0
                              • siodS Offline
                                siodS Offline
                                siod
                                wrote on last edited by
                                #15

                                my machine has an "end" led...so I attached a light sensor (LDR) on top of this led...

                                just an idea ;)

                                still learning...

                                1 Reply Last reply
                                0
                                • siklosiS Offline
                                  siklosiS Offline
                                  siklosi
                                  wrote on last edited by
                                  #16

                                  Great Idea. Ill sure make one of these soon. But I think that I will add two start buttons (one for me and one for my girlfriend) and if one of the buttons is pressed as soon as washing machine is finished domoticz will send pushbullet notification to me or my girlfriend.

                                  1 Reply Last reply
                                  0
                                  • Nca78N Offline
                                    Nca78N Offline
                                    Nca78
                                    Hardware Contributor
                                    wrote on last edited by
                                    #17

                                    Hello, that's a very interesting way of solving the problem, I was planning to "upgrade" the wall plug with an in-wall switch including an ACS 712 sensor, this way it could detect 3 levels no current / low current (= on but not washing) / high current (washing). But this is so much simpler that I have to give it a try !

                                    I don't see why using a sensor board for this though ? It's just a basic switch so it could be connected to interrupt pin directly without a board, and then it's possible to do battery-powered sensor. I'll try that and give a feedback.

                                    1 Reply Last reply
                                    0
                                    • JahFyahhJ Offline
                                      JahFyahhJ Offline
                                      JahFyahh
                                      wrote on last edited by
                                      #18

                                      @Moshe-Livne are you still using this setup? I tried it but sumtimes I get false readings. Like a notification, while the machine wasn't even on...

                                      @Nca78 Did you ever do a project with the ACS 712? I was wondering about this sensor en it's safety.

                                      Moshe LivneM 1 Reply Last reply
                                      0
                                      • JahFyahhJ JahFyahh

                                        @Moshe-Livne are you still using this setup? I tried it but sumtimes I get false readings. Like a notification, while the machine wasn't even on...

                                        @Nca78 Did you ever do a project with the ACS 712? I was wondering about this sensor en it's safety.

                                        Moshe LivneM Offline
                                        Moshe LivneM Offline
                                        Moshe Livne
                                        Hero Member
                                        wrote on last edited by
                                        #19

                                        @JahFyahh yes, still using it. I never get false readings although lately I started getting the notifications half way through the cycle. Need to check the glue.

                                        JahFyahhJ 1 Reply Last reply
                                        0
                                        • Moshe LivneM Moshe Livne

                                          @JahFyahh yes, still using it. I never get false readings although lately I started getting the notifications half way through the cycle. Need to check the glue.

                                          JahFyahhJ Offline
                                          JahFyahhJ Offline
                                          JahFyahh
                                          wrote on last edited by
                                          #20

                                          @Moshe-Livne how did you setup the sensitivity on the senser. I tried your advice, turning it to 0 (all the way to the left) then one stripe back. I pasted it with double sided tape to the top of the machine. Any other tips? I'm thinking of pasting it to the back of the machine.

                                          Moshe LivneM 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          15

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular