This article discusses different lab experiences for mechatronics education. Integrated software tools like MATLAB and Simulink and the availability of low-cost hardware are enabling technologies for the development of innovative laboratory and curriculum paradigms. An example of this is the laboratory curriculum developed for the Mechatronics course at Rensselaer, consisting of the Rensselaer Mechatronics Hardware Kit and the associated RASPLib software package, which allow the students to take the laboratory experience out of the classroom and into their dorm rooms. This has created unique opportunities for learning and pedagogy. The Mini Inverted Pendulum project provides students a complete Mechatronics design experience. The end objective is clear: use the motor and sensors in the Mechatronics Kit to balance the pendulum.
As the promise of the “Internet of Things” becomes reality, it is increasingly important to assess what skills and tools an engineer needs to be successful in a world rich with sensors, actuators, embedded computing, and information. While “Mechatronics” originated as the interface of mechanical, electronics, and computing, it has now morphed into a discipline that focuses on a systems-level approach to integration of sensing, actuation, embedded computation, and real-time data flow. Furthermore, it is based on an understanding of how the critical aspects of each domain contribute to the eventual performance of the designed product. Over the past two decades, Mechatronics courseware has been developed in almost every institution of higher learning to integrate with mechanical engineering, electronics and electrical engineering, and robotics curricula (Figure 1).
One of the key challenges in developing such courseware is complementing theoretical analysis and rigor with meaningful experiences that integrate sensors, actuators, and computation in a “hands-on minds-on” way, while fostering intuition and critical problem solving skills. Furthermore, these laboratory experiences should reinforce the value of understanding and interpretation of theoretical ideas.
In an attempt to create such an experience, the Rensselaer Polytechnic Institute developed the Rensselaer Mechatronics Lab Kit as a low-cost take-home laboratory kit. The kit serves as a table-top laboratory with integrated sensors, actuators, and embedded processing. The students can perform a host of laboratory experiments; such as DC Motor modeling and feedback control, parameter identification, serial communication, etc.; culminating in a student project of embedding intelligence into a Mini Inverted Pendulum (see Figure 2).
Rensselaer Mechatronics Kit System Overview
The Rensselaer Mechatronics Lab Kit consists of three key components: a hardware kit that interfaces with a student laptop, analysis and programming software, and the supporting curriculum material as shown in Figure 3 These were developed and integrated keeping in mind student learning objectives, cost economy, and efficiency of deployment as well as maintenance.
Synopsis of Kit: The hardware associated with the kit is a set of typical sensors and actuators (see Table 1) integrated onto an Arduino-based microcontroller that can be connected to the student laptop via a USB cable. Once properly programmed and deployed, the hardware may be operated in a tetherless manner. Students can use MATLAB and Simulink for analysis, control design, and then seamlessly program the Arduino-based microcontroller directly from Simulink.
Although Simulink has basic Arduino support built in, specific applications require custom code or driver blocks . To address this, the Rensselaer Arduino Support Package Library (RASPLib) was developed , which contains packaged code blocks for all the sensors and actuators in the hardware kit. Students can easily drag and drop the blocks, program the hardware with a single click, and can quickly perform experiments or collect data. Finally, the curriculum material consists of a set of take-home laboratory activities and tutorials that cover introductory theory and instructions for validating that theory through simulation or hardware. These activities are intended to be as stand-alone as possible so they can be utilized in different classes, universities, or in different contexts. This curriculum material and the supporting driver library RASPLib are available online . Hardware kit details and a commercialized version of the kits can be found here .
The Design Lab at Rensselaer is a design and manufacturing facility that provides opportunities for students to work on real-world industry-driven projects in close collaboration with faculty, staff, and industrial sponsors. Engineering students at Rensselaer culminate their baccalaureate degree through the Multidisciplinary Capstone Design course, where they work in multidisciplinary teams on open-ended problems.
In 2013, with support from a MathWorks Educational Grant two capstone teams investigated the engineering curriculum at Rensselaer to identify low-cost and simple hardware that could be used in several courses to reinforce engineering concepts through a “take-home laboratory experience”.
The Rensselaer Mechatronics Kit has three main hardware components: an Arduino microprocessor; a suite of sensors including 3-axis accelerometers, 3-axis gyroscopes, 3-axis magnetometers, a potentiometer and an optical encoder for the motor wheel; and a set of actuators including a Lego NXT DC motor and amplifier. Table 1 shows a sampling of the hardware components and the associated cost.
Arduino is an open-source prototyping platform that consists of an Arduino microprocessor board and the supporting software IDE. It has a large support community online with accessible code examples and tutorials. Arduinos (and similar easy-to-use microprocessors) have revolutionized do-it-yourself projects with embedded intelligence. With an Arduino-based microprocessor, different hardware components can be quickly evaluated and thus it is a natural choice for the Mechatronics kit.
Sensor selection is driven primarily by cost, but the cheapest sensors often tend to have well supported software libraries as well. The resulting set of cost effective sensors provide a wide array of sensing for experiments and projects beyond traditional position sensing and control. On the other hand, the primary actuator included in the kit is a DC motor, a ubiquitous actuator with widespread engineering applications. DC motors also provide students with an example of a system with mechanical elements, electrical elements, and electromechanical coupling. An understanding of DC motor principles also provides a framework for other electromechanical systems such as solenoids, voice-coil motors and speakers. The chosen DC Motor, a LEGO NXT motor, is comparatively expensive, but is durable, provides mounting options, has a built in encoder, and also piques student interest. A detailed summary of the selected hardware components is provided in Table 1 and Figures 4 and 5.
In addition to hardware, a critical component of the Mechatronics kit is an integrated software package that enables students to quickly recall the basic principles of programming and teach hardware-software integration without a steep learning curve. MATLAB and Simulink are widely used in the dynamic systems and control community, with a rich library of analysis and design tools. Further, Simulink can be used to directly program the Arduino target, thereby providing a seamless transition from development in the simulation environment to deployment on hardware. The application code can be stand-alone (i.e., deployed in hardware in an embedded manner), or operated in external mode, where the user can visualize data and modify parameters on the system in real time. This helps the students understand the effects of their design choices in real-time and gives them an intuitive understanding of control design. Figure 6 below shows some of the library of blocks (RASPLib) developed for directly interfacing with the sensors and actuators that are part of the Mechatronics kit.
The selected software tools and components include:
MATLAB & Simulink – popular and powerful tools for modeling, control analysis and design
Simulink – as a graphical programing tool
Graphical code is easy to read – code level details are hidden
Programming and development are done at the system level
Easier to share, develop, and maintain across disciplines and projects
External mode allows hardware in the loop testing and real-time visualization of data
Easy to deploy with a single click
Device Drivers or custom blocks for sensors or actuators can be created 
RASPLib – Rensselaer Arduino Support Package Library
Driver blocks for the hardware sensors and amplifiers
Demo/testing files to verify hardware integrity
Communication blocks for fast data acquisition
Mechatronics Lab Kit
The kit was designed to find a cost-effective, widely-deployable and intellectually stimulating solution to address challenges of traditional labs.
Affordable – approximately the cost of a traditional textbook Compact, Portable, USB powered - labs can be performed anytime, anywhere
Versatile – suite of general tools to perform a wide variety of experiments
Array of sensors, a motor driver for actuators, and a capable microprocessor
MATLAB & Simulink - powerful analysis, control and design software tools
Can be used in many other classes or projects
Easy to introduce early in the curriculum
Stimulating and Inspiring – visual and tangible results; the inverted pendulum does something cool!
Laboratory Structure and Organization
Achieving the balance between theory and practice is the Holy Grail for any laboratory-driven course. Students are often well equipped to tackle isolated theory problems, but find it challenging to integrate these tools to realize a final design or product. On the other hand, trial-and-error often becomes the primary methodology for accomplishing experimental outcomes, leading to a general lack of faith in theory. Thus it is critical to establish project objectives that reinforce analysis-based approaches towards design.
The curriculum developed along with the Mechatronics kit consists of the typical coursework: theory, assignments, and in-class testing, but in parallel it has a laboratory component that is primarily completed at home by the students. Throughout the semester they perform stand-alone labs that introduce topics, set up tests and perform experiments that validate theory or experimentally determine unknown parameters. The students learn by guided, yet somewhat open-ended problems. The supporting courseware consists of three core components (see Figure 8).
Technical concepts: these consist of primarily traditional theory, analysis tools and core engineering subjects. The emphasis is on enabling techniques, for example, least squares estimation, which is used ubiquitously for curve fitting in a wide range of engineering problems, and bridging tools like linearization of a nonlinear system to allow the use of linear system theory.
Experiment design: this teaches students how to perform suitable experiments to answer questions and determine unknowns, for example steady state measurements to determine friction, or experiments to calibrate and characterize gyroscope data. This component of the courseware also teaches students to use simulations for predicting responses, or testing and comparing models.
Hardware deployment: this exposes students to the execution of the experiments and the observation or validation of the hypothesis. Furthermore, students learn to observe and model real world system non-idealities such as sensor quantization, saturation, or measurement delays – issues that are often not addressed in the classroom explicitly.
Reconciling Theory with Practice
In the senior Mechatronics course at Rensselaer, the final project involves the design of a controller for stabilizing an inverted pendulum system (see Figure 7 below). Although the students have completed most of the requisite coursework to theoretically solve this problem as part of earlier courses, this challenge identifies the gaps in their knowledge for solving a problem that spans multiple disciplines and thus can often frustrate students. At the end of the term, however, on achieving their goal, the students experience a sense of accomplishment and gain a first-hand understanding of the leap from a page in the textbook to the very non-ideal real-world.
Each lab topic has this same general execution. During this process the students observe how the general theory appears in practice, and how their expected results are affected by the system, like backlash or friction, by the measurement system, such as sensor noise or discretization, and by the computation, things like data type and delays. Through this repeated exposure to system, hardware, and software elements, they learn what important aspects of a system they must consider while designing a solution. While traditional lab experiments try to minimize these ‘non-ideal’ phenomena to focus on demonstrating the connecting theory, in contrast this laboratory experience aims to demonstrate how these effects must be accounted for in any effective design solution.
The Mini Inverted Pendulum: A Mechatronics Student Project
The Mini Inverted Pendulum project provides students a complete Mechatronics design experience. The end objective is clear: use the motor and sensors in the Mechatronics Kit to balance the pendulum. A cornerstone of a Mechatronic design approach is the Dynamic System Investigation process, shown in the Figure 9. A student must successfully execute all of these steps to accomplish this objective.
A brief outline of the dynamic system investigation for the inverted pendulum will be presented. A detailed development may be found in .
Physical System Description: A LEGO NXT motor attached to an Arduino Microprocessor and board act as the pendulum. The system has one input, the torque from the wheels, and two outputs to control - the pendulum angle and the position of the wheels
Physical Model: The system is modeled as 2D rigid body consisting of a wheel and a simple pendulum shown in Figure 10. The input to the system is the torque from the motor. Since the amplifier in the Mechatronics Kit is not a torque amplifier the motor must be modeled to determine the torque. The linear motor model is shown in Figure 11.
Mathematical Model: Newton-Euler equations and Kirchhoff s voltage law generate the two coupled nonlinear equations that relate the input torque to the output wheel position and angle position (see Equation 1).
Parameter ID: Experiments are performed to evaluate and determine the system parameters shown in Table 2.
The simulated motor response is compared to experimental response to verify parameter estimates. The students observe that the expected response does not match experimental response due to system nonlinearities and hardware effects. They then iteratively improve the simulation model until it matches the true system to a satisfactory degree.
This controller is then tested on the full nonlinear model. Students observe the effect of the weighting matrices on the system performance and then “tune” the controller to obtain good closed loop performance.
Student Project Outcomes: After completing the student project, the students haveAnalyzed and designed a control system from a free body diagram to a working systemObserved, modeled, and mitigated real world nonlinear system effectsLearned the value of model based Mechatronicdesign – they cannot get the system to balance without itSuccessfully integrated theory, hardware and software while gaining experience and proficiency with those tools
Equation 2 (Above) Linear state space model for inverted pendulum.