View Single Post
Old 05-17-2013, 11:59 AM   #34 (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
So will this little gizmo work for what I want, or will it not take into account different accelerations? In other words, will it display the incline or will it add in lateral or horizontal accelerations, throwing off the number?
The Arduino based gizmo? I expect it will at least read and display the 3 acceleration values. The $100 pendulum . (That's for Old Tele Man).

If you can get the VSS input and convert that to an x-axis acceleration, the Arduino unit will also read the incline. There will still be some error from the transverse slope of the road.

So that gizmo won't work and I need to build my own board to subtract out different accelerations?
Whatever it is, it has to separate out the vehicle acceleration from that due to gravity. Nothing proposed so far other than the Arduino (and possibly a G-Whiz with a speed input - how though???) can do that.

I'm willing to do the work, I just need to know what to do! If I get instruction '1) do this 2) do this 3) do this' then I can do it. After I do it once, I am pretty good at figuring out how to do it in less structure and can even come up with better ways sometimes. But this being my first time, I need the structure.
It's a unique project (AFAIK) so you will have to figure at least some of it out yourself. I don't want an inclinometer but a g-meter I can use and some of the problems involved in getting an inclinometer to work are the same as those in getting PE and KE calculated (which I do want). I will input what I can, if that's worth anything. It's possible that some things won't work it's also possible that it won't work at all. (I hope not, I think not but...)

There's no harm in planning it out (as you appear to be doing) before committing to it and you can do it in stages. (Like get the g-meter part working and being prepared to stop there, if that's as far as it will work.)

Will a three-axis be enough, or should I get two boards to measure 6 different axes?
One linear 3-axis is enough. 6 axis refers to also measuring the rotation (angular acceleration) about each of the 3 axes in addition to the 3 linear accelerations. Adding or using one of those may be an alternative to the speed input to get the incline output.

Sorry, are you talking about the shield boards, the Mega/UNO boards or the ADXL3xx accelerometer boards?
The ADXL3xx (or similar) boards.

So this says +/-3g. Would that work for me, or is that still a little too much for this application?: Triple Axis Accelerometer This one has a selectable amount +/-2,4 or 8g: Selectable Triple Axis Accelerometer This one can be selected for +/-1.5g or +/-6g: +/-1.5g Accelerometer
I think +/- 1.5g or maybe +/- 2g will be best (at least in terms of spec.). What I have is +/- 1.5g so you can wait and see how well that works if you want to. I doubt that more than 1.5g is needed, +/- 3g almost certainly not.

The output voltage maps against the g reading, so if you have a board capable of reading +/- 10g (say, for easy math) with a full scale voltage output of 3.3V and you measure +/- 1g you will only ever use 0.33V of that range. That in itself will reduce the precision of the result.

When that voltage is fed into one of the analog pins on an Arduino, you lose more. They map 0-5V against a 9 digit binary number i.e. 1024 discrete values. 0.33V/5 x 1024 = just 61 discrete values to cover 2g (= +/-1g). The lowest g range that will not be exceeded is best.

I assume you mean something like this?: I2C Adapter
The reason I mentioned I2C is that some of the accelerometer boards put out an I2C data signal instead of the voltages and I don't want you to buy the wrong type by mistake. I haven't looked very hard at what is required to get it to work.

I have found a ton of screens, so I will get one that is "good" and will fit my needs (meaning size). I want one separate from the board, so I can put the board wherever I want and the screen somewhere in/around the dash.
Sounds good.

I know the board offers 5V and 3.3V, but is one better than the other? What would be a reason why I would choose one or another? Not sure what you mean about the rest. Power to the accel. board with sensors x, y and z relaying voltage based on readings to the Arduino board? Doesn't the Arduino then use those voltages to do the math and display the answer? Or are you saying that a second option is to have the accel directly attached to the display, skipping the Mega/UNO board?
You feed the accelerometer board 3.6V-5V (or whatever the data sheet says). The 5V is regulated on the board down to 3.3V, which is what the IC uses. Where it gets 3.6V-5V doesn't matter. You could simply power the accel. board and use a voltmeter to read the output. It would give an output that is proportional to the acceleration the axis (or axes) you are measuring sees, in mV, but that's it.

So the Arduino will read varying voltages from each sensor on the accel. board, do the math and display it for me?

That means I need power to the Arduino board, accelerometer and the display?
You need to provide power to the Arduino, within the voltage range specified for it. The regulated voltage on the Arduino is used to power the accelerometer and the display. Look at the wiring schematics in the tut examples.

I'm thinking a few diodes with a voltage drop across them will get me to the desired voltage for the board, maybe with a relay to help protect the circuitry?
Yep. Nice thinking with the diodes. You will need about 6 to get near 9V. 1N4004's should work. The Arduino will probably accept a voltage up to 20V, so you could actually use an ignition source directly but, depending on the current drawn by the Arduino and what is attached to it, the voltage reg. on the Arduino has to work harder than is ideal to dissipate the unwanted voltage (as heat).

Or I can do something like this? It will input 3-40V and output 1.5-35V.
If you want. That may be overkill though.

Although for learning purposes, the UNO might be easier, I'm wondering if I want the Mega so I can use the board for all my projects with one board instead of two or more. My only concern would be if the Mega is powerful enough to run all of it at the same time and be able to do the calculations fast enough for each project. I would hate for the incline part of the board hog up memory and slow down opening the grill block or bumping up the electric water pump and my engine overheats.
Processing speed is less an issue than filling the Atmega chip's memory or having insufficient pins to get the inputs and outputs.

So with lcd.print, will I get the x, y and z #s or the #s that the Arduino spits out after doing the math for those #s?
Read the tuts and the various examples. It will become clear.

OK, so the voltage that each sensor sends to the unit will translate into a vector, which, with some math I can translate into slope.
The voltages each represent a component vector of the total acceleration vector. The math is just translating it into something that makes sense to you.

What about the opposites? Back, left and up?
The voltages are all positive but will be translated into negative numbers, with an offset, to show the direction. Read the tronixstuff tut using the temp. sensor. That's what you'll be doing for each of the 3 accelerometer voltages. A temp. below 0 is similar to a negative acceleration.

I'm thinking I will set the accelerometer on a construction level, make sure it's flat and then calibrate it. After that, I can install it into the car and be on my way with some slight tweaking.
If you are going to try to physically match the accelerometer axes to the car axes, it has to be set up while attached to the car. You don't have to line up, say, the x-axis on the accelerometer with the x-axis on the car. You can rotate it 90 degrees (to match the y-axis) and then fix it in the sketch. You do have to line up (or correct in the software) an axis to the car axis.

So if the current reading for x,y and z says lets say 1,2, and 3, then I will subtract 1,2 and 3 from their respective sensors in the Arduino sketch and from there on out, the system will know to subtract those numbers from any readings.
Conceptually, yes.

I'm wondering if I should do this with the accelerometer set in position and the car as flat as possible (maybe I can use a jack), this way the calculations/readings are as accurate as possible.
Yes. Pointing directly fore-aft and laterally also.

Sorry, how does this relate?
It's the math required to shift the coordinate system of the accelerometer to line up with that of the car, if they don't do so physically.

So more math to convert from radians to degrees!
Only if want the display to read in degrees. Otherwise you use radians within the sketch. It's easy anyway; pi radians is 180 degrees.

So run a wire from the VSS to an input into the board and in the Sketch use: pulseIn(VSS #)? If necessary, I might need a square wave converter somewhere in that wire before the board input?
It depends on what type of speed sensor you have. If you are lucky you will have a Hall sensor type which will already have a 50% duty cycle square wave output. If you are really lucky, it will even be 0-5V. The other common type of sensor uses an inductive pick up which generates a Sine wave that varies voltage and frequency with speed. That one will need to be converted to the square wave. A 555 based circuit might do to do that.

There is often more than one speed signal. The ECU will have one, usually the raw signal, but if the speedometer is electronic there will be a signal there also. One of them is likely to be a processed, square wave, signal.

This? There are cheaper ones, but this one is specifically for Arduino, does it matter?
You don't want to generate a signal, just process it (then only if necessary).

How do I determine if the VSS is outputting a square wave, will a multi-meter be able to do that for me? And why does the VSS need to output in square wave to work for me?
Shop manual? You can get some signal info. using a multimeter. A 0-5V square wave signal with 50% duty cycle will show as ~2.5V when measured as direct current. An inductive pick up type will generate an alternating current so you will be able to measure it that way.

A Hall sensor will have 3 wires to it: power, earth, signal. An inductive pick up will have two wires.

It needs to be a square wave to use pulseIn() because you will measure the time that a number of pulses remain high (or low), sum them, divide by the number of samples and double it. That's time for one period of the wave. From that you can calculate the frequency. With the number of pulses per shaft rotation together with the gearing and tire circumference you can get the road speed. Take two sequential speed (velocity) readings a known time apart and you can calculate the acceleration (if there is any).

I haven't looked, but how does MPGuino measure the speed input for your car?

Last edited by Occasionally6; 05-17-2013 at 12:43 PM..
  Reply With Quote