In this chapter you will be introduced to what the Arduino Engineering Kit is, what the materials included in the kit are, and which tools you are going to be using in order to build and program the three main projects included in it.
About the Arduino Engineering Kit
The Arduino Engineering Kit is directed towards engineering students that want to learn about Arduino, MATLAB, Simulink, and Stateflow. It has been developed as a collaboration between Mathworks and Arduino. The kit contains all the components needed to build three complete projects, as well as educational materials with explanations about the physics and math of mechatronics. You will be introduced to programming in four different programming languages and learn about all of the above while making those three challenging engineering projects.
The content for this kit is divided into six chapters: a short introduction, a getting started guide to the tools we will be using, a concepts section dedicated to both theoretical aspects as well as in-depth technical descriptions of the most significant parts, and finally the projects.
The content has been designed to be followed sequentially from chapters 1 to 3, which should be used as reference when needed. Chapters 4, 5 and 6 are the projects, they can be done at any order, but it is recommended to start with the project in chapter 4.
All the content is available online, through the Arduino Education Online Platform.
From the introductory chapter:
- You will learn how the entire Arduino platform works, you will be using the Arduino MKR1000 Board. You will program the board by using the Arduino IDE, learning about digital inputs/outputs, and serial communication.
- In order to expand Arduino board capabilities, you will use the Arduino MKR Motor Carrier, it will allow you to learn a lot about motors, and how to control them from the Arduino board.
- You will get an introduction to MATLAB user interface, and how to create, access, modify and visualize data. Moreover, you will be able to write script and functions within MATLAB.
- You will learn how to create and simulate a Simulink model. You will also learn how to visualize simulation data in the Simulink environment, set the sampling rate of a block in a Simulink model and add block hierarchy to a Simulink model using subsystems.
- After getting an introduction to Arduino, MATLAB and Simulink, you will see how these three tools can be connected to each other. You will make a practical exercise by characterizing a DC Gear Motor while learning how to do so.
Once you know how to use these tools together you will go through some engineering concepts, they will allow you to understand better the projects coming later. The concepts are both about deeper components explanation, such as DC motors, or encoders and presentation of new themes such as I2C communication, or PWM signals. The goal is for you to be able to understand this concepts in general terms, so you can implement them in other scenarios, not only with this kit.
Right after the engineering concepts, you will build and program 3 different projects:
you will learn about the basic movement of differential drive robot from MATLAB, how to use kinematic equations to simulate the rover motion and perform open loop control, closed loop control of the rover, use states to program your rover, localization of the rover using Image processing, control the rover and forklift to pick up the target and drop it off and Wi-Fi communication between rover and MATLAB.
you will learn how to connect to an Arduino-based robot from MATLAB, to write MATLAB apps, functions, and scripts to control your robot, to apply concepts from geometry, physics, symbolic math, and image processing, and to automate a complete application workflow from start to finish.
SELF BALANCING MOTORCYCLE
you will learn how to simulate the vehicle’s overall behavior and create models of the components to improve the quality of the simulation as well as the one of the control algorithms, you will explore how to program the motorcycle with Simulink®, to control its balance algorithm, make it move in a straight line, and detect obstacles. After completing the project you will have knowledge to build your own self-balancing vehicles, and who knows, maybe you’ll make yet another Hoverboard® or even the next Arduino-controlled Segway®.
Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards can read inputs, amount of light on a sensor, a press on a button, or the arrival of a Twitter message and turn this into an output, for example, activating a motor, turning on an LED or publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do this use the Arduino programming language and the Arduino Software (IDE).
Thanks to the Open Source philosophy that underlies the project, Arduino gained the support of a huge community of users that share projects, tutorials and suggestion on the dedicated channels such as the Arduino forum and the Arduino Project Hub.
Over the years Arduino has developed a variety of different boards, each one with different capabilities and functionalities. For instance, there is a different board for each communication protocol such as Wi-Fi (MKR1000), Bluetooth, LoRa, SigFox, GSM and so on.
In the Arduino Engineering Kit, you will program the Arduino MKR1000 using MATLAB and Simulink.
MATLAB is a high-level programming language and development environment for engineering and scientific computing. It is optimized for numeric computation and includes thousands of math and engineering functions that can be used to analyze and visualize data, develop algorithms, and create mathematical models. Dozens of add-on products extend MATLAB by adding domain specific functionality in areas such as controls, signal processing, robotics, optimization, image processing, and many more.
MATLAB Support Package for Arduino enables you to communicate with Arduino hardware directly in MATLAB. You can interactively read data from a variety of sensors and peripheral devices, process the raw data into meaningful quantities, and actuate external devices such as lights and motors. Because MATLAB is a high level interpreted language, you can see results from I/O instructions immediately without having to compile your code.
Simulink is a block diagram environment for modeling and simulating dynamic systems and developing algorithms that you can embed onto Arduino and other hardware. Operations and functions are represented by Simulink blocks, while data is represented by signals which flow from one block to another. With Simulink you can incorporate signal processing, control design, state logic, and other advanced math and engineering routines into your Arduino projects automatically, and thus the traditional software development processes are done for you. You can just focus on the engineering!
Simulink Support Package for Arduino extends Simulink with blocks for configuring Arduino sensors and reading and writing data from them. After creating your Simulink model, you can simulate it, interactively tune algorithm parameters until you get it just right and download the completed algorithm for standalone execution on your Arduino. With the MATLAB Function block, you can incorporate MATLAB code into your Simulink model.
Both Arduino support packages remove the need to manually write C or C++ code and compile, build, and run the application. The support packages translate your MATLAB and Simulink designs into working C and C++ code
MATLAB AND SIMULINK INSTALLATION
You will need the following MathWorks products to program the projects in the Arduino Engineering Kit:
- MATLAB®, Simulink®
- Control System Toolbox™
- Curve Fitting Toolbox™
- DSP System Toolbox™
- Image Processing Toolbox™
- Instrument Control Toolbox™
- Optimization Toolbox™
- Signal Processing Toolbox™
- Simscape Multibody™
- Symbolic Math Toolbox™.
If you already have MATLAB installed, you can see if you have the required products by typing ver in the Command Window.
Note that in addition to having the required products, you will also need to use release R2018a or later.
If you do not have an existing MATLAB license that meets these criteria, you can install the 1-year license included with the kit using the steps below.
STEPS TO INSTALL THE LICENSE
- Visit [mathworks.com/arduino-kit-license] (http://mathworks.com/arduino-kit-license)
- After submitting the required information, your license is immediately created and available for installation.
- If you are ready to install now, choose your platform and proceed with the installation.
If you decide to install later, visit mathworks.com/mwaccount and choose the license number that corresponds to the MathWorks Arduino Kit.
After completing the installation, you will need to install several Add-ons that are used in the projects. Reopen MATLAB with Administrator access before this. Select Add-Ons from the MATLAB Toolstrip as shown in the image below and click on Get Add-Ons.
Install these Add-Ons in the exact order provided below.
- MATLAB Support Package for Arduino Hardware: Acquire inputs and send outputs to Arduino boards and connected devices
- Simulink Support Package for Arduino Hardware: Run Simulink models on Arduino boards
- MATLAB Support Package for USB Webcams: Acquire images and video from USB webcams
Arduino_Engineering_Kit_Hardware_Support (Choose the right one depending on your MATLAB release):
- MATLAB R2019a and later: Arduino_Engineering_Kit_Hardware_Support_19a: MATLAB and Simulink support for the Arduino MKR Motor Carrier and other components used in the Arduino Engineering Kit.
- MATLAB R2018b: Arduino_Engineering_Kit_Hardware_Support_18b: MATLAB and Simulink support for the Arduino MKR Motor Carrier and other components used in the Arduino Engineering Kit.
- MATLAB R2018a: Arduino_Engineering_Kit_Hardware_Support : MATLAB and Simulink support for the Arduino MKR Motor Carrier and other components used in the Arduino Engineering Kit.
- Arduino Engineering Kit Project Files: MATLAB and Simulink files to program the projects in the Arduino Engineering Kit, including the self-balancing motorcycle, mobile rover, and drawing robot.
Remember to follow the instructions on the Add-Ons themselves.
Note: The MATLAB Support Package for Arduino installs Arduino IDE 1.8.1 and a few associated libraries. Do not alter these files or their location.
You will learn how the entire Arduino platform works, you will be using the Arduino MKR1000 Board. You will program the board by using the Arduino IDE, learning about digital inputs/outputs, and serial communication.
You will learn how the entire Arduino platform works, you will be using the Arduino MKR1000 Board. You will program the board by using the Arduino IDE, learning about digital inputs/outputs, and serial communication. You will learn about the basic movement of differential drive robot from MATLAB, how to use kinematic equations to simulate the rover motion and perform open loop control, closed loop control of the rover, use states to program your rover, localization of the rover using Image processing, control the rover and forklift to pick up the target and drop it off and Wi-Fi communication between rover and MATLAB.
Using image processing, trajectory calculation, and trajectory optimization for path planning, the Drawing Robot draws an image on a whiteboard off a picture from a webcam that is digitized by MATLAB. The robot utilizes pure MATLAB code and motor control system theory to convert a physical image to a digital format and onto a whiteboard.
The Mobile Rover features position tracking via a remotely connected webcam and onboard sensing features for obstacle avoidance and movement. The rover uses a mix between MATLAB and Simulink programs to move around and interact with the world.
SELF BALANCING MOTORCYCLE
Featuring inverted pendulum dynamics using a reaction wheel and movement gyro, the Self-Balancing Motorcycle can move around and balance by itself. The motorcycle is using Simulink to monitor and control the movements, inertial sensing and filtering to make the motorcycle balance