Measuring the tilt of a longboard/skateboard

Hi,
I'm trying to come up with ways to measure the tilt of a longboard deck while steering/turning.
I'm working on a project to control LEDs below the board by changing the direction you roll.
This is a video of my first functional Version.

For people, who are not familiar with longboards/skateboards: you control it by shifting your weight left or right, that causes the trucks to change direction as you can see in this picture and in the Video above.

I already tried mounting simple accelerometers that give me an analog value. They worked while standing but as soon as I started rolling on the street, I couldn't get a proper value because the sensor was too sensitive (mini shocks from the street, wheels are hard, so there is nothing to reduce the shocks)

My second idea was using distance measurement from the deck to ground with IR or ultrasound but never ended up using it because of the method I am currently using:
mounting a flex sensor (resistor, that changes value depending how much you bend it) between the axle and the board/truck base like on the attached picture.
It currently works for me but I'm eager to know if there are any other ways to measure this.

Thank you in advance

I already tried mounting simple accelerometers that give me an analog value. They worked while standing but as soon as I started rolling on the street, I couldn't get a proper value because the sensor was too sensitive (mini shocks from the street, wheels are hard, so there is nothing to reduce the shocks)

Did you try to average e.g. every 4 readings?

robtillaart:
Did you try to average e.g. every 4 readings?

yes, I was plotting the raw values and they were all over the place as soon as I started to roll at walking speed.
An average reading couldn't really get a proper value out of it.

So you are searching for a "slow" sensor

robtillaart:
So you are searching for a "slow" sensor

I guess slow is the right word.yes.
A Sensor, that ignores these many short shocks from the wheels and still measures the relatively slow tilting.

I already tried mounting simple accelerometers that give me an analog value.

The problem with that is G-force while turning (as well as the shocks). Plus, it's hard to pick-up slow or slight movements that don't give much output.

Maybe you can rig-up a potentiometer? A strain gauge might work too, but you'd probably need to attach it to a spring or something, they require "tricky" amplification, and you'd have to calibrate it.

DVDdoug:
The problem with that is G-force while turning (as well as the shocks).

Agreed. An accelerometer by itself won't be able to determine the orientation of the board. This requires both gyros and accelerometers.

It seems like this would be a great application for something like the MPU6050 or even better (and more expensive) the BNO055.

These sensors will output the heading, roll and pitch. As long as the sensor is mounted correctly, it should provide reasonably accurate roll values.

DuaneDegn:
It seems like this would be a great application for something like the MPU6050

Actually, I think I have this one somewhere lying around. I never hooked it up, though because I was too overwhelmed by the DMP and the FIFO buffer.

katofl:
Actually, I think I have this one somewhere lying around. I never hooked it up, though because I was too overwhelmed by the DMP and the FIFO buffer.

I agree there's a lot of stuff going on but the I2Cdev library takes care of loading the DMP code for you. I played my a MPU6050 a bit and I was amazed it how well it worked. It really seemed like magic.

I was recently using Adafruit's BNO055 sensor which I thought was amazing but I did something to kill mine. I just ordered another one. It costs ten times as much as the MPU6050 but it takes care of filtering the magnetometer data for you. It also calibrates itself as its used.

I watched your video and thought it looked really cool. If you wanted to add features, you could add some sort of mode selection option. You could use some sort of tapping sequence to indicate which mode you want to use.

You could have modes where the lights are affected by the heading you're traveling, You could also add extra effects to show how hard you are turning (based on either the heading change or the extra acceleration from turning).

I hope you share future videos with us.

I'm fiddling around with the MPU6050 and the example codes to see which function does what and which is necessary for what I want to do. So I am actually deleting code from the example until all that is left is that, what I need.
Right now I only want a reliable value for the tilt.
I don't know if I really need the Interrupt functions of the sensor and the other extra stuff

I didn't metion it in my OP post but I am also measuring the rpm to display it on an alphanumeric 4-digit display and to control a chasing light on the strip.
The chasing light should move in the opposite direction the board is moving with the same speed, so it looks like the light does not move relatively to the ground. And the color changes with the tilt, but you're right: If I can get the MPU6050 to work and, I could make more use of it.

katofl:
Right now I only want a reliable value for the tilt.

You can't do it with an accellerometer unless nothing is moving. It's the physics of the universe - you can't differentiate gravity from accelleration.

aarg:
You can't do it with an accellerometer unless nothing is moving. It's the physics of the universe - you can't differentiate gravity from accelleration.

That's why I am trying to get the MPU6050 to work