Giter Site home page Giter Site logo

sproutorc / balancingrobotarduino Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tkjelectronics/balancingrobotarduino

0.0 0.0 0.0 6.7 MB

This is the Arduino version of the code for our balancing robot/segway

Home Page: http://blog.tkjelectronics.dk/2012/03/the-balancing-robot/

balancingrobotarduino's Introduction

Developed by Kristian Lauszus, TKJ Electronics 2012

The code is released under the GNU General Public License.


This project is deprecated

This project is no longer maintained as I will instead focus on a Balancing robot kit, the Balanduino. For more information see the new repository: https://github.com/TKJElectronics/Balanduino and the Kickstarter campaign: http://www.kickstarter.com/projects/tkjelectronics/balanduino-balancing-robot-kit.


This is the code for my balancing robot/segway. It's a ported version of the code for the mbed board which I original used. The original code can be found at the following link: https://github.com/TKJElectronics/BalancingRobot.

The code will work for all boards that features an ATmega328p (Duemilanove, Uno, Pro, Pro Mini etc.) - it's not directly pin compatible with the larger Arduinos (Mega, Mega 2560 etc.) as I use the port registers to save processing resources - see http://www.arduino.cc/en/Reference/PortManipulation. But just take a look at the pinMapping pages for comparison: http://arduino.cc/en/Hacking/PinMapping168 and http://arduino.cc/en/Hacking/PinMapping2560 and figure the pins out yourself - for instance OC1A and OC1B are not located on pin 9 and 10, but at pin 11 and 12 on the Arduino Mega.

I have used the registers to set up 20kHz PWM, Phase and Frequency Correct on pin 9 (OC1A) & pin 10 (OC1B) with ICR1 as TOP using Timer1 - see the datasheet page 128-135.

I use a 6DOF IMU from Sparkfun: http://www.sparkfun.com/products/10010, though I only use one of the gyro axis, but any IMU can be used. For instance the very popular MPU-6050, see this example code.

For more info about calculating the pitch see my post at the Arduino forum: http://arduino.cc/forum/index.php/topic,58048.0.html.

For more information about the Kalman filter see my blog post: http://blog.tkjelectronics.dk/2012/09/a-practical-approach-to-kalman-filter-and-how-to-implement-it/ and the source code: https://github.com/TKJElectronics/KalmanFilter.

To steer the robot, I use a USB Host Shield together with my SPP Bluetooth Library for Arduino: https://github.com/felis/USB_Host_Shield_2.0/blob/master/SPP.cpp. More information can be found at the blog psot: http://blog.tkjelectronics.dk/2012/07/rfcommspp-library-for-arduino/.

You can either use an Android app I wrote: https://github.com/TKJElectronics/BalanduinoAndroidApp or the Processing Application to control the robot.

For information about the hardware, see the wiki: https://github.com/TKJElectronics/BalancingRobot/wiki/Hardware.

Also check out the youtube video of it in action: http://www.youtube.com/watch?v=N28C_JqVhGU - this is actually the mbed version, but they behave the same way.

For more information see my blog post at http://blog.tkjelectronics.dk/2012/03/the-balancing-robot/ or send me an email at [email protected].

balancingrobotarduino's People

Contributors

lauszus avatar

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.