Arduino tilt sensor troubleshooting

Hello!

I’ve got a Arduino Leonardo + gy521 tilt sensor all loaded up and the code is working for the most part. One problem I am having is that the tilt sensor seems to be “jumpy” when I run it as a joystick game contorller.

Should I just try to solder a new set of board items in case it’s a electrical fault?
Do i need to manually adjust tolerances? What’s worked for people in the past?
Overlapping projects include self correcting drones if anyone’s worked on those.

I played with the MPU6050 as an inertial guidance system a few years back. I used an Arduino Nano and cursed the day I started the project because the darned thing froze, which is not the problem you are having. Still, because Invensense makes it hard to work with its chips, the MPU6050_6Axis_MotionApps20.h was “sniffed” from somewhere so it is setup for some device other than an Arduino. In MY case it turned out to be the FIFO rate. I found that the Arduino couldn’t handle a rate above 100 Hz. The default for this one is 200Hz. I can’t remember why I decided to look at that parameter… instinct, dumb luck… but I got it to work like a champ.
I don’t really understand using it as a joystick game controller and a parameters in that program could very well be the issue. However, you might be lucky and just need to duplicate my fix.
In the code from the website this appears to happen in lines 321 and 322. Anyway, that’s just a suggestion and just requires a simple code change.

2 Likes

hey thanks for taking a minute to skim the code actually! thank you so much! Since the woodshop is down I’ll probably be working on this tonight instead.

The game controller idea is new as of the Leonardo gen since the leonardo + mico pros let you plug into a pc and have it recognized as a HID (ie mouse/ keyboard etc) without much trouble