Bird
Raised Fist0
PLC Programmingscripting~5 mins

Washing machine control sequence in PLC Programming

Choose your learning style10 modes available
Introduction
A washing machine control sequence tells the machine what steps to do and when, so your clothes get clean automatically.
When you want to automate the washing process in a home appliance.
When programming a machine to follow a set of timed steps like filling water, washing, rinsing, and spinning.
When you need to control motors, valves, and sensors in a specific order.
When designing simple automation for household or industrial washing machines.
Syntax
PLC Programming
(* Example PLC program using ladder logic style pseudocode *)
PROGRAM WashingMachine
VAR
  StartButton: BOOL;
  FillWater: BOOL;
  Wash: BOOL;
  Rinse: BOOL;
  Spin: BOOL;
  Timer: INT;
END_VAR

(* Control sequence steps *)
IF StartButton THEN
  FillWater := TRUE;
  Timer := 0;
END_IF

IF FillWater THEN
  Timer := Timer + 1;
  IF Timer >= 10 THEN (* 10 seconds to fill water *)
    FillWater := FALSE;
    Wash := TRUE;
    Timer := 0;
  END_IF
END_IF

IF Wash THEN
  Timer := Timer + 1;
  IF Timer >= 20 THEN (* 20 seconds washing *)
    Wash := FALSE;
    Rinse := TRUE;
    Timer := 0;
  END_IF
END_IF

IF Rinse THEN
  Timer := Timer + 1;
  IF Timer >= 15 THEN (* 15 seconds rinsing *)
    Rinse := FALSE;
    Spin := TRUE;
    Timer := 0;
  END_IF
END_IF

IF Spin THEN
  Timer := Timer + 1;
  IF Timer >= 10 THEN (* 10 seconds spinning *)
    Spin := FALSE;
    Timer := 0;
  END_IF
END_IF
END_PROGRAM
This example uses simple boolean flags and a timer counter to control each step.
Each step runs for a set time, then moves to the next automatically.
Examples
Starts the filling water step when the start button is pressed.
PLC Programming
IF StartButton THEN
  FillWater := TRUE;
  Timer := 0;
END_IF
Runs the fill water step for 10 seconds, then switches to washing.
PLC Programming
IF FillWater THEN
  Timer := Timer + 1;
  IF Timer >= 10 THEN
    FillWater := FALSE;
    Wash := TRUE;
    Timer := 0;
  END_IF
END_IF
Runs the spin step for 10 seconds, then stops the cycle.
PLC Programming
IF Spin THEN
  Timer := Timer + 1;
  IF Timer >= 10 THEN
    Spin := FALSE;
    Timer := 0;
  END_IF
END_IF
Sample Program
This program simulates a washing machine running through all steps automatically, printing the current step and timer every second.
PLC Programming
PROGRAM WashingMachine
VAR
  StartButton: BOOL := TRUE;
  FillWater: BOOL := FALSE;
  Wash: BOOL := FALSE;
  Rinse: BOOL := FALSE;
  Spin: BOOL := FALSE;
  Timer: INT := 0;
  Step: STRING := "Idle";
END_VAR

(* Simulate the washing machine control sequence *)
FOR i := 1 TO 60 DO
  IF StartButton THEN
    FillWater := TRUE;
    Step := "Filling Water";
    StartButton := FALSE;
    Timer := 0;
  END_IF

  IF FillWater THEN
    Timer := Timer + 1;
    IF Timer >= 10 THEN
      FillWater := FALSE;
      Wash := TRUE;
      Step := "Washing";
      Timer := 0;
    END_IF
  END_IF

  IF Wash THEN
    Timer := Timer + 1;
    IF Timer >= 20 THEN
      Wash := FALSE;
      Rinse := TRUE;
      Step := "Rinsing";
      Timer := 0;
    END_IF
  END_IF

  IF Rinse THEN
    Timer := Timer + 1;
    IF Timer >= 15 THEN
      Rinse := FALSE;
      Spin := TRUE;
      Step := "Spinning";
      Timer := 0;
    END_IF
  END_IF

  IF Spin THEN
    Timer := Timer + 1;
    IF Timer >= 10 THEN
      Spin := FALSE;
      Step := "Done";
      Timer := 0;
    END_IF
  END_IF

  (* Output current step and timer *)
  WriteLn(CONCAT("Second ", INT_TO_STRING(i), ": ", Step, " (Timer: ", INT_TO_STRING(Timer), ")"));
END_FOR
END_PROGRAM
OutputSuccess
Important Notes
Timers here are simple counters simulating seconds for each step.
In real PLCs, timers and inputs/outputs are handled by hardware modules.
This example uses a loop to simulate time passing and step changes.
Summary
A washing machine control sequence automates steps like filling, washing, rinsing, and spinning.
Each step runs for a set time, controlled by timers and flags.
PLC programs use simple logic to move from one step to the next automatically.

Practice

(1/5)
1. In a washing machine control sequence, what is the main purpose of using timers?
easy
A. To turn the machine on and off manually
B. To measure water temperature
C. To detect if the door is open
D. To control how long each washing step runs

Solution

  1. Step 1: Understand washing machine steps

    The washing machine runs steps like filling, washing, rinsing, and spinning, each needing a set time.
  2. Step 2: Role of timers in automation

    Timers control how long each step runs automatically without manual intervention.
  3. Final Answer:

    To control how long each washing step runs -> Option D
  4. Quick Check:

    Timers = control step duration [OK]
Hint: Timers set step durations automatically [OK]
Common Mistakes:
  • Confusing timers with manual switches
  • Thinking timers detect door status
  • Assuming timers measure temperature
2. Which of the following is the correct way to represent a step transition in a PLC ladder logic for washing machine control?
easy
A. IF timer_done THEN next_step = TRUE
B. FOR step IN sequence DO run()
C. while(timer < max) { step = next }
D. switch(step) { case timer: run }

Solution

  1. Step 1: Identify PLC ladder logic style

    PLC ladder logic uses conditions like IF timer_done THEN to move to next step.
  2. Step 2: Match correct syntax

    IF timer_done THEN next_step = TRUE uses a simple IF condition to set the next step flag, matching PLC logic style.
  3. Final Answer:

    IF timer_done THEN next_step = TRUE -> Option A
  4. Quick Check:

    IF timer_done THEN next_step [OK]
Hint: Look for IF condition style for PLC step control [OK]
Common Mistakes:
  • Using programming loops not typical in PLC ladder logic
  • Confusing switch-case with PLC logic
  • Using syntax from other programming languages
3. Given this PLC pseudocode for washing machine steps:
step = 1
if step == 1 and timer_done:
    step = 2
elif step == 2 and timer_done:
    step = 3
elif step == 3 and timer_done:
    step = 4

What will be the value of step after three timer_done events?
medium
A. 1
B. 4
C. 3
D. 2

Solution

  1. Step 1: Trace step changes on timer_done events

    Initially step=1. After first timer_done, step=2. After second, step=3. After third, step=4.
  2. Step 2: Confirm final step value

    After three timer_done events, step reaches 4.
  3. Final Answer:

    4 -> Option B
  4. Quick Check:

    3 timer_done events advance step to 4 [OK]
Hint: Count timer_done events to track step increments [OK]
Common Mistakes:
  • Stopping count at 3 instead of 4
  • Confusing elif conditions
  • Ignoring step update after each event
4. Identify the error in this PLC pseudocode snippet controlling washing machine steps:
if step == 1 and timer_done:
    step = 2
if step == 2 and timer_done:
    step = 3
if step == 3 and timer_done:
    step = 4

What problem can occur during execution?
medium
A. Multiple steps may be skipped in one cycle
B. The timer_done flag is never checked
C. Step never changes from 1
D. Syntax error due to missing else

Solution

  1. Step 1: Analyze if statements without else

    All if statements run independently, so if timer_done is true, multiple steps can update in one cycle.
  2. Step 2: Understand effect on step variable

    Step can jump from 1 to 4 in one cycle, skipping intermediate steps.
  3. Final Answer:

    Multiple steps may be skipped in one cycle -> Option A
  4. Quick Check:

    Separate ifs cause multiple step changes [OK]
Hint: Use elif to prevent multiple step changes [OK]
Common Mistakes:
  • Assuming only one if runs per cycle
  • Ignoring need for exclusive conditions
  • Thinking timer_done is unchecked
5. You want to add a safety check to the washing machine PLC program to prevent spinning if the door is open. Which logic addition correctly implements this?
hard
A. if door_open and step == 'spin': skip spinning step
B. if step == 'spin' or door_open: start spinning immediately
C. if door_closed and step == 'spin' and timer_done: proceed to next step
D. if door_closed or step != 'spin': stop the machine

Solution

  1. Step 1: Understand safety requirement

    Spinning should only happen if the door is closed to avoid accidents.
  2. Step 2: Choose logic that checks door status before spinning

    if door_closed and step == 'spin' and timer_done: proceed to next step checks door_closed before allowing spinning step to proceed, ensuring safety.
  3. Final Answer:

    if door_closed and step == 'spin' and timer_done: proceed to next step -> Option C
  4. Quick Check:

    Door closed required before spin step [OK]
Hint: Check door_closed before spinning step [OK]
Common Mistakes:
  • Using OR instead of AND allowing unsafe spin
  • Skipping spin step without proper condition
  • Stopping machine incorrectly on door status
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard