PLC Lab: Count It, Sort It, Counters and Latches on a Packing Line
In Job 3 boxes drop into a shipping case that holds six. The program the job opens with never counts them, so six land in the case and six on the floor. Students add an up counter on the case eye, stop the belt at six, light the Case full lamp so the crew comes to swap the case, and clear the count when the crew presses Reset. In Job 4 the metal sensor is half a meter up the belt from the pusher, so the program has to remember a can until it arrives: a Set (latch) when the sensor sees it, a push at the eye, and a Reset (unlatch) when the pusher reaches the end of its stroke.
At a glance
Essential question
How does a PLC keep track of something it can no longer see?
Objectives
Students will be able to:
- use an up counter to count parts, and explain why it counts each part once
- clear a counter with a reset rung driven by an operator's button
- remember an event with a latch (Set) and forget it with an unlatch (Reset)
- choose the input that should reset a remembered bit, and explain the choice
Vocabulary
Up counter (CTU), Rising edge, Reset to zero (RES), Set (latch), Reset (unlatch)
Standards
(2)(C), Recommended activity, (6)(B), (6)(D), Standard 9, PLC 1 competency, PLC 1 competency, C-207 key skills, 3A-AP-16
Time and materials
45 minutes, grades 10-12.
- One computer or Chromebook per student
- A projector
- The worksheet and exit ticket, one copy each per student
- The rubric, one copy per student if you grade the work
Prep
Make copies of the worksheet and exit ticket. Before class, open mytekdev.com/try/plclab?lesson=count-it-sort-it&ref=tpt-plclab-3 once on a student computer: it opens on Job 3, Build it. Follow the short guide yourself through Job 4, about fifteen minutes. Nothing in the app drives real hardware.
Assessment
- Formative: the questions under What to look for, asked while students work, and the exit ticket (answer key included).
- Summative: the worksheet, scored with the rubric.
Technology and privacy
Runs in any browser, Chromebooks included, with nothing to install. Students need no account and no email: the link works signed out, and nothing they do is stored on our server unless they choose to save. Nothing in the app drives real hardware. If a computer cannot draw the 3D station, the program still runs, and the lamps in the wiring list show what it does.
mytekdev.com/try/plclab?lesson=count-it-sort-it&ref=tpt-plclab-3mytekdev.com/tools/plc-lab/lessons/count-it-sort-it/startEach student gets their own copy, and the same link reopens it next time. How to set up a classLesson sequence
| Minutes | Stage | What you do | What students do |
|---|---|---|---|
| 0 to 5 | Warm-up Hook | Show the title, essential question and Today I can slides (about 1 minute). Then the warm-up: a door counter and a person who stands in the doorway. | Answer the warm-up on the worksheet. |
| 5 to 12 | Direct instruction (I do) Model it | Project Job 3 and press Run the shift with the program it starts with: six boxes in the case, six on the floor. Show Six to a case and One box, one count. Press Slow scan, turn the line on, press Start, and let the class watch the case eye go OFF for a moment as a box drops in. Do not build the counter. It's working when: Ask who the Case full lamp is for. The crew is not watching the case; the lamp is how the machine asks a person for help. | Watch, fill in the vocabulary, and write what the first shift did on the worksheet. |
| 12 to 24 | Guided practice (We do) Job 3 | Students open the link or scan the QR code. The guide and the hints on the right build it one piece at a time: a Counter named Count, preset 6, on a normally closed Eye; a normally closed Count.DN in the Motor rung; Count.DN to the CaseFull coil; Reset to Reset to zero (RES, under More) on Count. Then Run the shift: twelve boxes, two cases. Watch for: Students with no Reset rung. The first case fills and the belt never starts again: the done bit stays on until something clears the count. Watch for: Students who stop the belt at six but never light Case full. The crew never comes, and the result says so. | Follow the guide and fill in the Job 3 rows of the table on the worksheet. |
| 24 to 39 | Independent practice (You do) Job 4 | Students pick Job 4, Sort the Metal, and run the shift with its starting program: the pusher fires while the can is still at the metal sensor, and no can reaches the metal bin. They Set a bit, IsMetal, on Metal; Set Pusher on a normally closed Eye with IsMetal; and on PusherOut, Reset Pusher and Reset IsMetal. Walk the room with the What to look for questions. If they ask: "Why is IsMetal reset when PusherOut turns on, and not when the eye clears?" Which input resets it Watch for: Students who never reset IsMetal. A tub ends up in the metal bin: the bit is still on from the last can. | Build Job 4, run the shift, and fill in the Job 4 rows and the questions on the worksheet. |
| 39 to 45 | Closure Share and exit ticket | Show Back to the question. Take answers: Reset clears the count because the crew has swapped the case; PusherOut clears IsMetal because it proves the push happened. Hand out the exit ticket. | Answer the exit ticket. |
Before you teach: a fifteen-minute walkthrough
Open mytekdev.com/try/plclab?lesson=count-it-sort-it&ref=tpt-plclab-3. A short guide opens over Job 3, Fill a Case, on the Build it tab. At the end of the belt, boxes drop into a shipping case that holds six; an eye across the case mouth sees each one fall in.
- The wiring list. Start, Stop and Motor, plus Reset at %IX0.2 (the yellow button), Eye at %IX0.3 (through-beam, OFF for a moment as each box drops in) and CaseFull at %QX0.1, a lamp on the panel.
- The starting program. The seal-in and the belt. Run the shift: twelve boxes, six in the case, six on the floor.
- Job 3's answer. A normally closed Eye to a Counter named Count, preset 6; normally open Reset to Reset to zero (RES, under More) on Count; normally closed Count.DN in the Motor rung; Count.DN to CaseFull. The crew swaps the case after Case full lights, then presses Reset.
- Job 4. Pick Sort the Metal. Metal at %IX0.2 (an inductive sensor: it cannot see plastic), Eye at %IX0.3 in front of the pusher, PusherOut at %IX0.4 (a reed switch at the end of the stroke), and Pusher at %QX0.1 (a single solenoid valve; a spring brings it back). Eight parts, four cans and four tubs. The starting program pushes on Metal, while the can is still far up the belt: no can reaches the bin.
- Job 4's answer. Normally open Metal to Set IsMetal (a new bit); normally closed Eye and normally open IsMetal to Set Pusher; normally open PusherOut to Reset Pusher and Reset IsMetal.
Background for the teacher
A box blocks the case eye for about 150 ms, which is 15 scans at 10 ms. A counter that counted every scan the rung was true would count 15. Counters count the rung turning true, the rising edge, so one box is one count. Students who have used a loop counter in a programming class often expect the other answer.
A counter's done bit stays on until something resets the count. Here that is the crew's Reset button, after they have swapped the case. In this app, as in OpenPLC, the count stops at the preset; an Allen-Bradley counter keeps counting past it with done still on. Both stop the belt here.
Job 4's pusher is a single solenoid valve: ON pushes, and a spring brings it back. Set holds it out until PusherOut, the reed switch at the end of the stroke, proves the push is done and resets it. The same input resets IsMetal, because the can that bit stood for has now been pushed.
What to look for
Ask these while students work. A student who has understood the lesson can answer them without help:
- A box blocks the eye for 15 scans. Why does the counter count it once?
- What turns Count.DN off again, and when?
- Who is the Case full lamp for?
- Why can the pusher not fire the moment the metal sensor sees a can?
- Why is IsMetal reset by PusherOut, and not when the eye clears?
Cross-curricular extensions
- Math: the belt moves at 0.12 m per second and the metal sensor is 0.5 m before the pusher. How long does a can take to get there?
- Physics: look up how an inductive proximity sensor detects metal, and why it cannot see a plastic tub.
- Business: a case holds six. How many cases does a shift of 1,000 boxes fill, and how many swaps does the crew make?
- Careers: look up what a packaging line operator and a maintenance technician each do when a Case full lamp lights.
Vocabulary
| Up counter (CTU) | Adds one each time its rung turns true. Its done bit (Count.DN) turns ON when the count reaches the preset. |
| Rising edge | The moment a signal goes from OFF to ON. A counter counts edges, not scans. |
| Reset to zero (RES) | An instruction that sets a counter or timer back to zero. Allen-Bradley calls it RES. |
| Set (latch) | Turns a bit ON when its rung is true, and leaves it ON after the rung goes false. Allen-Bradley calls it OTL. |
| Reset (unlatch) | Turns a latched bit OFF when its rung is true. Allen-Bradley calls it OTU. |
Differentiation
English learners
- Keep the vocabulary slide up, and point at the lamp in the wiring list or the instruction on the ladder as you say each word: the picture carries the meaning.
- Pair Set and Reset with a light switch you flip on and leave, and flip off later; pair the counter with a door clicker.
- Give the reset rule as a frame: I reset ______ when ______, because ______.
Students with IEPs or 504 plans
- Pair students, one building and one calling out the count from the ladder.
- Turn on Big screen to watch the case and the pusher.
- Where the IEP allows a modified assignment, finish Job 3 only and score the first two rubric rows.
Students who need more support
- Build the counter rung together on the board, then let students add the stop, the lamp and the reset.
- Press Show me how in the hint box for each step.
- Give the Job 4 rungs on a card in words: Metal sets IsMetal; Eye blocked and IsMetal sets Pusher; PusherOut resets both.
Students ready for more
- On Job 3, turn on Slow scan while a box drops in and count the scans the eye stays OFF. Then set the scan time to 100 ms under Line settings: does the counter still see every box?
- Job 3's Fix the line: after the first case the line never starts again, even after Reset. Find it.
- Job 9, Rush Hour, is Job 4 with parts twice as close. Why can one remembered bit not hold two parts?
Adapting for other grades
Younger students: In grade 9, build Job 3 together on the board, one rung at a time, and stop when two cases fill. Skip Job 4. Score the first two rubric rows, total 8, and 6 meets the objectives.
Older students: In a second-year PLC course, go on to Job 9, Rush Hour, where a shift register replaces the one remembered bit, and compare the two programs.
PLC Lab: Count It, Sort It, Counters and Latches on a Packing Line
Student worksheet
Name: ______________________________ Date: ______________
Open the app: scan the QR code, or go to mytekdev.com/try/plclab?lesson=count-it-sort-it
Essential question: How does a PLC keep track of something it can no longer see?
Warm-up: A door counter and a person standing in the doorway: how many counts, and why? ________________________
- Vocabulary. Up counter, rising edge, reset to zero, set (latch), reset (unlatch): write each in your own words.
- First shift. With the program Job 3 starts with: ______ boxes in the case, ______ on the floor.
- Job 3. The contact that counts a box: ________ The contact that stops the belt: ________ The input that clears the count: ________
- Job 4. The input that sets IsMetal: ________ The two contacts that push: ________ The input that resets Pusher and IsMetal: ________
- Shifts. Job 3 passed (circle): yes no Job 4 passed (circle): yes no
1. A box blocks the eye for about 15 scans. Why does the counter count it only once?
2. Why is IsMetal reset when PusherOut turns on, and not when the eye clears?
PLC Lab: Count It, Sort It, Counters and Latches on a Packing Line
Exit ticket
Name: ______________________________
1. A counter's preset is 6. After the sixth box, what turns its done bit off again? (A) the next box (B) a reset of the count (C) turning the line off
2. A bit is Set when the metal sensor sees a can and never Reset. What happens to the next tub? (A) it rides on (B) it is pushed into the metal bin (C) the belt stops
3. Why does a counter count each box once, even though the box blocks the eye for many scans?
Answer key: exit ticket
| Question | Answer | Why |
|---|---|---|
| 1 | B | The done bit stays on until the count is reset. In Job 3 the crew's Reset button clears it with RES. |
| 2 | B | The bit still says a can is coming, so the pusher fires on the next part at the eye, can or tub. |
| 3 | Open answer | A counter counts its rung turning true, the rising edge, not each scan the rung stays true. |
Worksheet: what students should find
| Blank | What the app shows |
|---|---|
| First shift | 6 in the case, 6 on the floor. |
| Job 3 | Counts on a normally closed Eye (counting on a normally open Eye, as the beam comes clear, also passes). Stops on a normally closed Count.DN. Reset clears the count. |
| Job 4 | Metal sets IsMetal. A normally closed Eye and a normally open IsMetal set Pusher. PusherOut resets Pusher and IsMetal. |
| Common failures | No Reset rung: the first case fills and the belt never starts again. No Case full lamp: the crew never comes. IsMetal never reset: a tub goes in the metal bin. |
Rubric
Score each row from 1 to 4.
Name: ______________________________
| Criteria | 4 Exceeds | 3 Meets | 2 Approaching | 1 Beginning |
|---|---|---|---|---|
| The counter | Passes Job 3 on three shifts and explains why one box counts once, using the edge. | Passes a Job 3 shift: counter, stop at six, Case full and Reset. | Counts the boxes but the belt does not stop, the lamp never lights, or Reset does nothing. | No counter. |
| Latch and unlatch | Passes Job 4 and explains what would go wrong with each other reset input. | Passes a Job 4 shift with Set and Reset. | Uses Set but never resets, so tubs go in the metal bin, or the pusher stays out. | The pusher fires at the metal sensor. |
| Explaining the reset | Explains both resets in terms of what each input proves about the machine. | Says which input resets the counter and which resets IsMetal, and why. | Names the inputs but not why. | Cannot say what resets either. |
Total: ____ / 12. A score of 9 or more meets the objectives.
Standards
The lesson addresses the counter and latch lines of Texas's Programmable Logic Controller I and II courses, and the matching lines in Massachusetts's Standard 9, PMMI's PLC 1 list and SACA C-207. It is practice for these skills on a simulated station, not a replacement for time on a real trainer.
| Framework | Code | Grades | Standard | How the lesson meets it |
|---|---|---|---|---|
| Texas Programmable Logic Controller II (innovative course N1303690) | (2)(C) | 11-12 | apply the use of a counter to determine the number of input occurrences; | Job 3 counts each box that drops past the case eye, six to a case. |
| Texas Programmable Logic Controller II (innovative course N1303690) | Recommended activity | 11-12 | Write a ladder logic program to create a conveyor system that uses sensors. | Job 3 runs on a case eye; Job 4 on a metal sensor, an eye and a reed switch. |
| Texas Programmable Logic Controller I (innovative course N1303689) | (6)(B) | 10-12 | display, explain, and justify the use of relay logic instructions, including Examine if Closed (XIC), Examine if Open (XIO), Output Energized (OTE), Output Latched (OTL), and Unlatched (OUT) within a ladder logic program; | Job 4 uses Set and Reset (OTL and OTU in the Allen-Bradley labels) and students justify which input unlatches each bit. |
| Texas Programmable Logic Controller I (innovative course N1303689) | (6)(D) | 10-12 | generate ladder logic instructions for a given basic task; | Each job is a task in words (count six to a case, sort the cans); students write the rungs. |
| Massachusetts Robotics and Automation Engineering Technology, July 2025 | Standard 9 | 9-12 | Develop PLC programs using functions such as delay and retentive timers, counters, program control instructions (Master Control Reset, Jump, and Subroutines), data manipulation, data comparison, basic math functions, sequencer and shift register instructions, and programming blocks for analog inputs/outputs and PID control. | Students develop programs with counters (Job 3). The other functions in the line are taught elsewhere in the app, not in this lesson. |
| PMMI Mechatronics: Programmable Logic Controllers 1 | PLC 1 competency | Entry-level technicians | Enter and edit a PLC program that uses a Count Up instruction | Job 3: students enter a CTU with a preset and a reset rung. |
| PMMI Mechatronics: Programmable Logic Controllers 1 | PLC 1 competency | Entry-level technicians | Describe the function and operation of PLC seal-in and latch logic | Job 4 latches IsMetal and Pusher, and students explain when each is unlatched. |
| SACA C-207 Programmable Controller Systems 1 | C-207 key skills | Industry credential | Interpreting basic and intermediate level PLC ladder logic programs (with contacts, coils, timers, counters, math, comparison instructions); interpreting common PLC program logic applications using electro-pneumatic actuators and on/off motor control systems. | Students interpret and write counter logic, and latch logic driving an electro-pneumatic pusher. |
| CSTA 2017 | 3A-AP-16 | 9-10 | Design and iteratively develop computational artifacts for practical intent, personal expression, or to address a societal issue by using events to initiate instructions. | Each box at the eye and each can at the sensor is an event that starts instructions; students revise the program from each shift's result. |
Checked November 2026 against: Texas Education Agency: Programmable Logic Controller I, innovative course (2020-2021), Texas Education Agency: Programmable Logic Controller II, innovative course (2021-2022), Massachusetts DESE: Robotics and Automation Engineering Technology Standards and Skills (July 2025), PMMI: Programmable Logic Controllers (PLCs) 1 certification test, Polk State College: PMMI PLC 1 competency list, O*NET: SACA C-207 Programmable Controller Systems 1, CSTA K-12 Computer Science Standards, Revised 2017.
Optional: save student work in a free class
The whole lesson runs at the link on the worksheet, with no accounts and no sign-up.
To keep students' work, and see it all in one place, make a free class. It takes about ten minutes, once, and covers every lesson in this series: mytekdev.com/tools/class-setup
Students in a class open mytekdev.com/tools/plc-lab/lessons/count-it-sort-it/start instead of the worksheet link. Each one gets their own copy of the starter, and the same link reopens it next time.