Git Product home page Git Product logo

self-balancing-robot's Introduction

Self-balancing robot

output-cropped.mp4

Overview

The robot is equipped with two MPU-6050 sensors that contain a 3-axis MEMS accelerometer and a 3-axis MEMS gyroscope. The two sensors are placed at each end of the robot (above the wheels) for greater accuracy.

The design files (STLs and Solidworks) can be found in the repo under /design.

Both the accelerometer and the gyroscope individually are not sufficient to provide quality data that can be used to correct the robot’s tilt and always keep it aligned.

That’s because the gyroscope only measures angular velocity which means that there is no fixed reference point apart from the initial calibration that can be done at the beginning of the robot test by aligning it properly and using the velocity measurements to calculate angular displacement and correct the robot accordingly.

This requires integrating the velocity data, which would quickly become useless as integration would increase the error with time, rendering the original reference point moot. Every angular displacement calculation would contain an error, which would keep adding up with every integration step, leading to an increasingly larger errors, making the system unstable.

The accelerometer, however, can be used without the gyroscope, as the angular displacement and velocity can be calculated by performing a double and single integration, respectively. The issue is that it cannot measure precise enough acceleration values for the project’s purposes. As the accelerometer measures acceleration, it also measures the gravitational pull of Earth, which output value would be read as 1g. This 1g reference point can be used to determine orientation relative to ground.

Thus, the accelerometer and gyroscope are an ideal combination (sensor fusion) to measure the orientation and the angular velocity of the robot, allowing for accurate compensation calculations that could be used to actuate the motors in order to keep the robot stable. A complementary filter has been implemented to merge the accelerometer and gyroscope data for greater accuracy: complementary-filter

The robot uses a proportional-integral-derivative controller (PID) to ensure that it’s always balanced with its z-axis aligned with the gravitational pull of the planet: image

Electrical diagram of the whole system: self-balancing-robot-diagram

Electrical components:

  • 2x 1:53 6V DC motors
  • 2x H-bridges for motor control
  • Arduino Nano
  • Optional: ESP8266 for wireless control
  • Optional: RPi + camera for vision
  • 2x MPU-6050 sensors
  • Boost converter
  • 2x 18650 3.7V batteries

Libraries used:

  • Wire.h - enables communication with I2C devices (small serial devices)
  • I2Cdev.h - enables interfacing/reading data from a I2C device
  • MPU6050.h - allows for reading data from the MPU-6050 board

Electrical components:

  • 2x 1:53 6V DC motors
  • 2x H-bridges for motor control
  • Arduino Nano
  • Optional: ESP8266 for wireless control
  • Optional: RPi + camera for vision
  • 2x MPU-6050 sensors
  • Boost converter
  • 2x 18650 3.7V batteries

Libraries used:

  • Wire.h - enables communication with I2C devices (small serial devices)
  • I2Cdev.h - enables interfacing/reading data from a I2C device
  • MPU6050.h - allows for reading data from the MPU-6050 board

mark-1-angle mark-1-front mark-1-side mark-1-top mark-bottom

self-balancing-robot's People

Contributors

fifthrooter avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

robotiko

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.