One drawback to the pot is that something connected to it is actually touching the ground as a reference so that affects the overall system. Any low-friction, high linearity pot should work okay though. The sin and cos functions in c18 are for floats, you'll definately want to see how long the= y take. To differentiate and integrate a digital signal subtract and add.. differentiation is the rate of change from one sample to the next and integration is the sum of the samples. So to integrate your error, for instance, just keep up with (in a FIFO buffer) the last several error terms you've calculated and used in your PID loop and sum them. The length of the buffer is something like the time constant. James On 11/16/05, 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? H= ow > do you integrate or differentiate in C? > > 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 u= sed > it. > > 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 til= t > 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 i= t > > 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 > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist