Question on accelerometer and Atom pro code

I wrote i little bit of basic code for an accelerometer and atom pro. It is really hard to get it working, i am just fiddling around a little right now. Only problem i keep on having is that that read out from the accelerometer is somewhat jerky, probably due to jitter etc of the servos, because when powered down there seems to be less of a problem with the value. I have tried averaging, that is to say, instead of taking one measurement i took several and averaged. I made i deadzone, but still. The deadzone has to be quit big to have it less jerky (30 percent of the range!?!). Anyone suggestions as to how the get a value that is less susceptible to instant changes? Anyone some example code how they solved it? I put a small movie in wich i reversed the x and y output. So now it doesn’t level on the floor, but ‘in the air’. And it does a calibrate routine first, asi said i was fiddling around. You can see it works…somewhat, but pretty jerky. Any advice is welcome…

Hard to tell. I played with a 2D accelerometer, but didn’t get it on a 'bot yet.

Where is the sensor located? Is it up in the “head”? If so, Looks like the “neck” is flexible; maybe it gets bounced more?

Your deadzone and averaging sounds reasonable. Maybe graph it out? A little sensor fusion (if you have other sensors) or filtering might work.

Alan KM6VV

Alan KM6VV

Its a catch 22 on this one. Iv been observing the footage and from what i can see everything it working fine. Or as its designed to do. By this i mean as the sensor is tilting (by you) the legs are working as they should. But when you place it on the table (tilted) it won’t return to normal because you haven’t told it to. The sensor remains tilted because the legs are doing what their told to do by the sensor. If that makes sense. Can you post your code? You need to make a command to make the body return to normal.

Thanks for the reply, made me think.

About the placement. I was thinking the closer to the center (x,y and z) the better. I have fixed it to the body because it seems to experience te least amount of interference there (jitter etc.) And besides the averaging and the deadzone i was thinking about a default to zero of a kind… so innerbreed that does make sense.

I’ll try that and post the results.

Some accelerometers have a place to solder in a capacitor across the analog output that can be used to directly filter the output. Might be worth a try. I think the main problem is an accelerometer will provide the angle of the object it is connected to when it is stationary, but it has errors when the object is in motion. I think if it were to be accompanied with a gyro the error could be corrected.

Okidoki, that helps! I am first gonna be stubborn i guess and try a software sollution and then go on to the capacitor and eventually the gyro sollution…