University of Adelaide Undergraduates Design, Build, and Control an Electric Diwheel Using Model-Based Design

By Dr. Ben Cazzolato, University of Adelaide

In their final year, honors undergraduates at the University of Adelaide are encouraged to complete a year-long capstone course in which they apply the skills and knowledge acquired in their coursework to a practical, hands-on project. Ideas for the capstone projects come from industry, faculty, or the students themselves. For aerospace and mechanical engineering students, the projects often require the design and implementation of real-time control systems and real hardware systems—past projects have included self-balancing scooters, unicycles, and robots, as well as automated reversing systems for double tractor-trailers.

Completed projects are demonstrated at an annual exhibition open to the public. One project that repeatedly garners attention from the media and from other schools is EDWARD, or Electric DiWheel with Active Rotation Damping (Figure 1). Powered by on-board batteries, the diwheel's two electric motors are capable of propelling the vehicle at speeds of up to 40 kph.

Figure 1. The electric diwheel designed and built by the University of Adelaide undergraduates.

The original diwheel was designed and constructed three years ago by a team of four engineering students. Since then, two more teams have significantly enhanced and refined the diwheel (Table 1).

Year 1 Students built a 2D plant model using Simulink, developed Lagrangian equations of motion using MATLAB and SimMechanics, visualized results using Simulink 3D Animation, and generated C code for the embedded microcontroller using Simulink Coder.
Year 2 A new team built two new controllers using Simulink and Control System Toolbox, updated the plant model to include yaw motion using Symbolic Math Toolbox, and generated C code for dSPACE hardware using Simulink Coder.
Year 3 and beyond Another new team updated the power electronics, batteries, safety systems, and additional control algorithms using Simulink.

Table 1. Three-year evolution of the diwheel.

All three teams used Model-Based Design with MATLAB ® and Simulink ®. Model-Based Design supports a workflow that incorporates system modeling, control design, simulation, code generation, and rapid prototyping (Figure 2). This workflow lets students focus on system issues instead of low-level C coding. As a result, they achieve a great deal with relatively little prior experience, time, or capital expenditure. By the end of the year they've completed an entire engineering project, from analysis of a problem through delivery of an embedded system.
Figure 2. A typical controller development workflow for capstone projects.

Advantages of the Diwheel as a Capstone Project

The diwheel has all the characteristics of a good capstone project. Most important from the students' point of view, perhaps, is that the diwheel is fun to drive—students report that it gives them the same adrenaline rush as a roller coaster. The mechanical design is interesting but not too detailed to grasp. The relatively simple design requires sophisticated controls, engaging the students in feedback control, safety, and other fundamental engineering issues. In a practical vehicle, the center of gravity would be kept as low as possible to increase stability. We deliberately selected a high center of gravity for the diwheel, to increase the control design challenge.

Media coverage of the diwheel project has brought additional, unexpected benefits: By demonstrating what our students can achieve after only four years of study, the press reports have attracted new students and more support to the engineering program at the University of Adelaide.

Integrating MATLAB and Simulink into the Curriculum

Engineering students at the University of Adelaide begin preparing for the capstone projects as early as their second year, when they take their first controls courses. Based on MATLAB and Simulink, these courses cover classical, digital, proportional-integral-derivative (PID), and state-space control with an emphasis on rapid prototyping processes in the latter years. The University of Adelaide has a Total Academic Headcount license, which makes it easy for students to access the MathWorks products they need for their assignments from anywhere on or off campus.

The outstanding outcomes that we see in the controls-based capstone projects are a direct result of integrating MATLAB and Simulink into our controls courses and focusing on rapid prototyping throughout the program. Students do not have to use Model-Based Design for their capstone project; they are free to choose the engineering approach they think will work best. Without modern rapid prototyping tools, however, the diwheel project and others like it would simply not be possible. Students would be unable to simulate their systems or ensure their controllers were safe. The groups that try to write their code manually in C never get anywhere near as far as those who use Model-Based Design.

Year 1: From Idea to Working Diwheel

Because the students who built the original diwheel were starting from scratch, one of their first tasks was to create the mechanical design. They developed a 2D plant model of the diwheel in Simulink and ran simulations to better understand its tumble and slosh behavior. To derive the system dynamics, they developed the Lagrangian formulation in MATLAB. Later, a graduate student developed an equivalent model in SimMechanics. The undergraduate team and I used this model to validate the simulation results.

Working in Simulink, the students developed a controller that used input from a gyroscope to control the slosh. They ran closed-loop simulations of the controller and plant models together to verify the functionality of the control system. Simulink 3D Animation enabled them to visualize the simulation results in a 3D environment (Figure 3). Compared with plots of raw data, these visualizations made it much easier for the students to see how their control algorithms would perform once implemented on the diwheel. After validating the controller model, they generated C code using Simulink Coder, and deployed the compiled code to a microprocessor installed on the diwheel.

Figure 3. A virtual reality model of the diwheel.

After just one year of development, the students had designed and built a working diwheel that they could safely drive—a significant achievement.

Year 2: Inversion Control and Other Enhancements

In the second year of the diwheel project, an entirely new group of students picked up where the first group left off. A key objective was to build two new controllers, one to enable the diwheel pilot to swing upside down and a second to keep the diwheel in an unstable inverted state indefinitely (Figure 4).

Figure 4. The diwheel with its inversion controller engaged.
Before they could develop these controllers, the students needed a plant model of the diwheel that incorporated yaw as well as pitch. They used Symbolic Math Toolbox to derive the Lagrangian dynamics for a fully coupled, three-degree-of-freedom model that incorporated a yawing component. Using Simulink, Control System Toolbox , and this plant model, they developed models of the swing-up controller, an improved slosh controller, and the inversion controller (Figure 5).
Figure 5. Diwheel control modes.

The new control systems took advantage of upgraded hardware on the diwheel, including new accelerometers, speed sensors, and gyros, as well as more powerful motors. Like their predecessors, this group of students used Simulink Coder to generate code from their models, but they targeted dSPACE® rapid prototyping hardware instead of a microcontroller. The dSPACE hardware made it easier to add an on-board display screen that showed speed, battery charge levels, and the status of various states. After conducting initial tests with the new diwheel, the students performed basic system identification using measured data to improve the accuracy of the plant model, which enabled further refinements to the controller models.

Year 3 and Beyond

A third group of students has begun building on the diwheel design created by last year's group. Once again, many of the hardware components have been updated, including the power electronics and batteries. These hardware updates require the redesign of some control algorithms. The students are also working on improving overall reliability and performance, as well as fixing known problems from earlier versions. These are exactly the kinds of activities that would be necessary in the real world, where engineering teams are frequently required to improve existing designs, including designs taken over from another group or a supplier.

Model-Based Design with MATLAB and Simulink enables University of Adelaide students to take on more ambitious and more interesting capstone projects because they can model, design, verify, and implement their real-time control systems in a single environment. They do not have to learn disparate tools or spend much of the year writing and debugging C code. As a result, they acquire a deep understanding of controls that will help them in virtually any career path they choose—indeed, some of the more accomplished students have the skills of seasoned controls engineers well before they graduate.

About the Author

Dr. Ben Cazzolato teaches control design in the University of Adelaide Mechanical Engineering department. His teaching interests include the development of physical platforms to demonstrate control theory. He holds a B.E. and a Ph.D. in acoustic engineering from the University of Adelaide.

Published 2012 - 91994v00