Hi,
I was wondering if anyone else has a problem with accelerometer values. I programmed my bot to move its treads back and forth if it has fallen on it’s side (on the side that it’s not laying on) to alert it has flipped. My problem is that sometimes when it is on its side, The Y axis (and both pins are removed to make it more precise) will go crazy. When it is normally 500, it can go down to 300 and up to 700 in a fraction of a second.
I tried without the treads moving, and it remained at 500. Is this electrical interference or vibrations, and how can I fix it? Thanks so much!
If sounds like you have some hypothesis already.
Now just think of some ways to test for them.
If you lay the robot on the side and remove the top tread, then there will be less vibration, but the same electrical.
If you lay the robot on the side and unplug the top tread motor, and then move the tread by hand, there will be less electrical, but similar vibration.
Or you could just try other available options, like not removing some pins.
My guess is vibration, and adding a mechanical low-pass filter would likely help. You could try firmly mounting the sensor to something massive (like the battery), then mount the battery with some vex foam or traction mat padding. Or try any other change in mounting methods: hard screwed to frame vs padded with foam vs mounted to different places on the frame.
You could try a software rolling average low-pass filter.
I’m puzzled by your original description though. If you can’t tell that the robot has tipped over by looking at it, how will moving the treads in a certain pattern help?
Thanks for your help! It was vibrations. I put some paper towels wadded up between the accelerometer and the bar I mounted it to. It works great! It’s strange that it was vibrations, since I touched the bot and couldn’t feel anything.
LOL, it is pretty stupid, but I just did it to test my code, and realized that it might be a problem later on.