Home > Applied project-based learning: building applications for low-cost hardware - Part 2

Applied project-based learning: building applications for low-cost hardware - Part 2

Supplier News
article image Simplified workflow using Model-Based Design.

Continued from Part 1

Introducing Robotics and Model-Based Design with LEGO MINDSTORMS NXT

A robotic application requires mechanical design, signal processing, task scheduling, and control tuning. As a result, and thanks to its multidisciplinary nature, a robot is a perfect platform for project-based learning.

LEGO MINDSTORMS NXT provides all the tools the students need to develop simple robots. A set usually includes a control brick based on an ARM processor, as well as servomotors, sensors, and construction elements. Using this set, students can build the robot by themselves and then design and test it on the hardware.

A project like this provides a perfect opportunity to introduce the four major components of Model-Based Design: modelling, simulation, code generation, and testing.

Students begin by creating a system model in Simulink. To deploy the model on the robot they can use the additional libraries described in the section on solving the Arduino Blink Challenge. They can simulate the model to understand the robot’s behaviour, and tune parameters and controllers to enable it to perform the required tasks.

Using Simulink support for target hardware they can automatically convert the model into an executable application for deployment on the LEGO MINDSTORMS NXT control brick.

They can simulate and test the algorithm and control logic on the computer and then compile it for the hardware. By enabling External Mode, students can establish a Bluetooth connection with the robot so as to change parameters during execution.

A simple application based on the LEGO MINDSTORMS NXT Robot in the Tribot configuration will illustrate this workflow. In this example, the goal is to move the robot forward or backward a certain distance. Before working with the actual hardware, the students create a model of the robot servomotors and design a PID controller using Simulink PID autotuning features. They use this model to design the controller before assembling the actual robot.

When the controller is ready, they replace the simulation subsystem with an Input-Output model based on the LEGO MINDSTORMS NXT Motor and Encoders blocks. This model can be used to generate an executable to be deployed on the robot. Students can test different working conditions for the system by enabling External Mode and changing the position of the Tribot during execution.

Making Objects See: Introducing Computer Vision with BeagleBoard

Working with hardware offers opportunities for students to develop specific skills. In digital image processing courses, for example, the students learn how an image is acquired, interpreted, and processed through algorithms. They can practice on real applications working with image acquisition and processing instrumentation.

In this sample computer vision project, the students create an object detection algorithm in Simulink and deploy it on BeagleBoard, a popular single-board PC with an ARM processor and a Linux operating system.

The image is acquired from a standard webcam connected to the board. It is then processed through a colour space conversion algorithm based on blocks in the Computer Vision System Toolbox™ library. The algorithm extracts the Chroma component, performs a logical comparison with a threshold to define the item shape, applies a median filter to preprocess the data, and then executes a blob analysis to identify the object shape. The image is then sent back to a video output to display the bounding box around the identified object.

As we have seen with Arduino and LEGO MINDSTORMS NXT, this algorithm can be automatically compiled into an executable application and deployed on BeagleBoard. Using External Mode students can tune the threshold manually during simulation in order to adapt the process to different light conditions.

Extending Project-Based Learning

Through C and HDL code generation, MATLAB and Simulink can target a broad array of hardware platforms. For many platforms, including Arduino, BeagleBoard, PandaBoard, and TI's C6000™, students can include target-specific functionality, such as processor-dependent algorithms, timer support, and pin-level I/O.

The examples described here are only the starting point for a lesson, a laboratory, or a longer project. Students may develop control applications on Arduino for innovative products, participate in LEGO robot competitions such as ET Robocon, or develop vision systems for futuristic applications such as drones and self-driving cars. With MATLAB and Simulink they can design applications to be deployed on the hardware with ease, enjoying all the fun of making something realistic and innovative.

Newsletter sign-up

The latest products and news delivered to your inbox