Show Posts
Pages: 1 ... 10 11 [12] 13 14 ... 20
166  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: December 13, 2010, 12:31:01 pm
How about you. It seems you are interested about control as well. Any other interesting projects or something?
I worked for a process control company for many years. We used to produce and sell DCS (Distributed Control Systems) and Plant Automation sensors with 4-20mA interface.
I started a new exciting :o :o :o project also based on control/balance.
I wont talk about it now to avoid polluting this thread  smiley-wink

I have seen balancing robots using simple servo motors which are pretty slow compared to other DC motors. Is the motor choice so important afterall?
My first balancing robot was based upon servo motors, using a Parallax Basic Stamp processor.

Could balance for minutes only; couldn't recover from a slight push.
I tried to adapt an IMU 5DOF sensor on this same design, but never succeeded to make it balance. smiley-sad

Look at or design to understand what stability reallly means  smiley-razz
(also this  and )
167  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: December 12, 2010, 12:15:23 pm
I am from Cyprus (where the temperature dropped under 20 degrees just yesterday...oof)
I'am jealous  >smiley-sad

The only problem is my motors. I have these cheap motors. I believe they will be able to balance the bot for tiny angle errors but not if I push the robot. What do you think?
:-? :-? :-?

120:1 Mini Plastic Gearmotor:  120RPM, 80mA @4.5V (0.36W) 20
29:1 Metal Gearmotor:  350RPM, 300mA @12V (3.6W) 110

I am affraid it's a bit short (been there, done that with Solarbotics GM9's)
120RPM is borderline
Motors may not have enough torque for rapid Forward/backward transitions

Make your boot as light as possible (<500g)
use big wheels (>80mm)
and... let us know smiley-wink
168  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: December 12, 2010, 02:57:28 am
Hi psychoul

thanks for joining us

You are right, the processor itself is not the main part of the project.
My initial intention was to describe the process using pseudo code only.
I wanted to avoid people to just "copy/paste" code, and make sure they understand what they are doing  smiley-wink.

You are welcome back with questions , and to share your development.

Not much hardware stores in my country, so everything has to be ordered through the internet which delays the whole procedure a lot!
Short of getting local convenient sources, most of us, in Europe, purchase in the USA (Sparkfun, Adafruit, Pololu...)
Out of curiosity, where are you from ??
169  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: December 11, 2010, 02:06:12 am
While my bot is sitting on the shelf, waiting for a new leg, I re read the all thread.  :o :o

Let me thank all the contributors:
   zalo, novice, haha97, thinkaneer, cr0sh, josev, Onions,
   Gibby623, Ro-Bot-X, granyte, killersquirel11, WanaGo,
   Patrik, wowmir, gbm, hoyeungl, T.J.L., pramlie, Jon D.,
   uncle_tom, RWehner, GuzZzt

Some have been rather silent recently, please stop by and share your new positive/negative experience.

For the silent others who helped generating the 28,000 read pages in the 2 threads, please introduce your project (with photos  smiley).
Let's establish this thread as a reference for others to find both inspiration and technical information.
170  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: December 09, 2010, 01:34:25 am
The mechanics comes from
GuzZzt, are you using T2.5x6mm Timing Belts??
please be more specifific and let me have a direct link to the hardware you actually use (pulleys, belts, shafts, bearing housings)
171  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: December 08, 2010, 12:26:16 pm
@ GuzZzt
I use the same wheels and motors (but only 150RPM)
Your motors may be a bit slow, you may
 - try the 90mm wheels if you currently mounted the 80mm ones
 - increase the global PID parameter (K)
 - use a smaller pulley on the wheels shafts

Please let us have a link for the belts and pulleys hardware
172  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: December 07, 2010, 12:57:51 pm
Hopefully it was not to much damage to more then the obviously
Thanks for the empathy, I just needs a new frame, a motor (bent shaft) and a wheel

Back to (nearly smiley-wink) square one

I have so far not used the values from the encoders because I want a little moer stability before I do that.
Do you have more tips on how to find the best values?
Time for encoders  :smiley
As mentioned by Patrik, please post photos of your setup.
I am curious about your motor positioning, looks like a belt transmission ??
173  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: December 05, 2010, 11:56:36 am
If your boot tells you he can fly  smiley-razz, [size=14]don't trust him[/size]
The takeoff from the mezzanine was OK, only the landing 3 meters below did create problems  smiley-wink

Well c'est la vie  :-/

I have to stop active development for some days (Xbee wireless RC is 90% completed)
For those who have started building a balancing bot, please register and share your design and/or your source code.
Any new development ideas are also welcome.

I will be back soon...
174  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: December 01, 2010, 08:58:03 am
Hi Ro-Bot-X,

I use one encoder, one channel only. As you say, 464 counts per wheel revolution is more than adequate.
In your case, quadrature (look here) will definitly increase resolution.
I currently use only one interrupt (#1) and check, whithin rencoder, the other channel logic state (regular I/O).
I make a first right/left motor speed adjustment within code, and fine tuning through micro joystick trim:

The second encoder can also be used for this task, but I hesitate to create a second interrupt within the code.
175  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: November 28, 2010, 02:20:22 am
       [size=14] ** Balancing robot for dummies **[/size]

[size=14]Part six: Motor encoders and V2.0 code[/size]

Before even thinking about R/C wandering, a  well-mannered balancing robot has to learn to stand still  >smiley-sad
Without encoders the best achivable attitude is  
The bot is aware of his vertical tilt angle, he does know anything about his position.
Lets add motor encoder(s)

Look here and here for encoders basics:

A two-channel Hall effect encoder is used to sense the rotation of a magnetic disk on a rear of the motor shaft.
The quadrature encoder provides a resolution of 64 counts per revolution of the motor shaft.
To compute the counts per revolution of the gearbox output, multiply the gear ratio by 64.
The A and B outputs are square waves from 0 V 5 Vcc, 90° out of phase.
The frequency of the transitions tells you the speed of the motor, and the order of the transitions tells you the direction.
The oscilloscope capture shows the A and B (yellow and white) encoder outputs.

By counting both the rising and falling edges of both the A and B outputs, it is possible to get 64 counts per revolution of the motor shaft.
Using just a single edge of one channel results in 16 counts per revolution of the motor shaft (16 X 29 = 464 counts per wheel rotation).

For the code implementation, first create an interrupt based on DI3 state change (see interrupt Arduino reference)

void setup() {

  pinMode(encodPinA1, INPUT);
  pinMode(encodPinB1, INPUT);
  digitalWrite(encodPinA1, HIGH);                    // turn on pullup resistor
  digitalWrite(encodPinB1, HIGH);
  attachInterrupt(1, rencoder, FALLING);

the rencoder function is called 464 times per wheel rotation, keep it small !!!
void rencoder()  {              // pulse and direction, direct port reading to save cycles
  if (PIND & 0b00000100)    count++;                  
  else                      count--;        
if (PIND & 0b00010000)  is equivalent to  if(digitalRead(2)==HIGH)
Accessing DI's state through the PIND register is just faster

The count variable is injected in the PID function in the same way as we did for the bot angle:
 - as such (wheel rotation)
 - as its first derivative (wheel speed)

int updatePid(int targetPosition, int currentPosition)   {
  int error = targetPosition - currentPosition;
  pTerm = Kp * error;
  integrated_error += error;                                      
  iTerm = (Ki/5) * constrain(integrated_error, -GUARD_GAIN, GUARD_GAIN);
  dTerm = Kd * (error - last_error);                            
  last_error = error;
  pTerm_Wheel = Kp_Wheel * count;          
  dTerm_Wheel = Kd_Wheel * (count - last_count);                            
  last_count = count;
  return -constrain(K*(pTerm + iTerm + dTerm + pTerm_Wheel + dTerm_Wheel), -255, 255);
After properly tuning the 6 ( :o) parameters of the PID algorithm, your bot should finally stand still.

I will send kasBot V2.0 to Patrik for publishing in his blog
Patrik please add the encoders PID parameters as tunable values in BalancingBotGUI v1.3
176  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: November 28, 2010, 02:13:26 am
I dont want that, I want to beat a cat, to hit a ball , 60g tennis ball at 4m/s. we can do this, you me and everyone here. Blues brothers.
+1  My final goal is definitly perfect balancing - long is the road   :smiley :smiley :smiley
177  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: November 27, 2010, 03:08:55 am
 - plain DC motors
 - coreless motors
 - brushless motors
 - continuous rotation servos
 - spurs gearbox
 - planetary gearbox
 - belt transmission
 - ...
the perfect cinematic chain still needs to be identified  :-?

patrik, I also noticed that motors have different forward/backward response.
Make sure that you use the total potential power of your motor. Monitor you PWM output, and check that value is not clipped by the K parameter.

The answer is software or hardware related (or a combination of those)
Low RPM with high torque can be obtained through an additional PID loop

Backlash may be addressed within the code
Look at this one:

cheap motors with plastic gears, small wheels, excellent results  :o
I hope Dominic will jump in and share his experience

just bought 2 RE-max graphite,22W, 16Amax, VNA30A dual control fron spark and ITG-3200 for my next 4-wheel balancer, I need to learn about li-po
whats that coming over the hill, is it a monster, its a BF952.
beautifulsmall, This new digital output gyro looks promising.
Please let us have a link to the motors you mentioned

178  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: November 25, 2010, 02:06:29 am
How did you read the SPI bus? Does your processor support SPI, or did you implement a bit banged solution?
ATmega168 and 328 are supposed to have built-in hardware support for SPI
I still manage the MCP3208 by the bits
Look here and here

What processor are you using ??

Shall I understand that you build robot at school??  lucky guy smiley-grin
You are also lucky because robot technology will develop quickly, and you will probably never fear unemployment...
I understand you are developing a different software, but still, can you check your raw sensor value and make sure that you get a symetrical pattern, as per photos in reply #113
Looking at the bot height, I suspect you are not a shy guy  smiley-wink
Anycase, good luck for your exams. I hope you will come back later and give us additional infos on state-feedback.

Belt transmission is probably the way to go for zero backlash, but not easy to implement
Are you using the Pololu 350RPM motors ??
I confirm that backlash is noticiable, but it doesn't prevent proper balancing.

I started to check the differences of the motors by using the encoders to try to see the distance the motors turned in a constant time and get a factor for the diff. I drive the motors in both directions in four different speeds 50, 100, 200, 250..
I will read your blog entry and come back soon
179  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: November 23, 2010, 02:06:38 am
Im starting to implement encoders and then make:
torque = P1 + D1 + P2 + D2
(1 = error from sensor --> complementary filter)
(2 = error from encoders)
You are on the right track  smiley-wink
More info later this week

Hi Osman, welcome, thanks for your comments
1. Is a 10ms loop sufficient, or should I try to go faster if my peripherals allow it?
100hz is plenty. I adjusted loop time up to 200Hz without any significant change in attitude.
Try for yourself and make sure that your processor can cope with the situation (STD_LOOP_TIME - lastLoopUsefulTime should be >o), especially if you send wired or wireless debug info to your PC

2. I can't access the A2D on my CPU. I need to purchase a separate A2D chip to read the gyro. Is a 10 bit A2D sufficient, or should I go 12 bits?
Go for a 12 bit ADC

3. Can anyone suggest a good standalone A2D for a balancing robot?
I strongly suggest MCP3204 or 3208. I am currently testing this chip, source code available on request

The robot Is starting to get heavy, 2.359 kg  , don't know if that can give me some troubles..
You built a balancing sumo  smiley smiley
Keep us aware
180  Forum 2005-2010 (read only) / Exhibition / Re: Balancing robot for dummies on: November 21, 2010, 07:08:44 am
Hi Ross

Thanks for the link  smiley
IR memotes are nice and inexpensive for R/C
They are very good at ON/OFF control, but for Analog/proportional they lack flexibility.
In our case, analog joysticks are much better for the job

I will post new tutorials (encoders, R/C control) later this week
Pages: 1 ... 10 11 [12] 13 14 ... 20