Skip to content
PLCampus

PLC programming challenges

Test what you have learned with real problems, from the simplest to the most complete. The simulator checks your program automatically with test cases and tells you what was expected at each moment.

Completed: 0 of 22Your progress is stored only in this browser. There are no accounts.

Challenges are solved in the simulator, designed for computers (screens 1024 px or wider).

  1. 01Level 13 test cases

    Turn on a lamp

    The lamp LAMP (Q0.0) must be on only while the push button BUTTON (I0.0) is held down.

    When the button is released, the lamp turns off.

  2. 02Level 13 test cases

    Running and stopped lights

    A machine has a switch MACHINE (I0.0) and two pilot lights on the panel.

    With the switch on, the light LIGHT_RUN (Q0.1) must be on. With the switch off, the light LIGHT_STOPPED (Q0.0) must be on. They must never be on together.

  3. 03Level 14 test cases

    Door bell from two doors

    A warehouse has two doors, each with a push button: DOOR_1 (I0.0) and DOOR_2 (I0.1).

    The BELL (Q0.0) must ring while either button (or both) is pressed.

  4. 04Level 13 test cases

    Two-hand control

    A press may only move down if the operator keeps both hands on the push buttons, away from the danger zone.

    The output PRESS (Q0.0) is on only while LEFT_HAND (I0.0) and RIGHT_HAND (I0.1) are pressed together. Releasing either one stops the press.

  5. 05Level 24 test casesWith virtual plant: Motor with contactor and overload relay

    Start and stop with seal-in

    Program a direct-on-line motor starter. A tap on START (I0.0) starts the motor K1_MOTOR (Q0.0), which keeps running after the button is released.

    STOP (I0.1) is an NC push button: it is 1 at rest and 0 while pressed. Pressing it stops the motor; if START and STOP are pressed together, STOP wins.

    OVERLOAD (I0.2) is the overload relay NC contact, wired to the plant: it is 0 when the motor is overloaded. An overload must stop the motor and keep it from starting again.

  6. 06Level 23 test cases

    Latching alarm

    A smoke detector DETECTOR (I0.0) gives a signal that may last only an instant. As soon as it turns on, the SIREN (Q0.0) must sound and keep sounding even if the detector goes back to 0.

    The operator silences the siren with the push button ACKNOWLEDGE (I0.1). But while the detector is still active, the siren must not turn off.

  7. 07Level 34 test cases

    Fan with start-up warning

    A large fan must not start abruptly. When the switch ON (I0.0) is turned on, the horn WARNING (Q0.1) sounds for 5 seconds first and only then the FAN (Q0.0) starts, while the horn goes silent.

    Turning the switch off stops everything at once. If it is turned off before the 5 seconds are over, the wait starts from zero the next time.

  8. 08Level 33 test cases

    Box counter per batch

    A sensor BOX_SENSOR (I0.0) gives a pulse every time a box passes on the belt. When 5 boxes have passed, the light BATCH_READY (Q0.0) must turn on.

    The light stays on until the operator presses RESET (I0.1), which sets the count back to zero for the next batch.

  9. 09Level 22 test cases

    Timed staircase light

    On a staircase, the PUSH_BUTTON (I0.0) turns the LIGHT (Q0.0) on. The light must stay on for 10 seconds after the button is released and then turn off by itself.

    If someone presses again before it turns off, the 10 seconds start again from the release.

  10. 10Level 33 test cases

    One button for on and off (toggle)

    A single PUSH_BUTTON (I0.0) controls the LIGHT (Q0.0): each press changes its state. If it is off, it turns on; if it is on, it turns off.

    Careful: the program runs hundreds of times while the finger is on the button. A long press must count as a single one.

  11. 11Level 32 test cases

    Flashing light

    While the ENABLE switch (I0.0) is on, the BEACON (Q0.0) flashes: half a second on and half a second off, starting on.

    When ENABLE is switched off, the beacon turns off. Do not use the system clock: build the flashing with timers.

  12. 12Level 33 test cases

    Room occupancy

    A room has a sensor at the ENTRANCE (I0.0) and another at the EXIT (I0.1); each gives one pulse per person. The maximum occupancy is 3 people.

    With 3 or more people inside, ROOM_FULL (Q0.0) turns on. With the room empty, ROOM_EMPTY (Q0.1) turns on. At start-up the room is empty.

  13. 13Level 33 test cases

    Level alarms from an analog signal

    A level transmitter gives its measurement in LEVEL (IW0): 0 = empty tank and 27648 = full (100 %). You can move it with the IW0 potentiometer on the panel.

    Turn HIGH_ALARM (Q0.0) on when the level is above 80 % (more than 22118) and LOW_ALARM (Q0.1) on when it is below 20 % (less than 5530).

  14. 14Level 33 test casesWith virtual plant: Reversing motor

    Reversing with interlock

    A motor turns FORWARD (Q0.0) or in REVERSE (Q0.1) with two contactors. The FORWARD (I0.0) and REVERSE (I0.1) push buttons start each direction with a seal-in; STOP (I0.2, NC) stops the motor.

    The two contactors must never be closed at the same time: it would be a short circuit. To change direction you must stop first. The OVERLOAD relay (I0.3, NC, driven by the plant) also stops the motor.

  15. 15Level 32 test casesWith virtual plant: Tank with pump

    Tank with hysteresis

    With the SYSTEM switch (I0.0) on, the PUMP (Q0.0) keeps the tank between two levels: it starts when the water drops below the LEVEL_LOW switch (I0.2) and stops when it reaches the LEVEL_HIGH switch (I0.3).

    Between the two switches the pump keeps doing what it was doing: if it was filling, it keeps filling; if it was stopped, it stays stopped. That is hysteresis.

  16. 16Level 42 test cases

    Cascade start of three motors

    A line has three motors. Pressing START (I0.0) starts MOTOR_1 (Q0.0); 2 seconds later MOTOR_2 (Q0.1) starts, and 2 seconds after that, MOTOR_3 (Q0.2). This avoids the current peak of starting them all at once.

    STOP (I0.1, NC push button) stops all three motors immediately.

  17. 17Level 42 test cases

    Traffic light cycle

    With the RUN switch (I0.0) on, a traffic light repeats this cycle: GREEN (Q0.2) for 4 seconds, YELLOW (Q0.1) for 1 second and RED (Q0.0) for 3 seconds. The cycle starts on green.

    Exactly one light is always on while it runs. Switching RUN off turns all of them off.

  18. 18Level 42 test casesWith virtual plant: Conveyor belt with boxes

    Belt that stops every 3 boxes

    START (I0.0) sets the BELT (Q0.0) moving. The SENSOR (I0.2, driven by the plant) detects every box that passes. When 3 boxes have passed, the belt stops by itself and BATCH_READY (Q0.1) turns on.

    RESET (I0.1) sets the count back to zero and turns BATCH_READY off; then START begins the next batch.

  19. 19Level 42 test cases

    Inverse analog valve

    With CONTROL (I0.0) on, the VALVE (QW0) must open as much as the tank still needs to fill: if the LEVEL (IW0) is 0 (empty), the valve goes to 27648 (100 % open); with the tank full (27648), the valve goes to 0.

    That is, VALVE = 27648 − LEVEL. With CONTROL off, the valve stays at 0 (closed).

  20. 20Level 43 test casesWith virtual plant: Automatic gate

    Gate with a safety photocell

    OPEN (I0.0) opens the gate (Q0.0) up to the LS_OPEN limit switch (I0.2); CLOSE (I0.1) closes it (Q0.1) down to LS_CLOSED (I0.3). Both movements hold by themselves (seal-in) and never at the same time.

    Safety: if the PHOTOCELL (I0.4, 1 = clear) detects something while closing, the gate stops and opens again. The BEACON (Q0.2) is on while the gate moves.

  21. 21Level 42 test casesWith virtual plant: Electric oven

    Oven thermostat

    With ON (I0.0) active, keep the oven between 95 °C and 105 °C. The TEMPERATURE transmitter (IW0) gives 0–27648 for 0–300 °C (92.16 units per degree): 95 °C ≈ 8755 and 105 °C ≈ 9677.

    The HEATER (Q0.0) turns on below 95 °C and off above 105 °C; between the two values it keeps doing what it was doing. With the oven off, the heater does not heat.

  22. 22Level 53 test casesWith virtual plant: Tank with two pumps

    Backup pump

    With SYSTEM (I0.0) on, the tank is filled between LEVEL_LOW (I0.2) and LEVEL_HIGH (I0.3), as in the tank challenge. Normally PUMP_1 (Q0.0) does the work.

    If PUMP_1 fails (PUMP1_OK, I0.4, goes to 0), PUMP_2 (Q0.1) works instead and the ALARM (Q0.2) turns on. When pump 1 is repaired, it works again and the alarm turns off.

More challenges are coming: the goal is over 20, up to sequences with timers, counters and analog signals.