James James wrote: > Thank you for your reply. I use MCC18 compiler, so it has sine & cosine functions. Does the sine/cosine function take a lot of time to execute? How do you integrate or differentiate in C? Yes, the computation of arcsin/arccos/arctan takes a very long time compared to other functions. (you're using it to linearize the sensor output). Given that you are only going to have to deal with a slight amount of tilt near vertical (otherwise the robot falls over) you can probably use the output directly. For small angles of tilt (<5 degrees), the signal and SIN of the signal are nearly identical for your purposes. Or use a lookup table to get you close enough, with interpolation if needed. You only need 1/4 of the cos cycle since it is symmetric and only the sign changes. The problem you will have with using an accelerometer to sense tilt is that the rate of change of the signal is quite low for the way you will need to use it (flat, so that you're on the crest of the sin wave so you can tell forward tilt from backward). Differentiating the accelerometer will probably not give you a good enough signal to have good stability. You also need to search the PICLIST archives for a long thread on PID (Proportional, Integral, Differential) control to find URLs that will get up that learning curve. You don't want your robot flailing about because if inadequate control. > Is the pot you mentioned about a special type? The only two types I know of are the one with the turn knob and the one with the slider. There must be some drawbacks for using the pot, right? Otherwise, everyone would have used it. Yes, a pot tends to oscillate after a sudden change. That is bad for stability. You can damp it by placing the pendulum within oil, but that reduces response time.In other words a pendulum pot is much slower to respond to changes than an accelerometer. Good luck. It looks like you have a fair bit of learning ahead of you. Robert > > Best regards, > > James Humes wrote: > Hey James, > I set up an ADXL accel. in analog mode for static tilt measurement > (following the datasheet) about a year ago and it worked fine with only a > little averaging. Differentiate that signal to find the rate of change of > angle. The only thing I could see holding you up is that to calculate tilt > you have to take a sin or cos.. that could limit your sampling rate. > I have built a balancing robot before (from the same inspirational source.. > nbot) so I'll be happy to offer any experience I have from that. I used a > pot to measure tilt for simplicity. > James > > On 11/16/05, James James wrote: > >>Hi Robert, >>Thank you for your reply. Are you suggesting to only use the gyro and >>forget about the accelerator? how about the Freescale accelerator? Is it >>noisy too? Thanks! >> >>Robert Rolf wrote: >>The accelerometer signal needs to be differentiated to get >>velocity. The ADXL signals are quite noisy so you are better >>off having a direct velocity signal from a gyro, particularly if >>using PID control. >>Robert >> >>James James wrote: >> >> >>>Hi everyone, >>> >>>I am thinking to build something like the nBot from >>>David: >>>http://www.geology.smu.edu/~dpa-www/robo/nbot/ >>> >>>I think it would be very cool to put the Feedback >>>Control Theory I learned to practice. I am currently >>>gathering information/parts to build the robot. >>>Anyways, I have few questions: >>> >>>1. Isn't the accelerator alone enough? I mean all >>>you need to know are how fast the robot is tilting and >>>the current tilt angle, right? Couldn't the >>>accelerator alone do all that? >>> >>>2. What's the role of the gyroscope? I understand >>>that the output voltage change of the gyro is >>>proportional to the speed or rate of the tilt angle. >>>Isn't it the same as what the accelerator does? >>> >>>I am refering to the DXRS150 gyro and the >>>ADXL203/MMA7260 accelerators. >>> >>>Best regards, >>>James >>> >>> >>> >>> >>> >>>__________________________________ >>>Yahoo! FareChase: Search multiple travel sites in one click. >>>http://farechase.yahoo.com >> >>-- >>http://www.piclist.com PIC/SX FAQ & list archive >>View/change your membership options at >>http://mailman.mit.edu/mailman/listinfo/piclist >> >> >> >> >>--------------------------------- >>Yahoo! FareChase - Search multiple travel sites in one click. >>-- >>http://www.piclist.com PIC/SX FAQ & list archive >>View/change your membership options at >>http://mailman.mit.edu/mailman/listinfo/piclist >> > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > > > > > --------------------------------- > Yahoo! FareChase - Search multiple travel sites in one click. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist