0
Select Articles

# A Flipped Lab Experience for Mechatronics EducationPUBLIC ACCESS

[+] Author Notes
Joshua Hurst, Sandipan Mishra

Mechanical, Aerospace, and Nuclear Engineering Department, Rensselaer Polytechnic Institute

Joshua Hurst received his BS, MS and Ph.D. all in Mechanical Engineering from Rensselaer Polytechnic Institute (RPI) in 2002, 2003 and 2008. He worked on navigation and guidance systems for self-guided vehicles and on flight control systems before joining the Mechanical, Aerospace, and Nuclear Engineering Department at Rensselaer in 2011. His interests are in the areas of mechatronics, dynamic systems, control and optimization.

Sandipan Mishra received his B.Tech. from the Indian Institute of Technology Madras in 2002 and his Ph.D. from the University of California at Berkeley in 2008, both in Mechanical Engineering. Dr. Mishra joined RPI's faculty in the Mechanical, Aerospace, and Nuclear Engineering Department in Fall 2010. His interests are in the area of systems and control theory, learning control, nonlinear estimation, and precision Mechatronics.

Mechanical Engineering 138(06), S7-S11 (Jun 01, 2016) Paper No: ME-16-JUN5; doi: 10.1115/1.2016-Jun-5

## Abstract

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.

## Article

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).

Figure 1 Mechatronics (courtesy Kevin Craig)

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).

Figure 2 MinSeg Inverted Pendulum.

## 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.

Figure 3 Main components of the Rensselaer Mechatronics Kit.

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 [1]. To address this, the Rensselaer Arduino Support Package Library (RASPLib) was developed [2], 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 [2]. Hardware kit details and a commercialized version of the kits can be found here [3].

## Project History

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”.

## Hardware Design

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.

Figure 4 Rensselaer Mechatronics Kit sensors, actuators and microprocessor.

Figure 5 Rensselaer Mechatronics Kit hardware features.

## Software Development

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.

Figure 6 Selected blocks of the Simulink device driver and hardware support library developed at Rensselaer.

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 [1]

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).

1. 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.

2. 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.

3. 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.

Figure 7 MinSeg: A leap from theory to practice.

Figure 8 Major components of the Mechatronics curriculum at Rensselear.

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.

Figure 9 Steps of the dynamic system investigation for the inverted pendulum student project.

A brief outline of the dynamic system investigation for the inverted pendulum will be presented. A detailed development may be found in [4].

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.

Figure 10 Mechanical diagram for inverted wheel pendulum system.

Figure 11 DC motor model diagram.

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.

Mathematical Analysis & Design: After verification, the nonlinear equations of motion are linearized about the upright pendulum position to obtain a linear state-space model Display Formula$x→˙=Ax→+Bu$ with states Display Formula$x→=[x x˙ α α˙]$ (see Equation 2). A LQR full state feedback controller is developed. This controller determines a full state feedback gain to minimize a weighted sum of the state and input according to the integral:Display Formula

$J=∫0∞xTQx+uT Rudτ$

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.

Experimental Analysis: After verification of performance in simulation the controller is implemented in hardware. Figure 12 shows the Simulink balance code. The pendulum angle and wheel position are obtained with the sensor blocks from RASPLib as well as the output motor block. The result - a balancing inverted pendulum and happy students!Display Formula

$Vrw=−RktIwrw2+mw+mpx¨+RktmpLα¨cosα−RktmpLα˙2sinα−kbx˙rw2−kbrwα˙V=RktLmpg sinα+x¨cosα−RktL2mp+Ipα¨−kbrwx˙−kbα˙$
Equation 1 Coupled nonlinear equations for inverted pendulum.

Figure 12 Simple balance controller in Simulink. Input sensor blocks, and motor output block are part of RASPLib.

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

## Conclusion

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. Such experiences prepare the students for real world challenges where a connected world of ‘smart’ things requires a systems perspective to be successful as an engineer.Display Formula

$A=01000−148433.97−32.0500010−16456460.86−355.46 B=0−64.760−718.1C=1000010000100001 D=0000$

Equation 2 (Above) Linear state space model for inverted pendulum.

## References

Mathworks Support and Device Driver Files:
Mechatronics Curriculum, RASPLib Package:
MinSeg website:
Howard, B. and Bushnell, L., 2015, July. Enhancing linear system theory curriculum with an inverted pendulum robot. In American Control Conference (ACC), 2015 (pp. 2185-2192). IEEE
View article in PDF format.

## References

Mathworks Support and Device Driver Files:
Mechatronics Curriculum, RASPLib Package:
MinSeg website:
Howard, B. and Bushnell, L., 2015, July. Enhancing linear system theory curriculum with an inverted pendulum robot. In American Control Conference (ACC), 2015 (pp. 2185-2192). IEEE

## Tables

Table 1 (Above) Selected kit hardware details.
Table 2 (Left) Table of results from Parameter ID.

## Discussions

Some tools below are only available to our subscribers or users with an online account.

### Related Content

Customize your page view by dragging and repositioning the boxes below.

Related Journal Articles
Related Proceedings Articles
Related eBook Content
Topic Collections