Please enable JavaScript to view this site.

Waijung 2 User Guide

Navigation: ESP32 target > Tutorials

Self-Balancing Robot using M5Stack Bala2 and Waijung 2 for ESP32

Scroll Prev Top Next More
cover

Objectives

1.Understand the working principles of a self-balancing robot.

2.Learn how to use the M5Stack Bala2 and Waijung2 for building and programming a self-balancing robot.

3.Develop a control algorithm for the robot’s movements.

4.Create a web application for controlling the robot.

Project Overview

Welcome to our tutorial on building a Self-Balancing Robot using M5Stack Bala2 and Waijung2. In this tutorial, we will guide you through the exciting process of creating a self-balancing robot, a fascinating piece of technology that maintains its balance using a gyroscopic stabilization system.

We will be using the M5Stack Bala2, a stackable balance bot kit powered by ESP32. It’s a small but powerful robot that uses a two-wheel drive and a 9-DOF (degree of freedom) IMU (Inertial Measurement Unit) for maintaining balance. The robot is controlled using Waijung2, a blockset coder for MATLAB Simulink, which allows us to program the robot in a simple and intuitive way.

By the end of this tutorial, you will have a fully functioning self-balancing robot and a solid understanding of how it works. So, let’s get started on this exciting journey of robotics and programming!

Prerequisites

1.Matlab (Release R2020a or later) with the followings toolboxes and blocksets:

a.Simulink

b.Matlab Coder

c.Simulink Coder

d.Embedded Coder

2.M5Stack BALA2 FIRE balancing robot

3.SD card (Maximum size 16GB)

Content Outline

1.Reading IMU Sensor Data: Develop a Simulink model to read Inertia Measurement Unit (IMU) sensor data and calculate tilt (roll) angle using Waijung2 custom code.

2.Setting Wheel Speed: Understand how to set the speed of the Bala2 wheels (motor) using Waijung2.

3.Reading Wheel Speed using Encoder Data: Understand the process of reading encoder data using Waijung2 and how to use this data to calculate the wheel speed. This involves implementing the motor speed filter

4.Implementing PID Controller on Simulink: Discover how to implement a PID controller on Simulink for precise control of the robot.

5.Developing the Balancing Algorithm and Tuning the PID Controller:  Learn to develop a balancing algorithm and tune the PID controller for optimal performance. This section includes testing the algorithm.

6.Developing and Testing Movement Control Algorithm: Learn how to develop and test a control algorithm for various robot movements (forward, backward, left turn, and right turn) using Hardware in the Loop (HIL) tests.

7.Creating a Web Application: Create a web application to control the robot using the drag and drop technique.

8.Developing a Stand-alone System: Develop a Stand-alone system that integrates the control algorithm and a web application for monitoring and controlling the system via the web application.

 

Copyright 2024 Aimagin Co.,Ltd. Rev.1454