element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Blog Self Balancing Robot - Temporary Diversion from the Quadcopter Project - Demo
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ipv1
  • Date Created: 15 Apr 2015 4:37 AM Date Created
  • Views 2556 views
  • Likes 7 likes
  • Comments 11 comments
  • robot
  • ip_iot
  • arduino
Related
Recommended

Self Balancing Robot - Temporary Diversion from the Quadcopter Project - Demo

ipv1
ipv1
15 Apr 2015

Abstract

As most of you know, I am doing a quadcopter from scratch project where I make almost everything from scratch. In doing so, I had to understand the dynamics behind the software/firmware and in order to explain the quadcopter, I can start by explaining a balancing robot. In this post, I explain the build and provide a video demo for the robot. Lets go!

 

The build

I usually build stuff from scrap and recycle what I can and this project is no different. I start with some scrap wood and made a simple box like frame. I trimmed off wood from the sides to reduce weight and to make it a little more presentable. Finally I added some paint and a quick and dirty job later, I have a robot frame.

IMG_20150411_201416.jpg

As you can see, in the above pic, I have some motors and wheels attached as well. I bought the wheels a long time back and the motors were purchased online. These motors are 288RPM 12V rated and have optical encoders so that we can track the distance moved by each wheel. I clamped these motors in place using some sheet metal pieces I cut up from the scrap tin boxes I had. You can use soft-drink Tins etc as a source of the sheet metal and self threading screws to attach them to the wooden base.

 

In order to drive the motors, I am using an L293D motor driver which came from an older robot which lost it's wheels in an accident. image

Since we need a place to put the control board, I used a cardboard box and cut out an H shaped plane to sit atop the motor driver floor. The control board itself if an Arduino Uno which I received as a part of the Internet Of Holiday Lights Challenge from Element14 and I made a shield for the MPU9150 breakout board. The image below shows the same shield but on the FRDM K64F board which I was using for the quadcopter.

IMG_9611.jpg

I scraped together some libraries from the internet for the MPU9150 as well as PID control and a few hours of head scratching later, it actually worked! The video below shows the working robot in action.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

I had some failures along the way but it was quite easy and only a few hours of work once you know what you are doing. In the next post, I will be sharing some more details on the code as well as things that you need to consider when making one yourself.

 

Cheers,

IP

  • Sign in to reply

Top Comments

  • ipv1
    ipv1 over 10 years ago in reply to 4ringfan +3
    Mark Sir, Thank you. I am writing a detailed article/blogpost/roadtest review for the FRDM K64F which uses onboard sensors and replaces the arduino. It will be posted in the Freedom/ARM sections in the…
  • mcb1
    mcb1 over 10 years ago in reply to ipv1 +3
    IP/Mike It is easier to balance a broom with the heavy end at the top. You are quite right that the tipping movement becomes greater and occurs faster ith the weight up high. David Anderson made one called…
  • dtsartsanis
    dtsartsanis over 10 years ago +2
    Very interesting project.
  • mcb1
    mcb1 over 10 years ago in reply to ipv1

    IP/Mike

    It is easier to balance a broom with the heavy end at the top.

    You are quite right that the tipping movement becomes greater and occurs faster ith the weight up high.

     

    David Anderson made one called nbot in 2003 (I saved the link in 2009), in which he explained it very well.

    http://www.geology.smu.edu/~dpa-www/robo/nbot/

    He has also linked to some other balancing bots.

     

    I've ridden a Segway and they are very easy.

    The early ones used a twist to corner, but the later use the lean of the handlebars to initate a turn.

    The batteries are low to counteract the very large human mass which is high.

    There are some copies including a unicycle version around on the internet. My favourite was a single wheel skateboard. image

     

    Mark

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • ipv1
    ipv1 over 10 years ago in reply to 4ringfan

    Mark Sir, Thank you. I am writing a detailed article/blogpost/roadtest review for the FRDM K64F which uses onboard sensors and replaces the arduino. It will be posted in the Freedom/ARM sections in the near future. Here is a demo of the board itself.

    You don't have permission to edit metadata of this video.
    Edit media
    x
    image
    Upload Preview
    image

    I am going to apply for the newer MSP432 and try to run the arduino code in energia and see how that goes image

     

    Mike sir, Thank you for the kind words. Appreciate it. Lets see if I can reply in the correct sequence.

    At first, a Segway popped into my head, but then I was like, wow.  Great idea, He's using the exact same methods that are employed within a quad copter to keep this thing vertical.  Instead of powering up or down on an opposite rotor to keep the quad level, you are just applying power to the drive motors in one direction or another.  Allowing for it to go slightly out of balance allows for forward/reverse movement.

    Both the quadcopter and the segway are similar but there are subtle differences. The segway (can) just uses a single axis of accelerometer measurement to stabilize and then supply power to the motors when there is instability. The maximum speed is determined by the power of the motors and the power supplied by the battery. There is a tipping point of every inverted pendulum which is a point of no return. In the case of the segway, it will never let you go near that point and will limit the speed and angles accordingly. In the case of a quadcopter, there is no friction nor is the center of mass separated from the pivot. In fact the pivot depends on the rotor speed and if the center of mass is offset from the middle, then the thrusts by the opposite motors will be different.One more problem in quads is the various forces such as wash from the rotors that cause instability during (slow) takeoffs. This complicates the dynamics of the quadcopter as opposed to that of the segway.

     

    The common bit in both systems is that the power by the actuators(motors) is almost always in a non-linear relationship with the angles or disturbances. We use PID control which makes sure that when the motors "come to action", they do so in such a way that the segway or quad do not "overshoot" the intended stable point. If this WERE to happen, then it would result in the quadcopter or segway to "Oscillate" like a pendulum. PID ensures that the system returns to a predefined point or orientation.

     

    Movement can be induced by either modifying the "predefined point of orientation" OR by physically changing the orientation of the SENSOR! Yep thats right. If in my robot, I tilt the sensor plane which is basically a cardboard sheet, it continues to move in a direction to make the orientation with respect to gravity back to normal. I will try and make a video of this and post soon.

    How much deflection off of level do you allow for the forward/reverse movement?  I'm sure there is a point where it is too far.  From my experiences on a Segway, the further you lean forward, the faster the Segway goes, but it reaches a point where it is going as fast as it can and it begins pushing back against you (Page 48).  http://www.segway.com/downloads/pdfs/ReferenceManual.pdf 

    In my case, I just made it as stable as possible i.e. I wanted it to stay in one place however its a bit unstable and still needs some tweaks. Ofcourse there is a tipping point and it can be reached by physically pushing it too hard. I have experimented by putting books and toolboxes on top but this one is quite stable. In the case of a segway I think the handle bar has a sensors which is used to change the setpoint of stability and hence the movement. When you push on the handle and the set point is changed, it moves forward so that the angle remains in the forward direction. If the segway is too far forward leaning then it will speed up the motors to try and make the segway upright again and vice versa. I have never seen a segway to actually know how it works but I just might try and make one...hmmm. food for thought! image

     

    The manual interrupt control for the individual wheel//wheels allow for rotation on an axis.  From watching your video it appeared that you are running both wheels in opposite directions to turn, essentially a ZTR.  If you have more of a soft analog input into the steering I suppose that you could get rotation on a wheel axis instead of rotation on the center axis.

     

    Well my intents was not to rotate the robot image but due to mismatch in the motor gearbox friction, they rotate at different speeds. Now these motors DO have optical encoders which means I can do an odometer on both wheels and do corrections BUT this I managed to put together in a few hours and hence the movement control will be part of the complete article. I am experimenting with it (actually my interns are) but I do not have high hopes image Lots can be done but I'm not the one doing anything here. In the case of the quadcopter this is another difference. You cannot calculate 'constant velocity' drifts using the inertial sensors. If anyone knows better, I would love to hear them out.

     

    Beyond that, I'm sure that having the weight of your motors low helps.  The Segways have their heavy battery source placed below the axle to help balance out the load on the motors from the people weight that is above.  Almost a "self-righting" type of mechanism, I believe.

     

    Robotic Mobility Platforms

     

    Awesome project!  Very neat.

    I started this project by taking a stick and doe and tried to balance it when the doe was stuck to the lower part of the stick and then changed the position of the doe to a higher part of the stick. In my experiment, I found that having the weight(in this case doe) at a higher point made the balancing easier since the inertia was more. HOWEVER it needed larger force. My conclusion was that lower inertial mass is good when motors are either non geared and have less torque. Conversely, higher center of mass and heavier chassis are good when motors have lower RPMs(geared) but have more torque. The fact is keeping the center of gravity high has given me an advantage. My motors are powerful enough and hence having a larger weight on the top platform. Again I may be wrong and will be doing more experiments to conclude. The basic concept is called an inverted pendulum and is a mechanical/control system problem.

     

    Thanks for the thumbs up and words of encouragement I will be back with more soon.

     

    Cheers,

    IP

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 10 years ago

    Hello,

    I´m interested on quadcopters too and found your post after a short seeking.

    TKS for sharing.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • 4ringfan
    4ringfan over 10 years ago

    ipv1,

     

    At first, a Segway popped into my head, but then I was like, wow.  Great idea, He's using the exact same methods that are employed within a quad copter to keep this thing vertical.  Instead of powering up or down on an opposite rotor to keep the quad level, you are just applying power to the drive motors in one direction or another.  Allowing for it to go slightly out of balance allows for forward/reverse movement.  How much deflection off of level do you allow for the forward/reverse movement?  I'm sure there is a point where it is too far.  From my experiences on a Segway, the further you lean forward, the faster the Segway goes, but it reaches a point where it is going as fast as it can and it begins pushing back against you (Page 48).  http://www.segway.com/downloads/pdfs/ReferenceManual.pdf  The manual interrupt control for the individual wheel//wheels allow for rotation on an axis.  From watching your video it appeared that you are running both wheels in opposite directions to turn, essentially a ZTR.  If you have more of a soft analog input into the steering I suppose that you could get rotation on a wheel axis instead of rotation on the center axis.   Beyond that, I'm sure that having the weight of your motors low helps.  The Segways have their heavy battery source placed below the axle to help balance out the load on the motors from the people weight that is above.  Almost a "self-righting" type of mechanism, I believe.

     

    Robotic Mobility Platforms

     

    Awesome project!  Very neat.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 10 years ago

    Nice work

    It looks promising.

     

    I have heard the Arduino struggles due to the relative low speed processor, but then you could use a much faster version Chipkit UNO

    element14 part number

    image

     

     

    specs

    http://www.digilentinc.com/Products/Detail.cfm?Prod=CHIPKIT-UNO32

     

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube