0% found this document useful (0 votes)
293 views35 pages

Self Balancing Robot12345 PDF

The document describes the design of a self-balancing two-wheeled robot. It uses sensors to measure the robot's angle and rotation to determine if it is leaning too far in any direction. A microcontroller then uses this input in a PID control algorithm to calculate the necessary motor speeds to balance the robot. The motors are controlled to rapidly move the robot in the opposite direction of any lean, allowing it to self-correct and keep an upright position even on uneven surfaces. The goal is for the robot to autonomously balance itself using efficient sensors and control systems.

Uploaded by

Manasa Manu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
293 views35 pages

Self Balancing Robot12345 PDF

The document describes the design of a self-balancing two-wheeled robot. It uses sensors to measure the robot's angle and rotation to determine if it is leaning too far in any direction. A microcontroller then uses this input in a PID control algorithm to calculate the necessary motor speeds to balance the robot. The motors are controlled to rapidly move the robot in the opposite direction of any lean, allowing it to self-correct and keep an upright position even on uneven surfaces. The goal is for the robot to autonomously balance itself using efficient sensors and control systems.

Uploaded by

Manasa Manu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Self-Balancing Robot

ABSTRACT

Now-a-days, the field of robotics has dominated the world. Robots


replicates humans in every aspect of daily life. Self-balancing robot is a two-
wheeled robot which balances itself for falling. This is used to stabilize the
unstable system using efficient microcontrollers and sensors. The wheels
of the robot are driven by motor through motor driver module. The whole
set is powered by the battery. By using sensors senses the position of the
robot whether it is leaning towards the front or back is given as input to
microcontroller. Based on this it rotates the wheels in reverse direction in
order to self-balance itself. These robots provide exceptional robustness
and capability due to their small size and power requirements. This is used
for application of transportation and also in non-uniform surfaces.

DEPARTMENT OF ECE,RGM 1
Self-Balancing Robot

CHAPTER-1
INTRODUCTION
Robotics has always been played an integral part of the human
psyche. The dream of creating a machine that replicates human thought
and physical characteristics extends throughout the existence of mankind.
Developments in technology over the past fifty years have established the
foundations of making these dreams come true. Robotics is now achievable
through the miniaturisation of the microprocessors which performs the
processing and computations. New forms of sensor devices are being
developed all the time further providing machines with the ability to identify
the world around them in many different ways.

Effective and efficient control system designs provide the robot with
the ability to control itself and operate autonomously. Artificial intelligence
(AI) is becoming a definite possibility with advancements in non-linear
control systems such as neural networks and fuzzy controllers. Improved
synthetics and materials allow for robust and cosmetically aesthetic
designs to be implemented for the construction and visual aspects of the
robot.

Two wheeled robots are one variation of robot that has become a
standard topic of research and exploration for young engineers and robotic
enthusiasts. They offer the opportunity to develop control systems that are
capable of maintaining stability of an otherwise unstable system. This type
of system is also known as an inverted pendulum. This project aims to
bring this, and many of the previously mention aspects of a robot together
into the building of a two wheeled balancing robot with a Arduino based
controller.

This field work is essential as robots offer an opportunity of improving


the quality of life for every member of the human race. This will be achieved
through the reduction of human exposure to hazardous conditions,

DEPARTMENT OF ECE,RGM 2
Self-Balancing Robot

dangerous environments and harmful chemicals and the provision of


continual 24 Hrs. assistance and monitoring for people with medical
conditions, etc. Robots will be employed in many applications within society
including carers, assistants and security.

DEPARTMENT OF ECE,RGM 3
Self-Balancing Robot

CHAPTER-2
AIM & OBJECTIVES

Aim: -
An aim of this project is for the design and develop a two wheeled
robot capable of recovering deliberate tilt caused by physical force. This
could be caused in the real world by an ill adult or child falling over or even
passing out thus bumping into the robot. This would allow the robot to
maintain stability and seek assistance from other people by raising the
alarm. Beyond this project timeline, it is anticipated that the robot will also
become capable of remote control trajectory and multimedia interaction.

Objectives: -
1. The design motor control board responsible for calibrating each
motor to perform self-balancing and directional movements.
2. To develop an algorithm for the robot to perform self-balancing, using
the input of an accelerometer and gyroscope module.
3. The geographic control board provides directional movement the
robot must execute such as turn left, go forward, stop, etc.
4. The sensors are used to override user control for obstacle avoidance.

DEPARTMENT OF ECE,RGM 4
Self-Balancing Robot

CHAPTER-3
METHODOLOGY

The self-balancing robot is based on the concept of inverted


pendulum concept. The main key factor of self-balancing robot is the
stability. The inverted pendulum system is naturally unstable. Therefore, a
suitable control system technique and method needs to be investigated to
control the system. The two wheel balancing robot is an application of the
inverted pendulum that requires a controller to maintain its upright
position. To achieve this, a controller needs to be designed and implement
on the robot to balance the inverted pendulum. The goal of the project is to
adjust the wheels’ position so that the inclination angle remains stable
within a pre-determined value. In this the robots moves back and forth but
in an inverted manner. The angle on inclination is measured and the
approximate values are calculated. MPU6050 plays a keen role is
calculating the acceleration and angular velocity of the robot. The inverted
pendulum concept in the simplest form, consists of a cart moved by two
DC motors, to control the position of the inverted pendulum tending to
rotate about a fixed position on the cart. The process is nonlinear and
unstable with one input signal and several output.

To fulfil the purpose the following method will be used:

• Derive dynamical equations based on theory of the inverted pendulum

• Form transfer functions for the angle deviation, ψ and position, x • Find
a controller that can control these two conditions

• Set up requirements for the demonstrator

• Design a demonstrator that fulfils these requirements, investigate the


boundaries of the control signal Chosen error sources will be investigated:

DEPARTMENT OF ECE,RGM 5
Self-Balancing Robot

• Investigate the accuracy of the sensor that delivers the angular data With
an accurate model of the system and a functioning demonstrator this
provides a platform for experiments in a simulated environment. The
simulated model in comparison to the demonstrator will be validated by
implementation of a PID-controller in both in order to compare impulse
responses.

3.1. BLOCK DIAGRAM: -

Figure1 : Block diagram

3.1 BLOCK DIAGRAM DESCRIPTION:-

Arduino Uno: this Microcontroller for interfacing MPU6050 module and


program the robot such that it actuates itself to stay balanced, for sensing
and actuating you can use the GPIOpins. The board accepts both analog
and digital signals as inputs.

Sensor: This module has an MPU-6050 sensor which has MEMS


accelerometer and gyro in a single chip, this gives the data of all the three

DEPARTMENT OF ECE,RGM 6
Self-Balancing Robot

dimensions and the tilt angle of the robot. The module also consists of a
magnetometer (compass).

DC Motor: the DC motors to actuate the robot, that is to balance itself the
robot has to move in forward and reverse direction, the DC motors can
rotate in clockwise and anti-clockwise by reversing the polarity of the power
source.

L293D Motor driver: This needs a motor driver to run the motors, L293D
is a typical motor driver IC which allows the motor to run in both the
directions, you can control two motors with one IC.

Robot chassis:Build a strong two-wheeled chassis for the robot with ample
space for the electronics.

3.2.SYSTEMATIC DIAGRAM:-

Figure2 : Schematic diagram of the proposed system

DEPARTMENT OF ECE,RGM 7
Self-Balancing Robot

3.3. Working:

A self-balancing robot is an inverted-pendulum example problem. The idea


is to keep the robot upright by driving the wheels towards the leaning angle
thetaI.e. when the robot is tilting forward, the wheels should be driven
forward with a specific acceleration to counter the tilting. This will keep the
robot in an upright position at all times. The problem with this is that it is
a very unstable system and a control algorithm must be used to stabilize
it. For this project, the group decided to use a PID algorithm because of its
simplicity compared to other control algorithms. It is also readily available
which is a plus considering the time we have to finish this project.

Figure3 : PID algorithm

The PID controller is both software and hardware implementation. The


angle reading from the MPU6050 module and the desired angle are fed to
the PID algorithm — which calculates the error and outputs a control
signal. The control signal is fed to the motor Controller which is responsible
for driving the stepper motors. The PID algorithm relies heavily on the three
constant parameters: Kp Ki Kd, where Kp is the proportional constant, Ki
is the integral constant, and kd the deriviative constant. The constants are
multiplied with their respective terms P, I, and D terms. The P term is

DEPARTMENT OF ECE,RGM 8
Self-Balancing Robot

responsible for calculating the proportional error or present error.


The I term is responsible for calculating the accumulation of the past errors.
The D term is responsible for calculating the prediction of future errors
based on DT (rate of change). By summing up these three terms, the PID
controller is able to output a control signal that drives the system towards
the target output (desired angle).

3.4 Flowchart

DEPARTMENT OF ECE,RGM 9
Self-Balancing Robot

3.5 Functionality:

ALGORITHM:
#include <MPU6050.h>

#include <L298N.h>

#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE

#include "Wire.h"

#endif

#define MIN_ABS_SPEED 30

MPU6050 mpu;

// MPU control/status vars

booldmpReady = false; // set true if DMP init was successful

uint8_t mpuIntStatus; // holds actual interrupt status byte from MPU

uint8_t devStatus; // return status after each device operation (0 =


success, !0 = error)

uint16_t packetSize; // expected DMP packet size (default is 42 bytes)

uint16_t fifoCount; // count of all bytes currently in FIFO

uint8_t fifoBuffer[64]; // FIFO storage buffer

// orientation/motion vars

Quaternion q; // [w, x, y, z] quaternion container

VectorFloat gravity; // [x, y, z] gravity vector

float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector

//PID

double originalSetpoint = 172.50;

double setpoint = originalSetpoint;

DEPARTMENT OF ECE,RGM 10
Self-Balancing Robot

double movingAngleOffset = 0.1;

double input, output;

//adjust these values to fit your own design

double Kp = 60;

double Kd = 2.2;

double Ki = 270;

PID pid(&input, &output, &setpoint, Kp, Ki, Kd, DIRECT);

double motorSpeedFactorLeft = 0.6;

double motorSpeedFactorRight = 0.5;

//MOTOR CONTROLLER
int ENA = 5;

int IN1 = 6;

int IN2 = 7;

int IN3 = 9;

int IN4 = 8;

int ENB = 10;

LMotorControllermotorController(ENA, INbh1, IN2, ENB, IN3, IN4,


motorSpeedFactorLeft, motorSpeedFactorRight);

volatile boolmpuInterrupt = false; // indicates whether MPU interrupt pin


has gone high

void dmpDataReady()

mpuInterrupt = true;

DEPARTMENT OF ECE,RGM 11
Self-Balancing Robot

void setup()

// join I2C bus (I2Cdev library doesn't do this automatically)

#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE

Wire.begin();

TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz)

#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE

Fastwire::setup(400, true);

#endif

mpu.initialize();

devStatus = mpu.dmpInitialize();

// supply your own gyro offsets here, scaled for min sensitivity

mpu.setXGyroOffset(220);

mpu.setYGyroOffset(76);

mpu.setZGyroOffset(-85);

mpu.setZAccelOffset(1788); // 1688 factory default for my test chip

// make sure it worked (returns 0 if so)

if (devStatus == 0)

// turn on the DMP, now that it's ready

mpu.setDMPEnabled(true);

DEPARTMENT OF ECE,RGM 12
Self-Balancing Robot

// enable Arduino interrupt detection

attachInterrupt(0, dmpDataReady, RISING);

mpuIntStatus = mpu.getIntStatus();

// set our DMP Ready flag so the main loop() function knows it's okay to
use it

dmpReady = true;

// get expected DMP packet size for later comparison

packetSize = mpu.dmpGetFIFOPacketSize();

//setup PID

pid.SetMode(AUTOMATIC);

pid.SetSampleTime(10);

pid.SetOutputLimits(-255, 255);

else

// ERROR!

// 1 = initial memory load failed

// 2 = DMP configuration updates failed

// (if it's going to break, usually the code will be 1)

Serial.print(F("DMP Initialization failed (code "));

Serial.print(devStatus);

Serial.println(F(")"));

DEPARTMENT OF ECE,RGM 13
Self-Balancing Robot

void loop()

// if programming failed, don't try to do anything

if (!dmpReady) return;

// wait for MPU interrupt or extra packet(s) available

while (!mpuInterrupt&&fifoCount<packetSize)

//no mpu data - performing PID calculations and output to motors

pid.Compute();

motorController.move(output, MIN_ABS_SPEED);

// reset interrupt flag and get INT_STATUS byte

mpuInterrupt = false;

mpuIntStatus = mpu.getIntStatus();

// get current FIFO count

fifoCount = mpu.getFIFOCount();

// check for overflow (this should never happen unless our code is too
inefficient)

if ((mpuIntStatus& 0x10) || fifoCount == 1024)

DEPARTMENT OF ECE,RGM 14
Self-Balancing Robot

// reset so we can continue cleanly

mpu.resetFIFO();

Serial.println(F("FIFO overflow!"));

// otherwise, check for DMP data ready interrupt (this should happen
frequently)

else if (mpuIntStatus& 0x02)

while (fifoCount<packetSize) fifoCount = mpu.getFIFOCount();

// read a packet from FIFO

mpu.getFIFOBytes(fifoBuffer, packetSize);

// track FIFO count here in case there is > 1 packet available

// (this lets us immediately read more without waiting for an interrupt)

fifoCount -= packetSize;

mpu.dmpGetQuaternion(&q, fifoBuffer);

mpu.dmpGetGravity(&gravity, &q);

mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);

input = ypr[1] * 180/M_PI + 180;

DEPARTMENT OF ECE,RGM 15
Self-Balancing Robot

CHAPTER-4

HARDWARE COMPONENTS

4.1. ARDUINO UNO:


Arduino is an open-source electronics platform based on easy-to-use
hardware and software. Arduino boards are able to read inputs-light on a
sensor, a finger on a button, or a twitter message- and turn it into an
output-activating a motor, turning on an LED, publishing something
online. You can tell your board what to do by sending a set of instruction
to the microcontroller on the board. To do so you use the Arduino
programming language (based on Wiring), and the Arduino Software(IDE),
based on processing.

DEPARTMENT OF ECE,RGM 16
Self-Balancing Robot

Figure4 : Arduino uno

The Arduino Uno board is the most popular board and mostly
referred for the beginners as they are super easy to begin with, it does
not require any specific Arduino Uno software instead of that all you need
is to select the Arduino Uno in the device option before uploading your
program.

Arduino Uno pin diagram and description:

1. Crystal Oscillator:
There is certain case when the processor has to deal with time-
signal issues, in order to balance it the crystal oscillator is used. The
crystal oscillator is the only way the Arduino is able to calculate the time.
There is a number printed on the top of the crystal. The number indicates
the frequency of the crystal, in most of them the frequency is 16 MHZ or
16,000,000 hertz.

DEPARTMENT OF ECE,RGM 17
Self-Balancing Robot

2.Reset Button:

There is a reset button given which is used to restart the program


running in the Arduino Uno. There are two ways to restart the whole
program.

 You can use the default reset button.

 You can connect your own reset button at the pin labelled as Reset.

Figure5 : Arduino uno

Pin description:

1.Analog i/o pins:

The Arduino Uno board has 6 analog input and output pins from
A0 to A5. The pins are best used in case of the analog sensors. The analog
pins can read the analog signals from them like temperature, proximity,
humidity etc and converts them into digital values that can be read and
processed by the microcontroller.

DEPARTMENT OF ECE,RGM 18
Self-Balancing Robot

2.Microcontroller in Arduino Uno board:

Different Arduino boards has different microcontrollers. It can be


said that is the main component in the overall Arduino board. The main IC
is a bit different in different Arduino Uno boards. The microcontrollers used
basically are of ATMEL Company and it is necessary for you to know what
IC you are using in order to load your program in it. You can easily read
the information on the top of the IC and select the corresponding from the
option given in the Arduino software. For more information about the IC
you can refer to the corresponding datasheet.

3.SPI Ports:

The SPI (Serial Peripheral Interface) is considered for an expansion


of the output. In most of the cases the ICSP Pin as a small programming
header in Arduino Uno consist of RESET, SCK, MOSI, MISO, VCC and
GND.

4.Power Indicator LED:

When you power up the ArduinoUno board, there must be an LED


light up which will indicate the board is powered up correctly. In case you
don’t see the glowing light, there must be something wrong with the
connection you’ve made.

5.TX and RX Pins:

In the Arduino Uno board there are two LED’s labeled as TX


(transmitter) and RX (Receiver), Same are labeled on the pin 0 and 1
respectively. These pins are used for serial communication and the
corresponding LED glowing indicated fi the data is being sent by TX and if
the data is being received by RX. The TX LED flashes at the different
frequency which depends on the baud rate being used by the Arduino board
to transmit.

DEPARTMENT OF ECE,RGM 19
Self-Balancing Robot

6.Digital i/o pins:

Arduino Uno board does have 14 digital i/o pins (input/output pins)
out of which contains 6 PWM output (Pulse width modulation). The digital
pins can be configured to read logic values such as 0 and 1 or can give logic
(0 and 1) output for different modules such as LEDs, Relays, etc. there is a
symbol “~” corresponding to the PWM pins.

Additionally, there is AREF which is used to set an external reference


voltage as the upper limit to the analog input pins. The external reference
voltage is usually in between 0 to 5 volts.

Specifications:

 Microcontroller: ATmega328

 Operating Voltage: 5V

 Input Voltage (recommended): 7-12V

 Input Voltage (limits): 6-20V

 Digital I/O Pins: 14 (of which 6 provide PWM output)

 Analog Input Pins: 6

 DC Current per I/O Pin: 40 mA

 DC Current for 3.3V Pin: 50 mA

 Flash Memory: 32 KB of which 0.5 KB used by bootloader

 SRAM: 2 KB (ATmega328)

 EEPROM: 1 KB (ATmega328)

 Clock Speed: 16 MHz

DEPARTMENT OF ECE,RGM 20
Self-Balancing Robot

4.2. MPU6050 SENSOR:

Figure6 : MPU6050 Pin Description

MPU6050 is basically a sensor for motion processing devices. It is the


world first six dimension motions tracking device. It was designed for low
cost and high performances smartphones, tablets and wearable sensor. It
is capable of processing nine-axis algorithms, it captures motion in X, Y
and Z axis at the same time.

 MPU6050 is a Micro Electro-mechanical system (MEMS), it consists of


three-axis accelerometer and three-axis gyroscope. It helps us to
measure velocity, orientation, acceleration, displacement and other
motion like features.

 MPU6050 consists of Digital Motion Processor (DMP), which has


property to solve complex calculations.

 MPU6050 consists of a 16-bit analog to digital converter hardware. Due


to this feature, it captures three-dimension motion at the same time.

DEPARTMENT OF ECE,RGM 21
Self-Balancing Robot

 This module has some famous features which are easily accessible,
due to its easy availability it can be used with a famous
microcontroller like Arduino

 This module uses the I2C module for interfacing with Arduino.

There is a main eight PINOUT of MPU6050, which are described here:

MPU6050

Pin# Pin Name Description


This pin used for Supply Voltage. Its input voltage is
01 Vcc
+3 to +5V.
02 GND This pin use for ground
03 SCL This pin is used for clock pulse for I2C compunction
This pin is used for transferring of data through I2C
04 SDA
communication.
Auxiliary Serial It can be used for other interfaced other I2C module
05
Data (XDA) with MPU6050.
Auxiliary Serial It can also be used for other interfaced other I2C
06
Clock (XCL) module with MPU6050.
If more than one MPU6050 is used a single MCU,
07 AD0
then this pin can be used to vary the address.
This pin is used to indicate that data is available for
08 interrupt (int)
MCU to read.

Features of MPU6050
 MPU6050 is the world’s first integrated six motion tracking device

 The communication protocol at which it operates is I2C.

 It is built in 16 BIT ADC, which provide high accuracy.

 Its operating voltage is 3 to 5 volts.

 It consists of a digital motion processor, which provide high


computational power.

 It is inbuilt in the temperate sensor.

 It can be used to interfaces with IIC devices like magnetometer.

 The pitch of its pins is 0.1 inch.

 Its Acceleration Range is +/-2g, +/-4g, +/-8g, +/-16g.

DEPARTMENT OF ECE,RGM 22
Self-Balancing Robot

 Its Dimensions (exclude ng pins) are, 21.2mm (0.84″) length x 16.4mm


(0.65″) width x 3.3mm (0.13″) height.

 Its weight is 2.1g.

 It has the smallest and thinnest QFN package for portable devices,
4x4x0.9 mm.

 Its operating current is 3.9 mA when its six motion sensing axes and
DMP are in motion.

 It also has gyroscope feature like its Gyroscope operating current is 3.6
mA.

 Its gyroscopic stand by current is 5µA. It also has low improved


frequency noise performance.
 It works at Gyroscope range, ± 250 500 1000 2000 °/ s.

4.3 MOTOR CONTROLLER

Figure7 : Motor controller

The L298N is a dual H-Bridge motor driver which allows speed and
direction control of two DC motors at the same time. The module can drive
DC motors that have voltages between 5 and 35V, with a peak current up
to 2A.

DEPARTMENT OF ECE,RGM 23
Self-Balancing Robot

Let’s take a closer look at the pinout of L298N module and explain
how it works. The module has two screw terminal blocks for the motor A
and B, and another screw terminal block for the Ground pin, the VCC for
motor and a 5V pin which can either be an input or output.

Figure8 : Motor controller with Motor Interface

This depends on the voltage used at the motors VCC. The module
have an onboard 5V regulator which is either enabled or disabled using a
jumper. If the motor supply voltage is up to 12V we can enable the 5V
regulator and the 5V pin can be used as output, for example for powering
our Arduino board. But if the motor voltage is greater than 12V we must
disconnect the jumper because those voltages will cause damage to the
onboard 5V regulator. In this case the 5V pin will be used as input as we
need connect it to a 5V power supply in order the IC to work properly.

We can note here that this IC makes a voltage drop of about 2V. So for
example, if we use a 12V power supply, the voltage at motors terminals will
be about 10V, which means that we won’t be able to get the maximum
speed out of our 12V DC motor.

DEPARTMENT OF ECE,RGM 24
Self-Balancing Robot

Figure9 : Motor Controller interface

Next are the logic control inputs. The Enable A and Enable B pins
are used for enabling and controlling the speed of the motor. If a jumper is
present on this pin, the motor will be enabled and work at maximum speed,
and if we remove the jumper we can connect a PWM input to this pin and
in that way control the speed of the motor. If we connect this pin to a
Ground the motor will be disabled.

Figure10 : Motor Controller Block Diagram

DEPARTMENT OF ECE,RGM 25
Self-Balancing Robot

Next, the Input 1 and Input 2 pins are used for controlling the
rotation direction of the motor A, and the inputs 3 and 4 for the motor B.
Using these pins we actually control the switches of the H-Bridge inside the
L298N IC. If input 1 is LOW and input 2 is HIGH the motor will move
forward, and vice versa, if input 1 is HIGH and input 2 is LOW the motor
will move backward. In case both inputs are same, either LOW or HIGH the
motor will stop. The same applies for the inputs 3 and 4 and the motor B.

4.5 DC MOTORS

Figure11 : DC Motor

"TT" gearbox motor are popular, since we carried the TT motor +


wheel kit back in , many have feedback for us to carry the motor itself, so
here you are the yellow "TT" motor. This is a TT DC Dual Axis Plastic
Gearbox Motor with a gear ratio of 1:48, which will provides nearly double
the speed of the Blue metal TT motor that has 1:90 gear ratio. Of course
you can always control the speed via PWM from Arduino or any
microcontroller with suitable motor driver.

DEPARTMENT OF ECE,RGM 26
Self-Balancing Robot

Features:

 Rated Voltage: 3~6V


 Continuous No-Load Current: 150mA +/- 10%
 Min. Operating Speed (3V): 90+/- 10% RPM
 Min. Operating Speed (6V): 200+/- 10% RPM
 Torque: 0.15Nm ~0.60Nm
 Stall Torque (6V): 0.8kg.cm
 Gear Ratio: 1:48
 Body Dimensions: 70 x 22 x 18mm
 Weight: 30.6g

DEPARTMENT OF ECE,RGM 27
Self-Balancing Robot

CHAPTER-5

SOFTWARE REQUIREMENTS:
Arduino:

Arduino is an open source electronics platform based on easy-to-use


hardware and software. It is intended for everyone making innovative
projects.Arduino consists of both a physical programmable circuit board
(often referred to as a microcontroller) and a piece of software, or IDE
(Integrated Development Environment) that runs on the computer, used to
write and upload computer code to the physical board.

Arduino IDE requires

 A computer (Windows, Mac, or Linux)

 An Arduino-compatible microcontroller (Arduino Uno)

 A USB A-to-B cable, or another appropriate way to connect the


Arduino-compatible microcontroller to the computer

 Installing the Drivers for the Arduino Uno (from Arduino.cc)

 Plug in the board and wait for Windows to begin its driver installation
process

 After a few moments, the process will fail, despite its best efforts

 Click on the Start Menu, and open up the Control Panel

 While in the Control Panel, navigate to System and Security. Next,


click on System

 Once the System window is up, open the Device Manager

DEPARTMENT OF ECE,RGM 28
Self-Balancing Robot

 Look under Ports (COM & LPT). You should see an open port named
“Arduino UNO (COMxx)”. If there is no COM & LPT section, look
under ‘Other Devices’ for ‘Unknown Device

 Right click on the “Arduino UNO (COMxx)” or “Unknown Device”

port and choose the “Update Driver Software” option

 Next, choose the “Browse my computer for Driver software” option

 Finally, navigate to and select the Uno’s driver file, named


“ArduinoUNO.inf”, located in the “Drivers” folder of the Arduino
Software download (not the “FTDI USB Drivers” sub-directory). If you
cannot see the .inf file, it is probably just hidden. You can select the
‘drivers’ folder with the ‘search sub-folders’ option selected instead.

 Windows will finish up the driver installation from there

DEPARTMENT OF ECE,RGM 29
Self-Balancing Robot

ARDUNIO IDE:
IDE stands for Integrated Development Environment. Pretty fancy
sounding, and should make you feel smart any time you use it. The IDE is
a text editor-like program that allows you to write Arduino code. When you
open the Arduino program, you are opening the IDE. It is intentionally
streamlined to keep things as simple and straightforward as possible. When
you save a file in Arduino, the file is called a sketch – a sketch is where you
save the computer code you have written. The coding language that Arduino
uses is very much like C++ (“see plus plus”), which is a common language
in the world of computing. The code you learn to write for Arduino will be
very similar to the code you write in any other computer language – all the
basic concepts remain the same – it is just a matter of learning a new dialect
should you pursue other programming languages. The code you write is
“human readable”, that is, it will make sense to you (sometimes), and will
be organized for a human to follow. Part of the job of the IDE is to take the
human readable code and translate it into machine-readable code to be
executed by the Arduino. This process is called compiling. The process of
compiling is seamless to the user. All you have to do is press a button. If
you have errors in your computer code, the compiler will display an error
message at the bottom of the IDE and highlight the line of code that seems
to be the issue. The error message is meant to help you identify what you
might have done wrong – sometimes the message is very explicit, like
saying, “Hey – you forget a semicolon”, sometimes the error message is
vague.

DEPARTMENT OF ECE,RGM 30
Self-Balancing Robot

Chapter – 6
Result and Conclusion
6.1 RESULT

The design of self-balancing robot was tested for functionality,


incorporating PID algorithm written in the microcontroller. Initially the PID
algorithm was tuned for values of Kp, Ki and Kd and offset angle values in
x, y, z directions.

In the first instance the bot was balanced and a small jerk was created,
the PID algorithm generated the necessary control signals on the motor to
balance the position and prevent collapsing of the robot.

Figure12 : Robot in Self balanced condition

DEPARTMENT OF ECE,RGM 31
Self-Balancing Robot

6.2 Conclusion

In this project, we have designed a self-balancing robot. This robot


does not need any remote controller or any controller like Bluetooth, Wi-Fi,
GSM, driver etc, it will balance automatically. This robot is very low cost
but very effective for various purposes. This work can be used in various
sectors like medicine delivering in hospitals, delivering products in any
places, spying, and surveillance and so on. In future we can add several
sensors, cameras etc to get more information and robustness features
incorporated with adaptive control.

DEPARTMENT OF ECE,RGM 32
Self-Balancing Robot

REFERENCES

1. Lin SC, Tsai CC, and Huang HC. Adaptive robust self balancing and
steering of a two-wheeled human transportation vehicle. J Intell Robot
Syst 2011; 62(1):103–123.

2. Ruan X, and Chen J. H1 robust control of self-balancing two wheeled


robot. In: 8th World congress on intelligent control and automation,
Jinan, 2010, pp. 6524–6527.

3. Han HY, Han TY, and Jo HS. Development of omni directional self-
balancing robot. In: 2014 IEEE international symposium on robotics
and manufacturing automation (ROMA), Kuala Lumpur, 2014, pp. 57–
62. IEEE.

4. Xu J, Shang S, Qi H, et al. Simulative investigation on head injuries of


electric self-balancing scooter riders subject to ground impact. Accid
Anal Prev 2016; 89: 128–141.

5. http://www.bbc.com/news/uk-england-14167868

6. Murata boy and murata girl, http://www.murata.com/about/


mboymgirl/mboy

DEPARTMENT OF ECE,RGM 33
Self-Balancing Robot

DEPARTMENT OF ECE,RGM 34
Self-Balancing Robot

DEPARTMENT OF ECE,RGM 35

You might also like