As you can see by my post count I am new to this forum but I am also completely new to robotics as well. I am trying to solve a problem and after scouring the internet for several days, it seems this forum has some discussion loosely around my problem but not exactly. I've read several threads on this board and some others like: http://www.teamhassenplug.org/NXT/NXTSensors.html.

It would seem that (1) a sensor that will accomplish my needs does not exist, (2) angle by accelerometer will be fooled by lateral acceleration and deceleration, (3) gyro sensors will measure the speed of tilt but not the tilt itself. The question I see asked constantly on the net goes something like:

Q: Can I use an acceleration sensor on a bot going a steady speed to measure tilt?

To which the answer is usually, yes. My question is; if not going a steady speed (assuming a 1 - 2g accel/deceleration), what can I use to measure tilt?

The naive part me is hoping there is a nice package to buy, but if I need to do some work, I'm willing to try (even though I am very novice in electronics).

My first thought when starting was "how do RC copters do this", so I trolled through a bunch of RC sites but was unable to get pinout and output signal specifics as the modules all seem to be plug and play... for RC helicopters (which makes sense).

I have a drag car that runs in a limited class where wheelie bars have been banned. If you've ever watched drag racing, wheelie bars are those long sticks that extend from the rear of the car to prevent the front end from rising too high under power. When you have a car that gains a lot of traction on launch but omit the wheelie bars, this happens:

[youtube]YhPn5_Z0qfADragginBumper[/url][/youtube]

In drag racing, our goal is to get from point A to point B as fast as we can, if you are going up, you are not going forward. In addition to this, it's really hard to drive the car when you can only see the sky and the front wheels no longer steer the car (because they are in the air). hence, the goal is to have a device that will measure tilt, plug it into my timing computer, and reduce timing (horsepower) as the tilt of the vehicle increases.

My project...

I want to build a device that will measure the tilt of the car on a single axis and report that value using an analog signal. Almost all tilt sensors today use an accelerometer and since later acceleration will be a function of g measurement, the tilt measurements from these sensors (like digital protractors) are significantly changed by the vehicle's acceleration and deceleration. My specifications are roughly predetermined because I only have one input port on my timing computer, the MAP (Mass Air Pressure) sensor port. The MAP port has a 3-pin plug. That plug has GROUND, 5v+ OUT and 0.5v-5v IN/SIGNAL. The computer reads 0.5v as a baseline (usually sea level ambient pressure) and 5v as a max (somewhere around 30+ PSI). I plan to replace the traditional MAP with a "tilt" sensor that will output 0.5v at a 0 degree tilt and 5v somewhere around a 90 degree tilt with of course all the variable voltages in between.

It's pitch (as related to your rear axle) that you wanna measure, so you should be looking for a gyro.Don't mine your specs too much. I guess you have 12V (or 24V) allready and the rest is just creating the interfacing to suit your ECM.Actually, it doesn't even have to be particularly linear, as it will be a closed loop (motor, chassis, gyro and all). And it should never get anywhere near 90° as long as the electronics work

A couple of other possible ways to detect front end lift:- IR distance detector (but it may be too slow?).- Strain gauge on the front suspension.(just off the top of my head - there's allways several ways to shave a goat).

Btw. How long time from start to a lift of say 5°, 10°, 15° etc. (just trying to get a comprehension of what timing restraint there will be).

« Last Edit: April 05, 2010, 04:14:14 PM by Soeren »

Logged

Regards,Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?Please remember...Engineering is based on numbers - not adjectives

It's pitch (as related to your rear axle) that you wanna measure, so you should be looking for a gyro.Don't mine your specs too much. I guess you have 12V (or 24V) allready and the rest is just creating the interfacing to suit your ECM.Actually, it doesn't even have to be particularly linear, as it will be a closed loop (motor, chassis, gyro and all). And it should never get anywhere near 90° as long as the electronics work

A couple of other possible ways to detect front end lift:- IR distance detector (but it may be too slow?).- Strain gauge on the front suspension.(just off the top of my head - there's allways several ways to shave a goat).

Btw. How long time from start to a lift of say 5°, 10°, 15° etc. (just trying to get a comprehension of what timing restraint there will be).

In order...

The car is a 16v system that charges at about 19v but my timing computer has a 5v output for sensors. Why not linear? I figure as tilt increases, my correction should also increase. But yes... 90 degrees and we're beyond sensors and correction

A strain gauge (or distance sensor) on the front suspension will only tell me when the front suspension is fully unloaded. At that point, the wheelie can be 1" high or 4' high with the same reading from the sensor. In my application I would prefer to have the front wheels around 1" off the ground (full strain or travel) as this will apply maximum weight (traction) to the rear wheels.

I'm not precisely sure on my start time but luckily my ECU has a graph where I can plot my start based on the voltage output of the sensor. In this sense, the sensor can be really dumb as I have upstream devices that can handle the extra computing.

my first thought when reading this was the same as Soeren. a gyro, also known as an "angular rate sensor".these sensors measure the rate of rotation rather than a specific angle and are immune to forces of acceleration and have very low response times.the down side of these sensors is they are prone to "drift". ie, with no reference point any interference or inaccuracies will cause the reference angle to drift away from the true angle over time.they also tend to give different readings at different temperatures, are less accurate in mechanically noisy environments (ie, vibration) and generally don't like playing nice.

usually gyros are used in conjunction with some other form of sensor to offset the drift but in your case you could zero all perimeters while you had the clutch in.i would imagine your critical period is only a few seconds long. an average across multiple gyros should be sufficiently accurate.

i can't help thinking some sort of mechanical sensor would be easier to implement though.do you have front suspension on your vehicle? a linear encoder measuring front suspension compression would work.

if you are talking about wheelie bars then the forces are going to be large enough to distort your chassis. can you measure that?what about a laser shining down the length of the vehicle at an array of light sensors so you can measure how much your chassis is bending? this way you can turn the length of the vehicle into a strain gauge.

while we are throwing ideas about,is putting an optical reference point behind the vehicle an option and measure the angle with machine vision?an LED beacon oscillating at half the cameras frame rate and compare the vertical position of the "on" pulses, using the "off" pulses as a mask to isolate the beacon.i suspect this approach would have at least ~100ms latency by the time video frames were captured and processed so maybe it's too slow (not to mention over complicated).

one last thing,power boats face a similar problem to the one you are describing. they are looking to maintain a level angle through rough seas using the throttle. you could see if the devices they use are adaptable. i don't know what they use these days. when i last skippered such craft all the automatic throttle controls were somewhat temperamental but i'd imagine rate gyros have been integrated by now.

I like the idea of setting 0 with the clutch (or in my case, transbrake) as that would be very simple. However, my understanding of gyros is that they measure the speed of change in tilt but not the actual angle of tilt... I need the latter.

For the most part, I want to stay away from mechanical sensors as they are more likely to be visible. The class I am running has outlawed wheelie bars but has not stated anything about electronically sensing an limiting wheelies. If something were visible, someone might complain which may result in amendments to the rules.

I will check out the boat idea... do you have any idea what the assist may have been called?

I like the idea of setting 0 with the clutch (or in my case, transbrake) as that would be very simple. However, my understanding of gyros is that they measure the speed of change in tilt but not the actual angle of tilt... I need the latter.

correct. you would need to integrate the output.not really a problem though. if your rate of change becomes anything other than zero then you need to ease up on the throttle.have you any electronics or programming experience? you will probably need a simple microcontroller to read the rate gyro and convert the output into something your engine management understands.

I will check out the boat idea... do you have any idea what the assist may have been called?

so going back 10-15 years to when i used to move boats about there was often a device that would throttle down in the bows of the boat lifted too high.it was little more than a tilt sensor and as such would be affected by changes in speed and the effects of rough seas so they were little more than EPOs leaving the helmsman to do the delicate control.

from more recent trips by water taxi, technology appears to have caught up though. the taxis i was on appeared to do the fine tuning automatically.i can't find a reference to it online though. do you live near the sea? drop into a power boat shop and ask a few questions.

there's also a bunch of US Navy guys on this forum that might be able to ask someone with more recent first hand experience than mine....

correct. you would need to integrate the output.not really a problem though. if your rate of change becomes anything other than zero then you need to ease up on the throttle.have you any electronics or programming experience? you will probably need a simple microcontroller to read the rate gyro and convert the output into something your engine management understands.

The vehicle will need tilt as it needs suspension travel and a 1-2" wheelie so I'd rather not flip a switch with any rotation. Thinking about the math... what I think (that's a big think) I would need to do is:

(1) Start a timer.(2) Take a gyro output sample ($last_sample) at a rate of say every 1ms and multiply it by time elapsed ($last_elapsed_time) to get the change in angle ($last_angle). This step may be redundant as I think it only grabs an initial value.(3) Take the current gyro output sample ($current_sample), multiply it by time elapsed ($elapsed_time) to get the current change in angle ($current_angle), add it to the last change in angle ($last_angle) to get total change in angle ($total_angle).(4) Assume a 90 degree maximum angle and a 5v maximum output voltage.(5) Take the total change in angle ($total_angle) and convert it to a scaled voltage using the assumption in step #4.

I only know Perl and this would be easy to program in Perl but as I understand, it is not a language used for this type of stuff and wouldn't be fast enough even if I could use it. (I'm in the Silicon Valley and may be able to convince someone to write some code for me). What language would I need to learn?

yup.if $elapsed_time is the time between samples then that looks something like it.

as you've worked out, Perl isn't going to get you very far in embedded electronics.you are going to need a microcontroller to take readings from the gyro.there are nearly as many microcontroller options as there are applications.generally speaking you program microcontrollers in C although there are a few other options.

have a search on this forum for other microcontroller recommendations.the big 2 chip manufacturers in the hobby market are Atmel.com AVR and Microchip.com PIC.most people on this forum use AVRs.

if you want a ready made circuit along with a (non C) programing and development environment, Arduino.cc has a big following.personally, i don't see the point of the Arduinos as it is just an AVR chip with a clumsy programing environment but they have a huge user base so there must be some advantage. bear in mind, i tend to like doing things the hard way... i think the Arduinos are fairly easy to get started on.

if you want a ready made circuit along with a (non C) programing and development environment, Arduino.cc has a big following.personally, i don't see the point of the Arduinos as it is just an AVR chip with a clumsy programing environment but they have a huge user base so there must be some advantage. bear in mind, i tend to like doing things the hard way... i think the Arduinos are fairly easy to get started on.

dunk.

So after looking at the options all day... I can see the draw of the Arduino... it's already put together, the low level programming is already taken care of and I just need to call the I/O, import my logic and flash the board via USB... not nearly as versatile but not nearly as complex either.

The Arduino Pro is kind of useless since basically all it has is the chip and the PCB. Might as well get a "real" one with the proper usb connection built in instead of the FTDI breakout board.

I would recommend the Seeeduino. The standard Arduino has header pins with "strange" spacing that is proprietary, the seeeduino has the strange spacing along with the standard spacing so you can use standard .1" prototype boards.

Also note that the gyro you picked is a yaw rate gyro, which means for use on your dragster, the PCB will have to be vertical. Sparkfun sells other gyros that you can mount flat, yet still measure the right axis.

No problem, that's what interfacing is all about (interface actually means "between faces").You take what the sensor delivers and "reformat" it into what the ECU wants - sort of like a Star Trek translator without the jumpsuit holding it.

Why not linear? I figure as tilt increases, my correction should also increase. But yes... 90 degrees and we're beyond sensors and correction

It's not to avoid linear, but it just doesn't matter very much, as you just want to have X amount of tilt. If X rises a little, you counter it a little, if X goes high, you counter a lot - main thing is that you end up where you wanna be.Since 90° is bad, you want full correction to come on before that point anyway (unless you're related to Evil Knievel of course ).

As simple as possible, that way less can break down.Actually, it's as simple as a primitive thermostat - too much and you ease off, too little and you let go a bit (perhaps a tad more involved, but that's the basic principle in all cybernetics, be it the humble thermostat, a race car or a multi-DOF robot).

You obviously can regulate down with a signal of 0.5V to 4.5V, or is that the total voltage controlling it that you want to modify?

The infrared sensor was my first approach. I purchased one of these [---] and it actually ...kinda works but the measurements don't seem reliable and, I was worried about terrain irregularities as the car moved down the track.

That is probably due to missing decoupling and shielding - I imagine a drag racer being even more (electrically) noisy than a street car.You probably would be better off with a sensor covering a shorter distance, as you will then get more resolution over the range you will be using. Take a look at this page at the bottom of which is a comparison table to the different sensors (and each page has got a datasheet link for that sensor).

Mounted in a suitable height, I can't imagine it should have any problems with irregularities on a track (or the cars would as well). Besides, do you plan on doing the entire track with your front wheels in the air? (Oh well, just watched the video link that didn't work yesterday... Seems that's the way to go - saves on front tires as well ).More than 1 IR sensor could be used (just like the auto-focus on a camera) and the result averaged.

A strain gauge (or distance sensor) on the front suspension will only tell me when the front suspension is fully unloaded. At that point, the wheelie can be 1" high or 4' high with the same reading from the sensor. In my application I would prefer to have the front wheels around 1" off the ground (full strain or travel) as this will apply maximum weight (traction) to the rear wheels.

Would the traction change much from barely touching (i.e. a few kg max. on the front axle) to 1" above ground?

If 1" above ground is the sweet spot, why don't your ECU take that into account - I imagine that a race ECU is a bit optimized compared to a street car (just look at Mega Squirt and it's still for street cars) and I would think that it would be easy to measure when the least power is wasted (something like: power applied/[mass x acceleration])?

I'm not precisely sure on my start time but luckily my ECU has a graph where I can plot my start based on the voltage output of the sensor. In this sense, the sensor can be really dumb as I have upstream devices that can handle the extra computing.

I have never been to a drag race (or tilted a drag queen for that matter ), so I have no idea of how fast a car goes into the air. Are we talking 10ms, 100ms, 1s or something different (just a ballpark guess based on your experience).

Another optical method that would be way faster than the Sharp sensors:Mount one (modulated and slightly decollimated) LASER pointing down to the track slanted and 3 detectors that is made to have a quite narrow field of view, each looking at positions where the LASER will point when eg. 3/4", 1" and 1-1/4" into the air respectively (or closer together if you can get it very narrow).

When you start, it shouldn't react until it reaches the 1-1/4" detection where it will back down until the 1" is detected. Whenever one of the side detectors are grazed, the ECU is then told to back down or drop the hammer.The best result would probably be with the sensors slightly "engaged" or perhaps with 5 sensors (but that's just more adjusting to do) and the readings should be quick and smooth, as a car with the front oscillating up and down half an inch would probably not go unnoticed (and would not be fun riding either I guess), but luckily the inertia of the entire system is helping out here.

Logged

Regards,Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?Please remember...Engineering is based on numbers - not adjectives

You can reliably measure the tilt angle using a 2 axis accelerometer with a single axis gyroscope. The sensor readings are fusing using a Kalman filter.

Your requirements for measuring the tilt angle were:

1. Run on 5v power.There are many accelerometers and gyroscopes that run on 5V.

2. Measure tilt from 0 to ~90 degrees.The accelerometer can read angles from -180 to +180 degrees. The gyroscope just reads angular velocity, the rate of change of the angle.

3. Output 0.5v at 0 degrees.Using a 5V power supply, the accelerometer will read 2.5V at 0 degrees, lower than 2.5V for negative angles, and higher than 2.5V for positive angles. The gyroscope will read 2.5V at 0 degrees angular velocity, lower than 2.5V for counter clockwise rotation, and higher than 2.5V for clockwise rotation.

4. Linearly increase output to ~4.5v as the unit reaches a ~90 degree angle.The accelerometer will give you a linear output voltage from -180 to +180 degrees. The gyroscope will give you a linear output voltage between its maximum rated angular velocities.

Remain unaffected by lateral acceleration and deceleration.The Kalman filter removes high frequency noise from the accelerometer readings, the type you get when you violently shake the accelerometer, and uses the resulting signal to correct the gyroscope drift.

I have used this exact combination in my balancing robot, and it works great.

It's not to avoid linear, but it just doesn't matter very much, as you just want to have X amount of tilt. If X rises a little, you counter it a little, if X goes high, you counter a lot - main thing is that you end up where you wanna be.Since 90° is bad, you want full correction to come on before that point anyway (unless you're related to Evil Knievel of course ).

You clearly understand the application. I’ve received a lot of “why”’s in the last couple weeks.

You obviously can regulate down with a signal of 0.5V to 4.5V, or is that the total voltage controlling it that you want to modify?

I have a voltage supply of either 5v (from the ECU) or ~19v (from the alternator… it’s a 16v system). I’d rather use one of the two as [for me] the math and resistor work gets tricky trying to get some other voltage lower or inbetween.

That is probably due to missing decoupling and shielding - I imagine a drag racer being even more (electrically) noisy than a street car.You probably would be better off with a sensor covering a shorter distance, as you will then get more resolution over the range you will be using. Take a look at this page at the bottom of which is a comparison table to the different sensors (and each page has got a datasheet link for that sensor).

Mounted in a suitable height, I can't imagine it should have any problems with irregularities on a track (or the cars would as well). Besides, do you plan on doing the entire track with your front wheels in the air? (Oh well, just watched the video link that didn't work yesterday... Seems that's the way to go - saves on front tires as well ).More than 1 IR sensor could be used (just like the auto-focus on a camera) and the result averaged.

So I moved everything to shielded cable, wrapped the sensor up in foil and grounded it. It does work better. The trouble I see now is the sensor is a bit picky about what it reflects off and once out of range it resets to 0. So while I’d want a short range for resolution, I’d need a long range to remain within its parameters.

A strain gauge (or distance sensor) on the front suspension will only tell me when the front suspension is fully unloaded. At that point, the wheelie can be 1" high or 4' high with the same reading from the sensor. In my application I would prefer to have the front wheels around 1" off the ground (full strain or travel) as this will apply maximum weight (traction) to the rear wheels.

Would the traction change much from barely touching (i.e. a few kg max. on the front axle) to 1" above ground?

This is an interesting point. Presumably if the front is light as a feather then yes.. the strain gauge could be sufficient… assuming maximum strain does in fact equate to minimum front end lift at all times. To say, typically the car should have enough traction to push the front end off the ground but I wonder would would happen in a reduced traction scenario where the car can push the front end up but does not have enough traction to lift it off the ground… I might not want to reduce power at that point. Consider a 500# weight on the ground… attempting to pick it up may yield maximum strain, but may still leave 200# of force on the ground.

If 1" above ground is the sweet spot, why don't your ECU take that into account - I imagine that a race ECU is a bit optimized compared to a street car (just look at Mega Squirt and it's still for street cars) and I would think that it would be easy to measure when the least power is wasted (something like: power applied/[mass x acceleration])?

I would love to measure wasted power but I got kind of lot in your description and what outcome the equation would yield.

I have never been to a drag race (or tilted a drag queen for that matter ), so I have no idea of how fast a car goes into the air. Are we talking 10ms, 100ms, 1s or something different (just a ballpark guess based on your experience).

You can reliably measure the tilt angle using a 2 axis accelerometer with a single axis gyroscope. The sensor readings are fusing using a Kalman filter.

Your requirements for measuring the tilt angle were:

1. Run on 5v power.There are many accelerometers and gyroscopes that run on 5V.

2. Measure tilt from 0 to ~90 degrees.The accelerometer can read angles from -180 to +180 degrees. The gyroscope just reads angular velocity, the rate of change of the angle.

3. Output 0.5v at 0 degrees.Using a 5V power supply, the accelerometer will read 2.5V at 0 degrees, lower than 2.5V for negative angles, and higher than 2.5V for positive angles. The gyroscope will read 2.5V at 0 degrees angular velocity, lower than 2.5V for counter clockwise rotation, and higher than 2.5V for clockwise rotation.

4. Linearly increase output to ~4.5v as the unit reaches a ~90 degree angle.The accelerometer will give you a linear output voltage from -180 to +180 degrees. The gyroscope will give you a linear output voltage between its maximum rated angular velocities.

Remain unaffected by lateral acceleration and deceleration.The Kalman filter removes high frequency noise from the accelerometer readings, the type you get when you violently shake the accelerometer, and uses the resulting signal to correct the gyroscope drift.

I have used this exact combination in my balancing robot, and it works great.

Good luck!

You rock man.

I got an email exactly about this last night and I think this is the route I’m going to try.