Exercises
104 PLC programming exercises, beginner to expert. Solve in your browser, graded by automated tests. 20/104 built.
| # | Title | Difficulty | Status | Summary |
|---|---|---|---|---|
| 1 | Lamp Follow | easy | Turn on a lamp while a push button is pressed and off when released. | |
| 2 | Lamp Inverted | easy | Turn off a lamp while a push button is pressed and on when released. | |
| 3 | Two-Button Lamp | easy | Turn on a lamp only when both push buttons are pressed at once. | |
| 4 | Either-Button Lamp | easy | Turn on a lamp when either push button is pressed and off when both are released. | |
| 5 | Select Between | easy | A BOOL select input chooses between two inputs to route to the output. | |
| 6 | Start/Stop Motor | easy | Latch a motor running on Start press and drop it on Stop press. | |
| 7 | Press-Toggle Lamp | easy | Flip the lamp state on each rising edge of the push button. | |
| 8 | Rising Edge | easy | Produce a single-scan pulse on every 0-to-1 transition of a BOOL input. | |
| 9 | Count Up | easy | Up-counter with a count input, reset, and a Done output that fires when count reaches 10. | |
| 10 | Count Up Down | easy | Bidirectional counter with separate Up and Down inputs that tracks a running balance. | |
| 11 | Batch Counter | easy | Pulse BatchReady every 5 trigger events and track the running batch count. | |
| 12 | On Delay | easy | Drive the output high once the input has stayed high continuously for 1 second. | |
| 13 | Off Delay | easy | Keep the output high for 2 seconds after the input goes low. | |
| 14 | Flasher | easy | Flash the output at 1 Hz (1 second on, 1 second off) while enable is high. | |
| 15 | Scale | easy | Scale a sensor reading from 4-20 mA into a 0-100 °C output. | |
| 16 | Clamp | easy | Constrain a numeric input between 0 and 100. | |
| 17 | Sign Check | easy | Output Negative, Zero, and Positive flags by comparing a numeric input to zero. | |
| 18 | Debounce | medium | Filter contact bounce by ignoring input transitions shorter than a preset time. | |
| 19 | Hysteresis | medium | Set the output true at the high setpoint and false at the low setpoint to avoid chatter. | |
| 20 | Traffic Light Simple | medium | Drive a one-way traffic light through red, green, and amber phases on a timer. | |
| 21 | Clamp with Overflow | medium | coming | Constrain a numeric input between Min and Max bounds and raise flags when limits are hit. |
| 22 | Count Up Down with Bounds | medium | coming | Bidirectional counter with upper and lower bounds, and flag outputs when the limits are hit. |
| 23 | Scale (Configurable) | medium | coming | Linearly scale a raw input to engineering units between two tunable endpoints. |
| 24 | Compare Pair | medium | coming | Output Less, Equal, and Greater flags by comparing two numeric inputs. |
| 25 | Xor Gate | easy | coming | Turn on a lamp when exactly one of two push buttons is pressed and off otherwise. |
| 26 | Voting Lamp | easy | coming | Light a lamp when at least two of three push buttons are pressed. |
| 27 | Falling Edge | easy | coming | Produce a single-scan pulse on every 1-to-0 transition of a BOOL input. |
| 28 | Pulse | easy | coming | Produce a 1-second output pulse on each rising edge of the trigger input. |
| 29 | Long Press | medium | coming | Fire a single-scan pulse when the input is released after being held continuously for at least 2 seconds — short taps produce no output. |
| 30 | Watchdog Alarm | medium | coming | Raise an alarm if the heartbeat input fails to pulse within the timeout. |
| 31 | Run Hours | medium | coming | Accumulate the run time of a BOOL input in seconds with a manual reset. |
| 32 | Delayed Shutdown | medium | coming | Hold the run-OK output high for a cooldown period after Stop is pressed. |
| 33 | Rate of Change | medium | coming | Output the rate of change of an analog input in engineering units per second. |
| 34 | Streaming Average | medium | coming | Compute a rolling average over the last N samples streamed one per scan. |
| 35 | Min Max Tracker | medium | coming | Track the minimum and maximum of an analog input until a Reset input is pulsed. |
| 36 | Energy Meter | medium | coming | Integrate a power input over time to produce accumulated energy with a manual reset. |
| 37 | Level Alarm | medium | coming | Produce Hi and Lo alarm outputs around setpoints with a deadband to avoid chatter. |
| 38 | Tank Fill | medium | coming | Open a fill valve until the tank level reaches the setpoint and close within deadband. |
| 39 | Temp Controller | medium | coming | Run an on-off temperature controller using hysteresis around a setpoint. |
| 40 | Ramp | medium | coming | Ramp the output from its current value to the target at a given rate per second. |
| 41 | VFD Speed Ref | medium | coming | Convert an operator percent (0 to 100) into a raw VFD speed reference. |
| 42 | Lead Lag | medium | coming | First-order lead-lag filter for process modeling, smoothing, and feedforward control. |
| 43 | Pump Duty | medium | coming | Alternate two pumps in lead and lag roles based on accumulated run hours. |
| 44 | Dosing | medium | coming | Pulse a dispenser until a target weight is reached with overshoot compensation. |
| 45 | Flow Totalizer | medium | coming | Integrate a flow rate input to produce a totalized volume with a manual reset. |
| 46 | Boiler Interlocks | medium | coming | Combine pressure, level, and flame inputs into a permissive output for a burner. |
| 47 | Bit Pack | easy | coming | Pack sixteen BOOL inputs into a DINT output with each input mapped to a bit. |
| 48 | Bit Unpack | easy | coming | Unpack a DINT input into sixteen BOOL outputs, one per bit position. |
| 49 | Mux 4 | easy | coming | A two-bit select input chooses one of four inputs to route to the output. |
| 50 | Demux 4 | easy | coming | An input is routed to one of four outputs based on a two-bit select input. |
| 51 | Encoder 8 to 3 | medium | coming | Encode eight BOOL inputs as a three-bit index of the highest active input. |
| 52 | Abs Value | easy | coming | Output the absolute value of a REAL input with a separate sign flag output. |
| 53 | Modulo | easy | coming | Compute the integer modulo of two inputs with proper handling of negative dividends. |
| 54 | Stream First Above | medium | coming | Output the index of the first streamed sample to exceed a threshold. |
| 55 | Sequencer 3-Step | medium | coming | State machine stepping through Idle, Running, and Done states from Start and Reset inputs. |
| 56 | Wash Cycle | medium | coming | Four-step Fill, Mix, Drain, and Idle wash cycle with Pause, Resume, and Reset. |
| 57 | Traffic Light 2-Way | medium | coming | Drive a two-direction traffic intersection with an all-red gap between phases. |
| 58 | Pedestrian Crossing | medium | coming | Add a pedestrian-request button to a two-way traffic light without breaking the cycle. |
| 59 | Drawbridge | hard | coming | Control a drawbridge through bells, barriers, raise, and reverse with sensor-gated transitions. |
| 60 | Elevator 3-Floor | hard | coming | Control a three-floor elevator with call buttons, current floor output, and direction logic. |
| 61 | Bottle Station | hard | coming | Detect, stop, fill, cap, and eject bottles on a re-entrant station conveyor. |
| 62 | Drill Cycle | hard | coming | Two-hand-start drill cycle that descends, dwells, and retracts with a release-stops-cycle rule. |
| 63 | Recipe Batch | hard | coming | Execute a four-step recipe with per-step time and temperature parameters and a Done flag. |
| 64 | Emergency Shutdown | hard | coming | Layered shutdown with light-fault soft-stop, hard-fault hard-stop, and a chained all-stop output. |
| 65 | Streaming Sum | medium | coming | Accumulate a running total of streamed samples with a manual reset. |
| 66 | Sliding Max | medium | coming | Output the maximum of the last N streamed samples in a sliding window. |
| 67 | FIFO | medium | coming | First-in-first-out queue with Push, Pop, Out, and Full, Empty, and Count outputs. |
| 68 | LIFO | medium | coming | Last-in-first-out stack with Push, Pop, Peek, and Top, Count, and Empty outputs. |
| 69 | Ring Buffer | medium | coming | Fixed-size ring buffer with overwrite-oldest behavior and status outputs. |
| 70 | Recipe Select | medium | coming | Select one of ten recipes by index and output the selected recipe parameters. |
| 71 | Alarm History | medium | coming | Latch alarms, accept operator ack, and keep a sixteen-deep history of events. |
| 72 | Motor Bank Stats | medium | coming | Aggregate run count, fault count, and max-hours index across eight motor inputs. |
| 73 | Lookup Fixed | medium | coming | Linear interpolation through a fixed (X, Y) curve table set at design time. |
| 74 | Event Stats | medium | coming | Push events with a code and output last code, total event count, and oldest code. |
| 75 | Motor Starter | medium | coming | Motor starter with Start, Stop, Reset, and Auto inputs producing Run and Faulted outputs. |
| 76 | Conveyor Section | medium | coming | Energy-saving conveyor with upstream-edge start, downstream-edge stop, and a manual override. |
| 77 | Pump Station 3 | hard | coming | Three-pump duty, standby, and standby station with run-hour rotation and fault transfer. |
| 78 | Mixer Tank | hard | coming | Combine agitator, heater, level control, and recipe time into a mixing tank controller. |
| 79 | Diverter Gate | hard | coming | Three-way conveyor diverter routed by an upstream classifier signal and a presence sensor. |
| 80 | Indexing Table | hard | coming | Rotary indexing table with Home, Step, and Fault states plus a position output. |
| 81 | Lubrication Cycle | hard | coming | Periodic lubrication pulse generator with skip-on-fault and run-condition gating. |
| 82 | Burner Control | hard | coming | Burner control state machine through Purge, Ignite, Run, and Lockout states with safety inputs. |
| 83 | Pallet Stop | hard | coming | Pallet-stop conveyor block with raise and lower cylinders, presence sensors, and escape logic. |
| 84 | Zone Controller | hard | coming | Material-flow zone controller with upstream and downstream handshake signals. |
| 85 | Parking Garage | hard | coming | Run entry and exit counters, a full sign, gate control, and capacity for a parking garage. |
| 86 | Bag Filler | hard | coming | Weigh, fill to target, reject overweight bags, and count batches on a packaging line. |
| 87 | Washing Machine | hard | coming | Programmable wash cycle: fill, agitate, drain, and spin with door interlock and fault holding. |
| 88 | Injection Molder | hard | coming | Clamp, inject, cool, and eject sequence with pressure and temperature permissives per step. |
| 89 | Railway Crossing | hard | coming | Detect approach, lower barriers, hold, and raise with a safety check at end of cycle. |
| 90 | Wastewater Station | hard | coming | Wastewater pump alternation with high-level alarm, dry-run protection, and comm-fault handling. |
| 91 | Stacker Crane | hard | coming | Run an XY stacker crane to a target slot, pick from infeed, and deliver to the bin row. |
| 92 | Batch Reactor | hard | coming | Multi-step batch reactor with operator confirms, hold-on-fault, and end-of-batch reporting. |
| 93 | Wind Turbine Yaw | hard | coming | Yaw controller aligning to wind direction with hysteresis, cable-wind protection, and override. |
| 94 | Bottling Line | hard | coming | Coordinate infeed, fill, cap, label, and palletize stations on a bottling line. |
| 95 | Alarm Shelving | medium | coming | Alarm with shelve, ack, and unshelve states plus a reactivation timer and operator inputs. |
| 96 | Mode Manager | medium | coming | Manual, Auto, SemiAuto, and Fault state manager with a mode-id output and transitions. |
| 97 | Bumpless Swap | hard | coming | Swap from manual to automatic control without a setpoint kick at the transition. |
| 98 | Deadband Plus | medium | coming | Tunable filter combining deadband, hysteresis, and rate limiting in one block. |
| 99 | Leaky Bucket | hard | coming | Rate limiter that counts pulses, drains over time, and outputs Allowed and Level. |
| 100 | First Out Fault | hard | coming | Latch the first of N fault inputs to fire and output the index with the latched flag. |
| 101 | Moving Median 3 | medium | coming | Output the streaming median of the last three samples to reject outlier spikes. |
| 102 | Rate Limited Ramp | medium | coming | Track an input target but move the output no faster than a given rate per second. |
| 103 | Failover Primary | hard | coming | Primary and secondary source selector with hysteresis and per-source health flags. |
| 104 | Dual Heartbeat | hard | coming | Watchdog with two heartbeat inputs that alarms on either missing and outputs last-seen times. |