BEI GyroChip Problems

We have recently begun work with sensors on our 2005 bot, and have been using Kevin Watson’s Gyro code, unmodified. We are using a BEI gyro, the model of which can not be discerned. The only clue is that is has a three wire linear input on the top of the gyro, as versus the side, triangular patterned gyro’s input. Its wired as per the FIRST manual of 2004, into analog input 1.

When we start the bot, it brings up the terminal window after a few minutes, with the appropriate statements, but exhibits a bias of > 3000, and though the angle is very good about not wavering, so is the gyro output! It seems to take repeated shaking to get the gyro output statement to read much of anything, and only then does the angle increase. It also seems to favor a negative output.

We have switched the BEI gyro #define in order to facilitate the possible rate of our gyro ( as we don’t know the actual rate). Nothing works, and we keep getting wacko outputs as said. I have the sneaking suspicion the gyro is kaput. It was found lying around, so it may be broken. Any ideas would be appreciated, as i just about lost my mind trying to figure out what was wrong.:ahh:

its possible you have it connected wrong. FIRST use to give out similar gyros in the kit of parts several years ago, and as I recall there were two different versions, with different pinouts.

Best way to debug it is to hook a meter to the gyro output and see what its doing when you move it. It should sit at midrange (2.5V) when the gyro is steady, and move up or down as the gyro is moved left and right.

If it wont do this, your code has no hope. Its possible you have the power, gnd and output pins wired the wrong way.

I have the spec. papers for those older gyros somewhere in the robotics room. I will scan them in if I can find them. It is easy enough to distinguish between the two different versions FIRST gave out.

Are you sure you performed all of the installation steps mentioned in gyro_readme.txt and adc_readme.txt? The data sheet for your gyro is attached.


gyrochip.pdf (58.4 KB)

gyrochip.pdf (58.4 KB)

The steps were followed, I believe, but we’ll have to double-check. Thanks for the data-sheet Kevin, I googled it but couldn’t find one. I’ll have to go in and try it tommorrow. Ummm, dumb question, but with all the problems we’ve had with it, we never found the axis of sensing. Anyone care to real quickly describe it?

It’s in the data sheet.


If you put the side with the bolt holes facing downwards, the gyro will detect rotation about the vertical axis.

We tested the thing again this afternoon and after taking apart the connection and reconnecting it, the problem was solved. It was correctly hooked up, but something in our original connection was bad. With a little modification to the dead band it will be working beautifully. Once again, thank you Kevin for such a great code repository!

Well, a new problem arises. Our gyro works wonderfully now, but it seems that we can’ get any pwm outs to the RC. We’ve adjusted our sampling to 8, and our rate to 200hz, but still to no avail. No red light of death, but no pwm outs. Any suggestions??

I just tried the gyro code with a slight modification to simultaneously sweep a couple of servos through their range while the gyro operated and it worked just fine. Are you sure you’ve got everything wired correctly? The victors/servos are known to be good?


Well, thats why I’m so i’m frustrated. When we load our standard code in, everything works fine. Maybe we accidently forgot to initialize a pwm somewhere? Well, I’ll try to move the important sections to our code as you said to. Maybe that’ll fix it. I don’t think it’s your code. I think we might just be overloading our controller. We’ll get it eventually…:rolleyes:


Silly question, but do you still have the “Putdata(&txdata);” line at the end of the Process_Data_From_Master_uP routine and it’s being executed? If that line is missing or not at the end, you may not be passing the new pwm values to the master processor. If your using PWMs 13-16, you need the Generate_Pwms call as well.
You also might want to try printing out the pwm value just before the Putdata call just to verify you have your expected pwm value and it’s not getting overwritten somehow.


Haha, I feel like a fool. The ultimate problem was caused by me not uncommenting the Default_Routine() in the user initialization. Dang it! Mike got me thinking, and I started to look for where Default_Routine() was called, and found that I had neglected to uncomment it. Well, I should be used to it by now.:rolleyes:

Kevin thanks for actually testing the code out for me on your time! I figured it wasn’t your code, but it’s the thought that counts! Thanks!