Thread: On-the-Go Slope Measurement View Single Post
jeff88
Lots of Questions

Join Date: Jan 2013
Location: San Jose
Posts: 663

Motor-Rolla - '01 Toyota Corolla LE
Team Toyota
90 day: 28.3 mpg (US)

Gaia - '99 Toyota 4Runner SR5 Highlander
90 day: 19.78 mpg (US)

Gaia - Round 2 - '99 Toyota 4runner SR5 Highlander
90 day: 18.22 mpg (US)
Thanks: 340
Thanked 100 Times in 78 Posts
Quote:
 Originally Posted by Occasionally6 Maybe but you've drawn me into building an Arduino based one now. (I had to buy only the prototype board and some connectors.)
Oh oh... did I start something here?! It might actually be helpful if you build one, so we can both test, verify and troubleshoot. Unfortunately for me, I have a much larger learning curve, not ever doing this before and not even having any of the pieces.

Quote:
 Originally Posted by Occasionally6 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.
So I can do a single 3-axis board with the VSS or 2 3-axis boards if I cannot get the VSS to work? If that is the case, I might just do 2 3-axis boards, so I don't have to mess with any vehicle parts directly.

Quote:
 Originally Posted by Occasionally6 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.
OK, I'll see what happens with your setup to see if 1.5 or 2g is better. If worst comes to worst, I'll take a little less accuracy and get a 2g, but I won't go higher than that (other than a switchable board). I think I get what you're saying. With a larger spectrum of voltages being sent to the main board, the board can better determine what the actual # of Gs is. With a larger spectrum, .33V and .34V will be vastly different in the output #.

Quote:
 Originally Posted by Occasionally6 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.
Does this one from the parts list output in I2C or in voltages? I couldn't find out from the datasheet provided. 3-Axis Accelerometer

Quote:
 Originally Posted by Occasionally6 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. 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.
According to the datasheet for the Accel. 3.6V is the maximum voltage it will accept. So I guess when I run power to the Mega/UNO, I will run the wires from the battery through the diodes into the Vin header. Then I will run a wire from the 3.3V header to the Accel. Does that sound right?

Quote:
 Originally Posted by Occasionally6 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).
I can't take credit for the diode idea. I stole (borrowed) it from Echo-Francis who did the same with his Electric Water Pump. So from what I've read, the 1N4004 will have a voltage drop of about .7V. Is that correct? That means that with 6 diodes (wired in series?), the voltage will drop from battery voltage from 12.6 (assuming fully charged) down to 8.4. That is in the operating range specified, but is that too many diodes? Maybe if I use 4 diodes to get me under 10V, that might be better?
I'd rather put in a few diodes, so I don't accidentally overload the circuits... cheap insurance.

Quote:
 Originally Posted by Occasionally6 Processing speed is less an issue than filling the Atmega chip's memory or having insufficient pins to get the inputs and outputs.
Sorry, yes I meant memory. The Clock Speed on both are the same. The memory, however, is vastly different. The Mega has 8 times the flash memory and 4 times the SRAM and EEPROM. Not sure what of the three I should be more worried about, but the Mega is by far a better board. The Mega, of course, has a much larger amount of pins, which could be useful. I wonder if I need to spend the extra \$12 for all the "goodies" though. Certainly with more projects on the horizon, the measly \$12 will be cheaper than having to buy a second and third board, but is it really necessary? (That is more a rhetorical question, but any insight/personal experience is still appreciated)!

Quote:
 Originally Posted by Occasionally6 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.
OK, that's what I though it might be, just wasn't sure. Somehow in the Sketch, I will have to determine how a negative or positive number reflects in an up slope or down slope. Yay, more math!

Quote:
 Originally Posted by Occasionally6 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.
Yeah, I kinda realized as I was typing, it will need to be in the car during calibration. I should have deleted the construction level part. Wouldn't it be easiest to have the accel. just be in the correct position, so I don't have to do any other fancy work in the Sketch? I'm thinking if I mount it where I want to put it, it won't need to move and the output #s will by default have to be correct (at least in terms of axis to axis). BTW, do I have to mount the board horizontally, or can I mount it vertically?

Quote:
 Originally Posted by Occasionally6 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. A Hall sensor will have 3 wires to it: power, earth, signal. An inductive pick up will have two wires.
According to my Haynes manual, "The sensor sends a pulsing voltage signal to the speedometer, which is converted into MPH." Does that help determine the signal output? It looks like there are three wires in the VSS output. See pic below:

I wonder if the signal to the speedometer is electric. I do know when I remove the instrument cluster, I have to disconnect a lot of wires. Don't know if any of those is a square wave speed signal.

Quote:
 Originally Posted by Occasionally6 I haven't looked, but how does MPGuino measure the speed input for your car?
Is that a generic question? If it is, I don't know the answer.

__________________________________________________

A few more questions:
• The Arduino boards have analog and digital input pins. Which is better and which should I use?
• For the accel. board, do I run 1 wire from each x,y,z sensor to 1 input on the Arduino, or does each sensor wire get its own input (1 for X to pin 1, 1 for Y to pin 2, 1 for Z to pin 3)?
• Are the pins' input and output combined into the same pin? If so, how does the Arduino know if it is an input or an output, or does it matter? Will that be something I design in the Sketch ("If this happens, then run signal through pin X")?
• Would a gyro help me in this endeavor at all? Gyro, or is it not necessary?
__________________
Don't forget to like our Facebook page!

Best EM Quotes:
Quote:
 Originally Posted by aerohead It has been said, that if you peel the duct tape back on Earth's equator, you'll find that the two hemispheres are held together with J B Weld.
Quote:
 Originally Posted by Dan9 subscribed with a soda.
Quote:
 Originally Posted by aerohead If you're burning,and someone throws gasoline on you,there will be a localized cooling effect, but you're still on fire.

Last edited by jeff88; 05-17-2013 at 10:06 PM..