Family edition
PLC Lab: Count It, Sort It, Counters and Latches on a Packing Line
In PLC Lab your teen programs a pretend packing line: count six boxes into each case, then sort metal cans from plastic tubs. Nothing in the app drives real hardware.
What you need
- A computer or Chromebook with a current browser.
- The link: mytekdev.com/try/plclab?lesson=count-it-sort-it&ref=fam-plclab-3. No account, no email and nothing to install.
Before you start: try it once yourself
Open mytekdev.com/try/plclab?lesson=count-it-sort-it&ref=fam-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.
The ideas, in plain words
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. Children 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.
Do it together
- Open mytekdev.com/try/plclab?lesson=count-it-sort-it&ref=fam-plclab-3 together and press Run the shift. Watch the end of the line.
You'll know it worked when: Six boxes land in the case and six fall on the floor.
- Follow the hints on the right to add a Counter named Count with a preset of 6, and stop the belt when it is done.
If you get stuck: Show me how gives the exact moves.
You'll know it worked when: The belt stops at six.
- Light the CaseFull lamp from Count.DN, and clear the count on Reset with Reset to zero (under More). Run the shift.
You'll know it worked when: Twelve boxes, two cases, nothing on the floor.
- Pick Job 4, Sort the Metal, and run the shift with the program it starts with.
You'll know it worked when: The pusher fires too early, and no can reaches the metal bin.
- Use Set to remember a can, push it at the eye, and Reset at the end of the stroke. Run the shift.
You'll know it worked when: Four cans in the metal bin, four tubs ride on.
- Talk it over: why does the remembered can get forgotten when the pusher is all the way out, and not sooner?
You'll know it worked when: Your teen explains that PusherOut proves the push happened.
Talk about it
Ask these while you work together. A child who has understood it 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?
For younger and older kids
Younger: For a younger teen, finish Job 3 and stop there.
Older: For an older teen, try Job 9, Rush Hour, where the parts come twice as close together.
Keep going
- 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?
Bring it into other subjects
- 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.
For your records
Ready to copy into an hour log, a portfolio or a transcript.
| Lesson | PLC Lab: Count It, Sort It, Counters and Latches on a Packing Line |
|---|---|
| Subjects | Career and technical education, Engineering |
| Time | 45 minutes |
| What we did | Programmed a simulated packing line with an up counter and reset to fill cases of six, and sorted metal from plastic by latching a sensor reading until the part reached a pusher. |
| Skills practiced | PLC counters; Latch and unlatch logic; Sensors |
PLC Lab: Count It, Sort It, Counters and Latches on a Packing Line
Activity sheet (optional)
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?
Quick check
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?
Answers
| 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. |
If your state or umbrella school asks, this lesson covers Texas Programmable Logic Controller II (innovative course N1303690) (2)(C), Texas Programmable Logic Controller II (innovative course N1303690) Recommended activity, Texas Programmable Logic Controller I (innovative course N1303689) (6)(B), Texas Programmable Logic Controller I (innovative course N1303689) (6)(D), Massachusetts Robotics and Automation Engineering Technology, July 2025 Standard 9, PMMI Mechatronics: Programmable Logic Controllers 1 PLC 1 competency, PMMI Mechatronics: Programmable Logic Controllers 1 PLC 1 competency, SACA C-207 Programmable Controller Systems 1 C-207 key skills, CSTA 2017 3A-AP-16.