Vision-based industrial control with Moku:Go
Combining open-source computer vision solutions with the Moku:Go PID Controller for two-dimensional target tracking
Introduction
Beijing University of Posts and Telecommunications (BUPT), a top-ranked engineering school in China, has a long history of providing high-quality education in communications engineering as well as general electronic and computer engineering. BUPT students used Moku:Go to develop solutions for engineering education, and in particular, control systems.
Moku:Go is Liquid Instruments’ first software-defined instrumentation tailored for engineering education and general industry. The software-defined functionality enables Moku:Go to provide 15+ different instruments used in electronics and telecommunication labs, and with Multi-instrument Mode (MiM), users can combine pairs of instruments to run simultaneously with lossless interconnection.
The students were impressed with the ease of use of the PC-based user interface to the PID Controller, which made tuning and characterization straightforward. They selected the Moku:Go PID Controller as the core of a new solution for hands-on control systems teaching and learning.
The challenge
Control systems education provides a particular challenge. Teaching with real, physical systems is the gold standard for student engagement and retention, but can be expensive and fragile. Some schools invest in this equipment but can only afford one or two plants, which limits student access and their willingness to explore and experiment. Other schools offer the lab curriculum in simulation only, minimizing cost and increasing access at the expense of student experience and industry relevance.
In both scenarios, the limited or nonexistent interaction that students have with real plants limits the level to which they can master the core concepts of control theory, let alone nonideal effects and nonlinearities that can determine whether a control deployment is successful.
In this project, students were challenged to design a cost-effective, robust plant that could help teach control theory. It needed to be accessible to all students, easy to use, and industry relevant.
The solution
Moku:Go provides the ideal platform for control systems education. It’s affordable, robust, and the PID Controller has a best-in-class user interface for exploring control concepts. With Moku:Go selected to provide the control electronics and interface, the students turned to building a controllable mechanical system.
A computer vision-based, two-dimensional ball balancing problem satisfied the design requirements of robustness, cost-effectiveness, accessibility, and industry relevance. Computer vision detection is widely used in process and production control and integrating it in to the solution gives students valuable industry-ready experience. Two-dimensional ball balancing provided the perfect blend of complexity and intuition. The simple design kept the cost down, while students could safely ignore nonideal effects like friction for introductory use but measure and overcome for advanced or extension use.
The open-source OpenMV hardware and software system provided the computer vision system. OpenMV is built around the Python programming language with a selection of computer vision algorithms like blob detection and tracking available for easy integration. OpenMV boards are readily available for less than US$100.
Students programmed the OpenMV board to extract blobs corresponding to the black ball as well as green tracking markers affixed to the table. The markers were used to de-skew the image as the table tilted and allowed the calculation of the ball position on the table. The OpenMV output analog voltages to Moku:Go representing the error in ball position in x and y directions.
The students constructed the ball balance table from 3D printed parts and common servo motors, and connected the servos to Moku:Go through a microcontroller that converted analog outputs to servo position signals[1].
Figure 1: Experimental setup
The result
Students found the resulting system to be both educational and engaging. The Moku:Go desktop application’s live signal traces and measurements allowed them to tune their designs and observe results in real time, making cause-and-effect relationships more obvious and deepening their understanding of the impact of parameter changes.
The system was close enough to ideal that the students could perform theoretical tuning steps and achieve good results. Nonideal effects such as target loss and input and output saturation provided an extra, but optional, challenge. Students could also observe and measure rolling friction, another nonideal effect that necessitated the use of an integrator term in what theoretically could have just been a PD controller.
The instructor could change the scope of the challenge by supplying some design elements while leaving others as student work. For example, when taught in a computer engineering context, the instructor could require the students to write the OpenMV software, while in a mechanical engineering context the OpenMV software may be supplied but the design of the tilt table left as an open problem.
Figure 2: PID Controller interface showing real-time display of x-axis input and output during an applied disturbance
Conclusion
Moku:Go formed the core of a novel teaching system for control engineering at Beijing University of Posts and Telecommunications. The students found the device easy to use, flexible, and intuitive. The addition of computer vision as a detection method gave the instructor the option of expanding the scope of the task to include cross-disciplinary teamwork between computer and control engineering. It also added nonideal effects, like skewing and loss of target, which are commonly found in industry — a link that significantly improved student engagement.
Learn more about Moku:Go and our courseware offerings or reach out directly to our education team at edu@liquidinstruments.com.
[1] Moku Cloud Compile and pulse width modulation in the Waveform Generator were not available at the time the system was designed. For new systems, Liquid Instruments recommends using either of these features in place of the microcontroller to drive the servos.