Friday, March 11, 2016

Washing Machine Controller Using AVR ATMEL ATmega8 Microcontroller Using Assembly Language (NOT Arduino)

Washing Machine Controller Using  AVR ATMEL ATmega8 Microcontroller Using Assembly Language (NOT Arduino)

A brief history about why I decided to make my own controller :-

I have a washing machine, with control board problems. I did changed the control board from OEM 2 times, each time it cost Rs.3900 + 300 for service charges. So, I spent Rs.8200/- since 2008. Actual machine cost is Rs.12,000/- Now in year 2016 the same control board SMPS failure . The washing machine model is Whirlpool Splash 55. Seems the designer of the board is a beer addict during design ! Very sad that not only for me for those having this model is having the same issue!!!. But this time I'm decided to design my own control board with my experiences. My control board costs less than Rs.500 and all of the components are from my junk box. not spent a paisa but time.


 Basic operation sequence of a washing machine :-

There is just 4 relays to be controlled in a regular sequence, not a rocket science either. The basic operation sequence is like this
  1. Water filling (at actual time)
  2. Agitronic soak (15mins)
  3. First wash    (15mins)
  4. First drain (4mins)
  5. Second wash or call it as first rinse (10mins)
  6. Second drain (4mins)
  7. Spin (5mins)
  8. Buzzer chim (15sec)
There are lot of  information available about the time taken for each operation from several washing machine manufacturer. But i referred Whirlpools manual and it recommends as below
Program Time / Cycle time for each mode
                     All values in minutes
                 Agitronic    Normal    Speedy    R+S    S only
 Soak            20            -                  -         -            -
 Wash           20          20                 9          -            -  
 Rinse           16          16               16         8             -
 Spin              8           8                  6         6             6
And there is a very nice recommendation from Bureau Of Energy Efficiency
Energy Labeling Scheme For Washing Machines by Bureau Of Energy Efficiency

From the above given recommendation i choose  following timings
   soakTime     = 15 mins
   washTime     = 15 mins (For one wash cycle)
   rinseTime     =  8 mins
   spinTime     =  5 mins
At this point of time, there is no selector / program selector available on the controller. But it's on my wish list.

Why decided to use AVR Assembly language and not to use Arduino C

For this washing machine controller i decided to use assembly language, and it'll be my first AVR assembly language project. I'm using AVR Studio 4.19 and ProgISP to compile and upload.
I personally do not recommend higher version of AVR Studio. V 4.19 is lite and there is not much improvement on ASM compiler between V4.19 and V6.2. (Both IDE's assembler version is 2.1.xx)
Since 2006 i'm using Arduino, now i'm feeling limited with arduino resources when there is really a lot of things can be done with AVRs other line of products like ATtiny13, 2313, etc....Arduino will not help to develop codes for this. The size of HEX code for LedBlink in arduino is 890 bytes, the same LedBlink in assembly will be just 34 bytes !!!! Wow ahh.. Excess  856 bytes of code dumped inside my ATmega8 for nothing. When comes to industrial application the unwanted junk of code will generate lot of issues. That's why the Arduino's liquidCrystal library is not recommended by most of developers as it collide with interrupt cycle or millis() library.
Arduino is for kids and new comers. For real time application Arduino is not the right tool to write my code. Best to go for ASM Assembly language for AVR.

Hardware setup

I had my own ATmega8 break out board with 6 inputs and 4 outputs. I'm using this pcbs for most of my project. Here is the schematic diagram of controller.


Water level pressure switch
Loading door open / close switch. (in my project, i'm not using this sensor)


Motor forward
Motor reverse
Water inlet solenoid
Water drain traction motor
           ( In my model Whirlpool Splash 55, Its single motor for slow spin and fast spin, it's the drain traction motor change the gear wheel between slow and fast spin )
Wish list : heartbeat LED, sequence indication LEDs, start / pause button, EEPROM storage of electricity failure recovery, etc...

Here is my complete source code in ASM language  for ATMEL ATmega8 controlled Washing Machine
 AVR-ATMEL-ATmega8-Microcontroller-controllerd-washing-machine- Using-Assembly-Language.asm

Complete project file in zip file (asm, HEX, etc..)
AVR-ATMEL-ATmega8-Microcontroller-controllerd-washing-machine- Using-Assembly-Language


  1. Lovely vu3xvr
    you are a rare person able to use the knowledge with all love for the technology.
    wish you many more projects likewise.

  2. Excellent! Really useful. Dr.Rajasekhar, VU2HMY

  3. Very nice article.

  4. الان مع اسرع فريق صيانة متنقل من خلال مركز صيانة الكتروستار تواصلوا الان مع خدمة العملاء واحصلوا على كافة المميزات