View Single Post
Old 06-06-2013, 02:48 AM   #56 (permalink)
Master EcoModder
Join Date: Apr 2013
Location: World
Posts: 385
Thanks: 82
Thanked 82 Times in 67 Posts
Originally Posted by jeff88 View Post
Just wondering how your setup is doing. Is it working properly? Have you figured out how exactly you want it setup? How does it do with just the accelerometer and no gyro? How often does it "reset" itself and how fast does that process take?
Slowly. There's no deadline so it happens when I feel like it. It's just playing around with the sketch(es) atm.

The set up hasn't changed; VSS input + analog accelerometer input. I haven't yet set up a speed sensor input. I will do that on the bench before putting it in a car. That is another mini project by itself.

Other than for a vertical displacement (for calculating PE) there is no need for a reset because the VSS is a constant connection to the real world. The reset/reference is only required for dead reckoning which always has some inherent error.

I just realized, if I have a 2 digit display, that displays 7.2 or 8.4 or whatever, I won't have a way to display a negative. For large percentage slopes, I can probably tell if I am going up or down but for smaller slopes, it will be more difficult to know what the car is doing (up or down). I wonder, since their is a decimal point after the second digit, if I can set up the second decimal as my negative.
Clever. That's a nice way to do it, with the 7-segment dp pin wired to an Arduino pin. An extra 7-segment (+ transistor and current limiting resistor for the transistor) just to display the minus sign would also work.

Trying to find a non-discontinued analog gyro/accel. is proving difficult! I have to try and find a tut to help me with I2C, because it seems that is the only way to go at this point. Have you seen anything regarding how to use I2C?
You might start here:

Arduino Playground - MPU-6050

and strip out the temp sensor from the sketch (unless you want that).

Maybe here also:

Playing with an Arduino and sensors

I did find these:
Analog Gyro
It's analog but does that have more than one output? I can only see reference to 'z' axis. I think you need at least two unless you want to do what I will have to do and estimate or ignore the effect of lateral slope.

Serial Interface Gyro/Accel. This one says it outputs on a serial interface. Is that SPI? Would this work as an "analog" output?
Definitely serial which means it can use either SPI or I2C with Arduino. It also needs a 5V FTDI Basic Breakout (or equivalent) in order to program it.

At the risk of confusing you, Arduino's come in a few different forms, some of which, unlike UNO and Mega, don't have included on the board the means to program them with the sketch. Those need the FTDI breakout (or equivalent) to get the sketch to the Arduino. You could use the FTDI breakout which is needed to program that IMU (which uses the same Atmega328 chip as the Arduino) and an alternative (maybe cheaper) form of Arduino if you have to buy the FTDI breakout anyway.

Dual Axis Gyro This one looks to be analog, but I don't know if it would work for this application. It's only the gyro, no accel.
That one looks OK. It is two axis only but I think that's all you need.

Analog Accel. This one is cheap, +/-1.5g and has (I think) analog output. May be a good option if I can't find an integrated gyro/accel.
MMA7361 This one offers analog output and +/-1.5g.
They are both the same MMA7361 IC that I am using. Unless you want to get into making your own board, soldering surface mount components, (you don't) the second one, with that already done for you, is the one you want.

The only way to get around I2C, would be to have 2 separate shields, but finding a gyro by itself that uses analog output is fairly difficult as well.
You can put two sensors on one shield but if they are two discrete sensors you'll have to match them onto a common axis in the sketch.

What's so different about I2C compared to analog (at least in terms of the sketch)?
Once you get the sensor input into the Arduino, very little. The units might be different but that's not difficult to deal with. It's just getting the sensor input into the Arduino that is a bit more complicated. That does require a more complex part of the sketch to achieve. It's Arduino so I can't see it being too difficult. I think copying and pasting the code from the playground link above would do it. (Having written that, I haven't actually done it so...)

Should I get some capacitors as well? Will it be of benefit for me?
For what? I have the two on the power supply that the shield allowed for to damp any fluctuations or noise on that. I think that's probably sensible. I'm going to try some across the (analog) sensor outputs to see if that reduces the noise on them.

Like here:

Accelerometer Experiments Part 2: LIS331AL and DE-ACCM2G (ADXL322) . Filters, amplifiers and vibration response. Starlino Electronics

That (starlino) site (chase the link back to menu page for a lot more) has a lot of relevant information for us, particularly the mathematics that are required to shift axes. There is also a description of a simplified version of the Kalman filtering (using a constant weighting to average the gyro and accelerometer inputs to determine the position sensing input). Those pages are worth reading.

Do you know what I should look for in a gyro? I see +/- 250, 1,000, 2,000, etc., but what is needed for this application? Is it the smaller the range the better like the accelerometer?
Pretty similar as far as I can tell. Aren't they mV per unit of angular acceleration, in degrees per second, the rotational analogy to linear acceleration. The other main gyro spec. is total degrees per second. Measuring slope will be pretty undemanding in terms of that.
  Reply With Quote