Document 2
Document 2
Aim:
This project is about building a self-balancing and traction vehicle. The main goal is to
create a vehicle that can balance itself without falling and move smoothly over different
surfaces.
Introduction:
This kind of vehicles offers remarkable stability and safety for urban environments.
These vehicles use advanced sensors and real-time data to maintain balance and grip,
even on slippery or uneven roads. Traction control systems further enhance safety by
preventing wheel spin and maintaining grip on slippery or uneven surfaces. By
automatically applying brakes or adjusting engine power when a loss of traction is
detected, these systems help drivers maintain control, reduce the likelihood of
accidents.
Materials to be used:
Component Use in Project
Brain of the vehicle; reads data from sensors and controls
Microcontroller (Arduino/ESP32) motors
Gyroscope + Accelerometer
(MPU6050) Detects tilt, angle, and motion for balancing.
Motor Driver (L298D) Controls the speed and direction of motors.
DC Geared Motors Drives the wheels forward and backward.
Wheels Allow movement of the vehicle.
Battery Powers all electronic parts.
Frame Base structure to hold everything together.
Jumper Wires Connect all components together.
Switch Turns the system ON/OFF.
Benefits and Applications:
Benefits:
Improved Stability and Safety: Helps prevent tipping over, useful in uneven terrain or
during sudden movements.
Ease of Use: Simplifies operation for users with less driving or riding experience.
Increased Safety: Prevents wheel slip during acceleration on slippery surfaces like
rain, ice, or gravel.
Improved Vehicle Performance: Ensures optimal power distribution to the wheels for
efficient acceleration.
Enhanced Towing and Load-Carrying: Traction control helps prevent traction loss
due to shifting weight.
Applications:
Agriculture: TCS in tractors and ATVs to improve grip in muddy or uneven fields.
Healthcare & Accessibility: For mobility aids like self-balancing wheelchairs.
Logistics & Warehousing: Self-balancing robots and trolleys for automated material
handling.
Personal Transport: Self-balancing motorcycles.
Urban Mobility: Self-balancing scooters, hoverboards, and bicycles.
Image of Prototype:
Circuit Design for SSTV:
Our Approach:
• Use CAD software to design a sturdy chassis with a low center of gravity.
• Allow space for battery, controller, motors, and sensors.
• Typically two large wheels for balance.
Step 6: Testing
Annexure-3
Arduino IDE code for Arduino Mega.
#include <Wire.h>
#include <Servo.h>
#include <PID_v1.h>
#include <MPU6050.h>
// MPU6050
MPU6050 mpu;
// PID
#define FLY_ENA 5
#define FLY_IN1 6
#define FLY_IN2 7
#define REAR_EN 10
#define REAR_IN1 8
#define REAR_IN2 9
Servo steeringServo;
#define SERVO_PIN 11
// Buzzers
#define BUZZER1 3
#define BUZZER2 4
// ESP8266 Serial
// Timer
void setup() {
Serial.begin(115200);
ESP.begin(9600);
// Motor Pins
pinMode(FLY_ENA, OUTPUT);
pinMode(FLY_IN1, OUTPUT);
pinMode(FLY_IN2, OUTPUT);
pinMode(REAR_EN, OUTPUT);
pinMode(REAR_IN1, OUTPUT);
pinMode(REAR_IN2, OUTPUT);
// Buzzer Pins
pinMode(BUZZER1, OUTPUT);
pinMode(BUZZER2, OUTPUT);
// Servo Init
steeringServo.attach(SERVO_PIN);
// MPU6050 Init
Wire.begin();
mpu.initialize();
if (!mpu.testConnection()) {
digitalWrite(BUZZER1, HIGH);
}
// PID Init
pid.SetMode(AUTOMATIC);
pid.SetSampleTime(10); // 10 ms loop
beepBuzzers();
void loop() {
angle = getTiltAngle();
input = angle;
// Compute PID
pid.Compute();
controlFlywheel(output);
if (ESP.available()) {
}
// Optional alert if tilt > threshold
beepBuzzers();
delay(10);
if (val > 0) {
digitalWrite(FLY_IN1, HIGH);
digitalWrite(FLY_IN2, LOW);
} else {
digitalWrite(FLY_IN1, LOW);
digitalWrite(FLY_IN2, HIGH);
val = -val;
digitalWrite(REAR_IN1, HIGH);
digitalWrite(REAR_IN2, LOW);
void beepBuzzers() {
digitalWrite(BUZZER1, HIGH);
digitalWrite(BUZZER2, HIGH);
delay(100);
digitalWrite(BUZZER1, LOW);
digitalWrite(BUZZER2, LOW);
}
double getTiltAngle() {
return pitch;
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
ESP8266WebServer server(80);
void handleRoot() {
<!DOCTYPE html>
<html>
<body style='text-align:center;font-family:sans-serif'>
<button onclick="sendCmd('F')">Forward</button>
<button onclick="sendCmd('B')">Backward</button>
<button onclick="sendCmd('S')">Stop</button><br><br>
<button onclick="sendCmd('C')">Center</button><br><br>
<script>
function sendCmd(cmd) {
fetch("/cmd?val=" + cmd);
function setSpeed() {
document.getElementById('spdval').innerText = val;
fetch("/speed?val=" + val);
}
</script>
</body>
</html>
)rawliteral");
void handleCmd() {
void handleSpeed() {
Serial.print("S");
Serial.print("#");
void setup() {
server.begin();
void loop() {
server.handleClient();