High-speed automatic cartoning machines are increasingly used in modern manufacturing for enhanced productivity and packaging quality. This study presents the design and implementation of a compact, student-friendly, and cost-effective automatic cartoning system based on the Siemens S7-1200 PLC and advanced motion control techniques. The system includes a stepper motor-driven conveyor, an AC servo for precise positioning, and an automated glue spraying unit, all managed via TIA Portal V17. Experimental evaluation shows the prototype achieves a packaging rate of 10 boxes/min, position accuracy of ±0.4 mm, system cycle time of 2.0 ± 0.3 s, glue application error below 1.2%, mean error recovery time of 3.5 s, machine up-time of 99.1% over 8 hours, user setup time <10 min, and energy consumption of 35W per cycle. Comparison with commercial solutions indicates comparable performance at 40% lower cost. The results confirm the effectiveness of the proposed model for education and suggest potential for further optimization in fault tolerance and mechanical robustness.