Technical Articles and Newsletters

Model-Based Design in Middle School: Developing an Autonomous Sensor Robot for the Robofest Championships

By Darren Tascillo, Jonathan Mi, and Krishna Gogineni, Achieve Charter Academy

NASA’s robotic rover Curiosity has been exploring Mars for more than two years, taking sensor readings to help determine whether Mars could support life. While in seventh grade, we thought it would be fun—and educational—to build similar robots ourselves for the Robofest competition. This annual competition is sponsored by Lawrence Technological University (LTU) to encourage students in their science, technology, engineering, and math (STEM) studies. Our team, Metal Robots, has been competing in Robofest for two years (Figure 1).

Figure 1. The Metal Robots at the regional competition at LTU. The computer screens show sensor readings from one of the rovers, a slide from a presentation explaining the project, and live views from the cameras mounted on the rovers.

We developed our first robots using LEGO® MINDSTORMS® and the LEGO NXT-G programming environment. This year we added Arduino hardware and used Model-Based Design with MATLAB® and Simulink® to develop the control software. The switch to MATLAB and Simulink gave us an opportunity to use the same tools our parents use in their work as engineers and scientists. More importantly, it enabled us to tackle the more complex design problems we faced with this year’s project—which won first place in the Junior Exhibition competition for grades 4-8 at the 2014 Robofest World Championships.

Designing Robots for the Exhibition Competition

For the Robofest Exhibition competition, student teams are free to build and demonstrate any robotics project they want. Projects are judged on their math and science application, complexity, creativity, originality, practicality, and performance.

We decided to build two robots that would perform many of the same tasks as real planetary robots. One robot would be completely autonomous, and the other would be controlled remotely (Figure 2). Both robots would explore a site to see whether it could sustain life and to search for mineral resources.

Figure 2. The fully autonomous robot (blue) and the remote-controlled robot (red) at the world championship. Nearby containers of vinegar and water are sampled by the remote-controlled robot for pH readings.

We equipped each robot with sensors connected to an Arduino processor that wirelessly relayed the measured data to a base station computer. We used an IOGEAR USB extender operating over a wireless network. The robots had sensors for detecting metals and for measuring temperature, moisture, light, radiation, and pH. The control software run on the LEGO MINDSTORMS NXT brick, which was connected to the LEGO MINDSTORM NXT motors that spun the wheels, and to the ultrasonic sensors that detected objects in the immediate environment.

Developing the Sensor and Control Algorithms with Model-Based Design

The first step in programming our robots was learning the basics of MATLAB and Simulink, which none of us had used before. We started off by adapting the familiar NXT-G logic from earlier projects into Simulink. With the online Help and some experimentation, we quickly learned enough to develop a basic controller for a single motor in Simulink.

We ran this controller on the LEGO MINDSTORMS NXT brick directly from Simulink via Simulink External Mode. Gradually, we expanded our controller by adding more motors and the ultrasonic sensors (Figure 3).

Figure 3. The Simulink controller model.

We implemented the control logic for the autonomous robot using Stateflow®. Jonathon’s mother had used Stateflow in her work, and after watching a video tutorial we began experimenting with it ourselves. We learned to model how the robot would react to events—for example, by rotating its motors based on input from the ultrasonic sensors.

The control logic that we developed in Stateflow enabled the robot to explore environments containing randomly placed objects (Figure 4).

Figure 4. Stateflow chart with control logic for the autonomous robot.

When the robot came within 20 centimeters of an object, it would turn away and continue moving. If an object was placed directly in front of it, the robot would stop and turn around to avoid a collision.

A key part of our project was a sensor display interface that we developed in MATLAB. This interface plotted the measurements taken from all the onboard sensors. We wrote a MATLAB script that converted the raw sensor data into scientific units. For example, to display the temperature readings in degrees Celsius, we took measurements using an actual thermometer and the onboard temperature sensor. With these measurements we used the MATLAB polyfit function to solve for the mathematical function that converts the sensor data to degrees, and implemented that function using MATLAB polyval. We used I/O processes from the Arduino support package and implemented the sensor displays into the Mission Control interface developed using MATLAB GUIDE tools.

It took us about six months, meeting three to five hours a week, to design and build the robots. We all worked on every aspect of the robot. For the MATLAB algorithms and Simulink models we worked independently first and then shared our ideas with each other. We tested each approach, selected the best, and moved forward with that one.

Competing at the World Championship

The Robofest World Championship was held on the LTU campus in Southfield, Michigan. Our team competed against teams from across the United States and around the world that had advanced to the championship by placing in local competitions. We demonstrated our robots to the judges and gave a short presentation. We had to describe the programming, explain how we worked as a team, and show that we had done all the work ourselves. We placed first, edging out a team from South Africa that had built a letter-sorting robot.

We feel that MATLAB and Simulink gave us an advantage over teams that used the LEGO NXT-G development environment because we had a development platform that enabled us to solve more complicated problems. Simulink had enough functions for us to solve any challenge that came up with the rover. It also provided a bridge from MINDSTORMS to professional programming. This season we’re looking forward to learning new concepts in MATLAB and Simulink to program an even more sophisticated robot.

Coaching the Metal Robots Team

By Mark Tascillo and Elizabeth Gaecke, Achieve Charter Academy

As parents and coaches, our job was to ensure that the teams had the appropriate resources and a safe working environment, and that they understood what was expected of them in the competition. All other decisions were up to the teams, including what their robots would do, what hardware they would use to build the robots, and what programming languages and tools they would use to program them.

We are all technical professionals, and we fully support STEM in the middle school curriculum. Robofest complements STEM initiatives at our school by bringing real-world application of science, technology, engineering, and mathematics into the classroom. In fact, many of the students on our teams have already expressed a desire to pursue science and engineering careers.

Most of us use MATLAB and Simulink in our work, so we were able to help students learn how to use them. Still, the selection of tools was ultimately up to the teams. Our support and the availability of online tutorials, which the students used to teach themselves, eased the transition from LEGO NXT-G to Simulink and Stateflow. Using MATLAB for interface development was a new paradigm for the students – one of many learning opportunities that they had this year and will continue to have in future Robofest competitions.

About the Author

Jonathan Mi and Krishna Gogineni are eighth-grade students at Achieve Charter Academy in Canton, Michigan. Darren Tascillo is an eighth-grade student at West Middle School in Canton, Michigan.

Published 2015 - 92257v00


View Articles for Related Capabilities