Project tutorial
Washing Machine Timer

Washing Machine Timer © CC BY

Replacement for broken mechanical timer of a washing machine with electronic timer.

  • 3,345 views
  • 4 comments
  • 10 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)
Hy gluegun
Hot glue gun (generic)
5228336
Tape, Double Sided
5301230
Tape, Green

Apps and online services

About this project

Introduction

This is a replacement part for the washing machine I have that has a broken wash timer. The original timer was a mechanical timer/direction switch, which can control the washing tub's motor in following manner:

  • Take x minutes of wash time input from user
  • Rotate washing tub's motor clockwise for few seconds
  • Stop motor for few seconds
  • Rotate wash tub's motor anti-clockwise for few seconds
  • Stop motor for few seconds
  • Keep doing last 4 steps until wash timer expires

I am going to build an electronic timer that can do the same operation.

Demo

Following video demonstrates the operation of this electronic timer:

Electronic Timer Demo

Hardware

  • Arduino Pro Mini: Runs code and controls everything
  • 1306 OLED: Show user instruction and timer countdown
  • Red/Black Push Button: Set timer and start timer
  • 5V Relay Modules: Supply AC power to motor and control direction
  • 5V Adapter: Power the electronic timer

1306 OLED is directly soldered on the pro mini like this:

2 relays module, 2 push buttons, Arduino Pro Mini + 1306 OLED is connected on a protoboard like this -

Programming

Step 1: Get a HC-05 Bluetooth-Serial module and change it's baud rate to 57600 according to this tutorial or this step. To perform this step another Arduino Uno or a USB to Serial module will be required.

Use following AT commands

AT  
AT+UART = 57600,0,0
AT+RESET

Step 2: After the baud rate is changed to 57600, connect the HC-05 to Arduino pro mini according to following wiring diagram

Step 3: Select board from Arduino IDE, paste the code and click upload.

I am using Bluetooth serial, because it enables wireless in system field programmable capabilities, which helped updating the code on pro mini if needed.

Wiring and Device Operation Explained

Wiring may vary for newer/different washing machine models, so I am going to explain about my one. Pay attention to the "Sharp" diagram on bottom-right corner, one WHITE WIRE is coming from mains and going to the wash timer, one RED WIRE and one BLUE WIRE is coming out of the wash timer. I have disconnected these 3 wires from the original (faulty) wash timer and brought out through a hole on the top of the washing machine.

When WHITE WIRE is switched to the RED WIRE motor rotates in clockwise and when WHITE WIRE is switched to the BLUE WIRE motor rotates in anticlockwise direction.

This electronic timer made with Arduino pro mini will keep track of wash time, rotate the wash tub's motor in one direction for 5 seconds by connecting WHITE and RED wires through one relay contact. Then it will stop the motor and wait for 5 seconds. After that it will rotate the was tub's motor in the other direction for 5 seconds by connecting the WHITE and BLUE wires through the other relay contact. Then it will stop and wait for another 5 seconds. All these timing sequence can be modified from the code if necessary.

Following diagram shows how just flipping the AC incoming mains to one leg or the other leg of the motor's capacitor, direction of the AC motor can be altered.

Single phase induction motor theory

References

You can learn more in details about each components in these tutorials:

Disclaimer!

This project deals with AC mains supply, do at your own risk !

Code

Untitled fileC/C++
#include "U8glib.h"
//SSD1306 oled waveshare(clk,din,cs,d/c,res);
U8GLIB_SSD1306_128X64 u8g(A4,A5,12,11,10);

volatile int rbc = 0;
volatile int bbc = 0;
 int sec =0;
 int mi = 0;
 int motor_rotation = 0;

void setup()
{
  u8g.setRot180();
  analogReference(INTERNAL);
  pinMode(2,INPUT_PULLUP);
  pinMode(3,INPUT_PULLUP);
  attachInterrupt(0, ISR_SW_RED,FALLING);
  attachInterrupt(1, ISR_SW_BLACK,FALLING);
  pinMode(5,OUTPUT);
  digitalWrite(5,LOW);
  pinMode(4,OUTPUT);
  digitalWrite(4,LOW);
}


void loop(void) 
{
  
 while(!rbc)
 {
   // show timer set menu
    u8g.firstPage();  
    do {
      draw_menu();
       } while( u8g.nextPage() );
   
   // show user proper operation message
     if (rbc>0 && bbc==0)
       {
         u8g.firstPage();  
        do {
            draw_message();
           } while( u8g.nextPage() );
    delay(2000);
    rbc=0; //u8g.clear();
        }
 }

 // start timer
 if(rbc>0)
 {
       sec =59;
       mi = bbc-1;
 
    while(mi>=0)
    {
     // show countdown timer message
        unsigned long temp = millis()+1000;
        while(temp>=millis())
        {
         u8g.firstPage();  
         do {
             draw_timer();
             } while( u8g.nextPage() );
         }
         
         sec=sec-1;
         if(sec%5==0)
         {
         control_motor(); // call every 5 sec
         }
         if (sec <= 0)
            {
             sec = 59;
             mi = mi - 1;
            }      
      }
    rbc = 0; bbc = 0;
    mi = 0 ; sec = 0;
    digitalWrite(5,LOW);digitalWrite(6,LOW);
  }
 
}// end of loop

void draw_menu(void)
{
 u8g.setFont(u8g_font_timB24);
 if (bbc<10)
 {
 u8g.drawStr( 22,30,"0");
 u8g.setPrintPos(38,30);u8g.print(bbc);
 }
 else
 {
   u8g.setPrintPos(22,30);u8g.print(bbc);
 }
 u8g.drawStr( 54,30,":00");
 u8g.setFont(u8g_font_8x13);
 u8g.drawStr( 0,62," 'WASHING TIMER'");
 
 u8g.setFont(u8g_font_5x8);
 u8g.drawStr( 0,47,"Red:START  Black:SET TIME");
 
 
}

void draw_message(void)
{
   u8g.setFont(u8g_font_8x13);
   u8g.drawStr( 0,10," SET WASH TIMER");
   u8g.drawStr( 0,23,"FIRST BY PUSHING");
   u8g.drawStr( 0,36,"THE BLACK BUTTON");
 //  u8g.setFont(u8g_font_8x13);
 u8g.drawStr( 0,62," 'WASHING TIMER'");
 
 u8g.setFont(u8g_font_5x8);
 u8g.drawStr( 0,47,"Red:START  Black:SET TIME");
   
}

void draw_timer(void)
{

      u8g.setFont(u8g_font_timB24);
      if (mi<10)
      {
       u8g.drawStr( 22,30,"0");
       u8g.setPrintPos(38,30);u8g.print(mi);
      }
       else
      {
      u8g.setPrintPos(22,30);u8g.print(mi);
      }
      
      u8g.drawStr( 54,30,":");
      
            if (sec<10)
      {
       u8g.drawStr( 70,30,"0");
       u8g.setPrintPos(86,30);u8g.print(sec);
      }
       else
      {
       u8g.setPrintPos(70,30);u8g.print(sec);
      }
      
      
       if(motor_rotation==0)
       {
        u8g.setFont(u8g_font_5x8);
        u8g.drawStr( 0,47,"  WASHING MOTOR CW Spin");
        digitalWrite(5,HIGH);
       }
 
       if(motor_rotation==1)
       {
        u8g.setFont(u8g_font_5x8);
        u8g.drawStr( 0,47,"  WASHING MOTOR STOPPED ");
        digitalWrite(5,LOW);digitalWrite(4,LOW);    
       }

       if(motor_rotation==2)
       {
        u8g.setFont(u8g_font_5x8);
        u8g.drawStr( 0,47,"  WASHING MOTOR CCW Spin");
        digitalWrite(4,HIGH);
        
       }
       if(motor_rotation==3)
       {
       u8g.setFont(u8g_font_5x8);
       u8g.drawStr( 0,47,"  WASHING MOTOR STOPPED ");
       digitalWrite(5,LOW);digitalWrite(4,LOW);

       }

        u8g.setFont(u8g_font_8x13);
       u8g.drawStr( 0,62," 'WASHING TIMER'");
      
}

void ISR_SW_RED()
{
  sei();
  rbc++;
  cli();
}

void ISR_SW_BLACK()
{
  sei();
  bbc++;
  cli();
}

void control_motor()
{
 motor_rotation++;
 if(motor_rotation>3)
 {
 motor_rotation = 0;
 }
}

Schematics

Washing machine internal schematic
Sch vjfa9gup9c
electronic timer schematic
Ckt iu51saqolh

Comments

Similar projects you might like

Arduino Countdown Timer

Project tutorial by xXarduino_11Xx

  • 11,741 views
  • 0 comments
  • 10 respects

Scorbot ER-V+ Controller & Simulator Design

Project tutorial by Amit Nandi (BigWiz)

  • 1,252 views
  • 3 comments
  • 6 respects

The Drawing Machine

Project showcase by Kramick Saha

  • 12,412 views
  • 6 comments
  • 20 respects

Make SMART Your Washing Machine

Project tutorial by Giovanni Gentile

  • 9,581 views
  • 0 comments
  • 6 respects

Coin Op Personal Vending Machine

Project tutorial by comptek4

  • 5,418 views
  • 13 comments
  • 29 respects

Arduino Deep Fridge Timer

Project showcase by Shahariar

  • 2,822 views
  • 4 comments
  • 8 respects
Add projectSign up / Login