This example shows how to use Arduino® Engineering Kit Rev 2 to build and program a robot that extracts line traces from an image and reproduces it as a drawing on a whiteboard. The project uses MATLAB® code to capture an image using a webcam, and then convert it into a set of motor commands using image processing techniques, which drive the robot across a whiteboard and reproduce the captured image as a drawing.
The drawing robot is controlled by an Arduino Nano 33 IoT board, interfaced with the Arduino Nano Motor Carrier, two DC motors with encoders, and a micro-servo motor. The drawing robot has two different colored markers that can be raised and lowered by means of the servo motor. The two DC motors helps the drawing robot navigate over the whiteboard.
MATLAB Support Package for Arduino Hardware
MATLAB Support Package for USB Webcams
Image Processing Toolbox™
Control System Toolbox™
Before you start exploring the Drawing Robot 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 MATLAB add-on for Arduino hardware (MATLAB 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.
To assemble the drawing robot from the components included in Arduino Engineering Kit Rev 2, watch the video in the Project Overview section of Project Drawing Robot.
The required files for Drawing Robot project are downloaded and installed as part of the MATLAB 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 DrawingRobot subfolder in this main folder (aekrev2projectfiles.instrset) contains the files described in the detailed workflow at Project Drawing Robot.
Note: You need to run these two commands every time you start a new MATLAB session, to view and access the project files.