Balancing Robot (Minimalist Design Using Only Accelerometer)

Anything related to the ROBOT. Head to Toe Magazine.

Balancing Robot (Minimalist Design Using Only Accelerometer)

Postby SnowLeopard » Wed Sep 29, 2010 9:44 pm

Hi.

I am building (or at least trying to) build a 2-wheeled balancing robot. The robot's hardware is in place - I am trying to make it balancing using only an accelerometer. :D

Motors and wheels are exactly the same as the Mini Balancing Robot in the magazine. Driver is also L293D controlled by the CCP module in PWM mode. Motors are running at 5V from 7805 regulator (to provide a roughly constant response).

Microcontroller is PIC16F876A running at 20MHz. The robot is only about 25~30cm tall too. Accelerometer is the ADXL335 but I'm only using one axis. I'm incorporating a PID controller and Moving Average Filters for the ADC data, but i guess something is wrong somewhere in the loop... Programming in PICC. ;)

At the moment... It is not balancing... I've been trying for quite a while to make it balance bot to no avail... I'm not sure what is wrong... :(

Could somebody please answer some of these:

1. Where do u reckon is the best place to mount the accelerometer? Its currently placed somewhere in the middle of the robot's body (height).

2. Which axis do i have to use for balancing? Only one is enough?

3. Are my motors underpowered? They are the MO-SPG-10-30K.

4. Which is the best axis to use? I'm using the one perpendicular to the robot (parallel to the ground).

5. Should I use 5V for the accelerometer, and if so, does it output 5V or still 0~3.3V? If 3.3V, should I use 3.3V reference for my microcontroller?

I've attached a picture of the robot. If you see anything else that might be wrong with my robot, please let me know. Please reply asap if you can.

Thank You Very Much. :D
Attachments
Equilibrio_Picture.jpg
This image has been greatly reduced in quality to make it easier to upload. If you need different pictures/higher resolution please request. BTW, the robot's name is Equilibrio (Spanish for "Balance").
User avatar
SnowLeopard
Freshie
 
Posts: 7
Joined: Wed Sep 29, 2010 12:00 am

Re: Balancing Robot (Minimalist Design Using Only Accelerometer)

Postby waiweng83 » Thu Sep 30, 2010 9:51 am

SnowLeopard WROTE:I am building (or at least trying to) build a 2-wheeled balancing robot. The robot's hardware is in place - I am trying to make it balancing using only an accelerometer. :D


This is not possible to use only the accelerometer for balancing. The reason is the accelerometer does not only measure the gravity acceleration, it also measures the dynamic acceleration caused by the movement of the robot.

To solve this problem, you need both the gyro sensor and accelerometer their outputs are fused together with Kalman Filter / Complementary Filter to get the actual tilt angle of the robot. Please try to search for "Kalman Filter", "IMU" etc in Google.


SnowLeopard WROTE:1. Where do u reckon is the best place to mount the accelerometer? Its currently placed somewhere in the middle of the robot's body (height).


It's best to place it at the pivot point of the robot. Same for the gyro sensor too.

SnowLeopard WROTE:2. Which axis do i have to use for balancing? Only one is enough?


Yes. One is enough.

SnowLeopard WROTE:3. Are my motors underpowered? They are the MO-SPG-10-30K.


It depends on many factors. If you feel that it's under power, you can increase the voltage to 9V.

SnowLeopard WROTE:4. Which is the best axis to use? I'm using the one perpendicular to the robot (parallel to the ground).


That's right.

SnowLeopard WROTE:5. Should I use 5V for the accelerometer, and if so, does it output 5V or still 0~3.3V? If 3.3V, should I use 3.3V reference for my microcontroller?


You should NOT use 5V for the accelerometer. According to the datasheet, the accelerometer only can operate with Vs in the range of 1.8 - 3.6V. 5V will most probably spoil the accelerometer.

Regarding the 3.3V reference, it's up to you.
With the power of dream, nothing is impossible...
User avatar
waiweng83
Moderator
 
Posts: 205
Joined: Wed Apr 15, 2009 2:17 pm

Re: Balancing Robot (Minimalist Design Using Only Accelerometer)

Postby SnowLeopard » Thu Sep 30, 2010 3:01 pm

Hi.

Thank you very much for your tips. I have been powering the Accelerometer with 5V for a while... Didn't notice the 3.6V maximum in the datasheet! :o

1. Is there a way to determine if it is still functional? Reading the ADC, it gives a response, but I'm not sure if its right... the ADC output (10-bit, 5V REF) reads voltage swings from 200 something to 400 something when i tilt the accelerometer back and forth.

2. As for the gyroscope... If all the robot has to do is balance in place, is it still a must for the gyroscope? If it is, i'll install it immediately. :D

3. Err... could you describe more on the pivot point of the robot? Or how exactly to estimate its location? :?

4. One more thing - is it necessary to have feedback from the motors like the Cytron Mini Balancing Robot? I read that it uses the motors' EMF reading?

Please get back to me on this one as soon as you can. Thanks very much!
User avatar
SnowLeopard
Freshie
 
Posts: 7
Joined: Wed Sep 29, 2010 12:00 am

Re: Balancing Robot (Minimalist Design Using Only Accelerometer)

Postby waiweng83 » Tue Oct 12, 2010 9:55 am

SnowLeopard WROTE:Thank you very much for your tips. I have been powering the Accelerometer with 5V for a while... Didn't notice the 3.6V maximum in the datasheet! :o

1. Is there a way to determine if it is still functional? Reading the ADC, it gives a response, but I'm not sure if its right... the ADC output (10-bit, 5V REF) reads voltage swings from 200 something to 400 something when i tilt the accelerometer back and forth.


You can measure the output of the accelerometer by using the multimeter while rotating it. If the voltage range is equal to +- 1 G (I'm not sure how many volts, please check the datasheet), then it's functioning properly.

SnowLeopard WROTE:2. As for the gyroscope... If all the robot has to do is balance in place, is it still a must for the gyroscope? If it is, i'll install it immediately. :D


Yes, you still need it.

SnowLeopard WROTE:3. Err... could you describe more on the pivot point of the robot? Or how exactly to estimate its location? :?


Pivot point is the axis that where the robot rotates.

SnowLeopard WROTE:4. One more thing - is it necessary to have feedback from the motors like the Cytron Mini Balancing Robot? I read that it uses the motors' EMF reading?


Yes and No. Yes if you need to control the position and speed. Otherwise is No. Using motor's back EMF is a cheap but inefficient method. Rotary encoder will be a better choice.
With the power of dream, nothing is impossible...
User avatar
waiweng83
Moderator
 
Posts: 205
Joined: Wed Apr 15, 2009 2:17 pm

Re: Balancing Robot (Minimalist Design Using Only Accelerometer)

Postby wtf » Mon Oct 25, 2010 1:05 pm

Kalman filter with the sparkfun/cytron 5DOF took me weeks to finish and now is only the balancing part. Its written in your volume 4 head to toe that to reduce cost, no encoder is used. Im planning to do the same thing. Im also planning to used MO-SPG-10-150K motor + Mini Wheel 46x10 mm which will soon be 50%. Can you please give me an idea of how can i use the back emf as feedback? I tried using only pulse width modulation with no feedback and it can hardly balance itself. I understood the PID very well but im not sure of the emf. Im sorry but i dont even have any idea of using the back emf. Thank you.
wtf
Freshie
 
Posts: 4
Joined: Mon Jun 07, 2010 12:28 am

Re: Balancing Robot (Minimalist Design Using Only Accelerometer)

Postby waiweng83 » Mon Oct 25, 2010 1:44 pm

For more information on back EMF, you can refer to this site: http://www.acroname.com/robotics/info/a ... k-emf.html
With the power of dream, nothing is impossible...
User avatar
waiweng83
Moderator
 
Posts: 205
Joined: Wed Apr 15, 2009 2:17 pm

Re: Balancing Robot (Minimalist Design Using Only Accelerometer)

Postby wtf » Mon Oct 25, 2010 1:48 pm

Well i finally did some research myself and found out that Back-EMF refers to using the voltage generated by a spinning motor (EMF) to conclude the speed of the motor's rotation. This can be used in motion control algorithms to modulate the velocity or to compute the angular distance the motor has traveled over time. So i took an old dc motor and just add a multimeter at the +ve and -ve wires. I start turning the motors and it appears that there is changes in voltage as i spin the motor. The faster it spins, the higher the voltage. So this actually makes sense. The only problem i have now is if i actually connect my motor to the power source and it started turning, m i just measuring the power input to the motor of the emf of the motor. Because it is connected to the same place. Or is there a type of circuit that has to be done before i measure the emf. Thank you.
wtf
Freshie
 
Posts: 4
Joined: Mon Jun 07, 2010 12:28 am

Re: Balancing Robot (Minimalist Design Using Only Accelerometer)

Postby robosang » Mon Oct 25, 2010 9:04 pm

I think the measurement is taken at the motor terminal point, but when the power is off, for example during PWM off cycle, correct? Just guessing :shock:
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: Balancing Robot (Minimalist Design Using Only Accelerometer)

Postby SnowLeopard » Wed Oct 27, 2010 1:17 am

@waiweng83: Ok, thanks. ;)
User avatar
SnowLeopard
Freshie
 
Posts: 7
Joined: Wed Sep 29, 2010 12:00 am

Re: Balancing Robot (Minimalist Design Using Only Accelerometer)

Postby zhenning » Sat Jan 01, 2011 1:06 pm

Yup. thats is one of the method. Do check out PIC tips n tricks. If i am not mistaken, there are a few methods mentioned there :)
zhenning
Enthusiast
 
Posts: 351
Joined: Thu Dec 30, 2010 12:32 am

Next

Return to ROBOT. Head to Toe Magazine

Who is online

Users browsing this forum: No registered users and 2 guests

cron