Main Content

Webcam Controlled Rover Using Arduino Engineering Kit Rev 2

This example shows how to use Arduino® Engineering Kit Rev 2 to program a differential drive robot that can be remotely controlled by MATLAB® over Wi-Fi® to perform operations such as path following and moving objects with a forklift along with obstacle avoidance.

The rover is controlled by an Arduino Nano 33 IoT board, that is interfaced to the Arduino Nano Motor Carrier, two DC motors with encoders, and a micro-servo motor. On top of the rover, you will install a color-coded sticker that will serve as a marker and assist the image processing algorithm that uses a webcam to detect the location and orientation of the robot, and thereby assist the rover in overall trajectory tracking.

Required Products

  • Simulink® Support Package for Arduino Hardware

  • MATLAB Support Package for Arduino Hardware

  • Stateflow®

  • Image Processing Toolbox™

Prerequisites

Before you start exploring the Webcam Controlled Rover project, complete these steps:

1. Understand the basics of Arduino Engineering Kit Rev 2 and install the tools as described in Unboxing and Installation. Because you have already installed the Simulink add-on for Arduino hardware (Simulink Support Package for Arduino Hardware), you can proceed with the installation of the other tools.

2. Learn how to get started with Arduino environment and the tools, as described in Arduino, MATLAB and Simulink.

3. Learn the basics of DC motors, servo motors, IMU (Inertial Measurement Unit), and motor control system, as described in Basics of Mechatronics.

Assemble the Webcam Controlled Rover

To assemble the webcam controlled rover from the components included in Arduino Engineering Kit Rev 2, watch the video in the Project Overview section of Project Webcam Controlled Rover.

Project files for Webcam Controlled Rover

The required files for Webcam Controlled Rover project are downloaded and installed as part of the Simulink Support Package for Arduino Hardware installation. You can find these files in the folder aekrev2projectfiles.instrset. Use these two MATLAB commands to obtain the path of the folder and view and access the files:

aekPath = matlab.internal.get3pInstallLocation('aekrev2projectfiles.instrset');
addpath(genpath(aekPath));

The MobileRover subfolder in this main folder (aekrev2projectfiles.instrset) contains the files described in the detailed workflow at Project Webcam Controlled Rover.

Note: You need to run these two commands every time you start a new MATLAB session, to view and access the project files.

See also