Hi. I'm doing a university project and I'm trying to make a controller for an electric longboardboard that gives me the tilt angle of my board, basically I want the board to detect when the user starts going uphill, and from the angle of inclination, produce an output signal for a motor, so the steeper the hill the more power output. At the moment i'm only working with small 6V dc motors just to model the output visually. I have set up a really basic model which kind of works, it uses an ADXL335. As i tilt it a small motor starts to rotate, faster depending on the gradient.
The problem is, if applied to a real board, when pushing the longboard there are obviously large spikes in the output readings which give false hill gradients causing the motor to speed up. Does anyone have any suggestions of how I might filter these spikes out? It doesn't matter if there is a bit of a delay. I'm only concerned with one direction of movement, when the board is going forward, and for my project, if it was easier I could even use a single axis?
I'm thinking that I might possibly need an IMU instead of the accelerometer by itself? but even then it will still have similar problems without filtering? but may give a smoother more constant reading?
I am an amateur Arduino user (first time) so any help would be really appreciated!
Thanks!