View Single Post
Old 05-16-2013, 06:51 PM   #29 (permalink)
jeff88
Lots of Questions
 
Join Date: Jan 2013
Location: San Jose
Posts: 665

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: 17.23 mpg (US)
Thanks: 343
Thanked 101 Times in 79 Posts
Quote:
Originally Posted by Occasionally6 View Post
It will, like the other accelerometers and inclinometers, measure the ground slope when you are stationary or at constant speed. (A steady ground speed still means accelerating vertically when ascending or descending. You just won't be accelerating relative to the ground. That means the fore-aft acceleration will still represent the acceleration due to the slope.) It will not separate the change in gravitational acceleration (direction) due to a change in fore-aft slope - what you want - from any other accelerations.

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?

If vehicle (linear) acceleration can be around 0.3g, the effect of a 7%, 0.07g, slope will be swamped by the other accelerations the vehicle is subject to. There is also a lateral component due to the crown of the road which will subtract from the fore-aft component (the sum of all the components, without other accelerations, still = 1g).

It may be the only way to get what you want.

So that gizmo won't work and I need to build my own board to subtract out different accelerations?

Fortunately there are plenty of hands around the Arduino to hold but there will be a point at which you have to take over.

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.

If you go back to the Arduino ADXL3xx link you will find two further links to the Adafruit and Sparkfun boards. Sparkfun sells a number of different accelerometer and gyrometer boards. Both vendors provide further explanation as to how they're used. There are other vendors, as you have found.

I will have to read their explanations and see what I come up with. Will a three-axis be enough, or should I get two boards to measure 6 different axes?

The boards are simply a way to get a voltage and an earth to the ADXL3xx IC and to access the resulting output. It's possible to buy the bare IC and build your own (although: Why?).

Sorry, are you talking about the shield boards, the Mega/UNO boards or the ADXL3xx accelerometer boards?

The range of acceleration the board is capable of displaying should match what it is you are measuring or the precision available will be reduced. Other than spikes due to a rough road surface, you won't need to measure more than about 1.5g. (Don't buy a board capable of measuring, say, 10g; +/-2g should be plenty.)

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

There are IC boards that convert the accelerometer data to the I2C format, which can also be read by the Arduino. The advantage is that digital data is less affected by noise and you only need two pins to access it. I don't know how to use that (yet) but, like other things Arduino, there are guides online to doing so.

I assume you mean something like this?: I2C Adapter

That looks OK. You might read the customer reviews for a couple of cautions though. Just like the accelerometer boards there are a number of vendors for the displays.

You can also buy them already mounted to an Arduino shield board which may save you some work or limit your options depending on what you ultimately want to build.

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.

I meant the first one (or similar) but you don't actually have to use one at all. It's just a convenient means of making the connections between the display and the Arduino. You can use wires (eg. ribbon cable) instead if you want to mount the display or the accelerometer remote from the Arduino.

The second item (at least the board, not the Arduino) is intended to be used to set up prototypes on a bench, not for use in a permanent, completed, project. Maybe you want to do that first?

OK, depending on how I hook everything up I may or may not need the shield board then. If I mount the display remotely, I will just throw a ribbon cable on it (God knows I have enough of those!). I'm wondering if I want to make a bench one or just fiddle with it on-the-go in the car. I do that for everything else anyway!

Well, you could construct a regulated 5V or 3.3V power supply and connect that, and panel meters or voltmeters (to display the outputs) to the x, y and z (maybe just the x) terminals of the accelerometer board but it would be difficult for you to interpret the result. You still couldn't easily separate vehicle accelerations from gravity.

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 use the Arduino to read the voltages from the accel. board, perform the maths you need to do and output the result to the LCD display in a meaningful format - something like "Slope: xxx%" - for you to read.

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 will have to supply power to the Arduino. It does have on board voltage regulation but the ~14V from a running car is outside the recommended voltage range for the power input. For standalone testing, a pack of 4 AA batteries works. (You can buy a case with a USB connector and later use it as a phone or iPod back up battery.) For an ignition 'on' wired system you will want to reduce the voltage prior to the Arduino power connector, so a separate, say, 9V voltage regulator (online for circuit designs) or resistor to drop the voltage.

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? Or I can do something like this? It will input 3-40V and output 1.5-35V. That backup phone battery sounds nice. I work in a mall where my phone is constantly working to find a signal and my phone almost dies every day.

The Mega just does more of what the UNO can do. There may be some merit in starting with the UNO compatible boards though because most of the tutorials use that to show the wiring connections, and those same pins are matched in the corresponding software (sketch). Once you understand what you are doing, you can use either.

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.

You will need a soldering iron and really should have a digital multimeter. If you don't have them already, buying them will add to the cost. Of course the cost of those is amortised across any future projects that they are used for.

I have a soldering iron (although, I have to make sure it works!). A multimeter I can get from school or my friend who is an electrician.

adafruit have some fantastic tutorials:

Arduino Uno R3 (Atmega328 - assembled) ID: 50 - $29.95 : Adafruit Industries, Unique & fun DIY electronics and kits

There are also the arduino.cc tutorials:

eg. Arduino - LiquidCrystal

You can download the Integrated Development Environment (IDE) from arduino.cc/en (^) and play with it, even without buying the Arduino. You can't do anything useful nor even get an output from it but you can get some idea of what is involved and how to use it.

Thanks for the links. I'll read them and see what I can do and report back with *probably* a million questions!

What you might do initially is combine the LCD sketch with the AMXL3xx sketch. Instead of using "serial.print()", which displays what you put in the brackets on a window in your PC, use "lcd.print()" to display the x, y and z accelerometer voltages on the LCD display. (Just comment out the serial.print() lines with "//" or "/*" and "*/ rather than delete them because you might want to use them later for debugging.)

When you connect up an Arduino you do have to sort out some com port labelling. The instructions on how to do that are in the IDE download. Unless it has been sorted recently, with Windows 8 you have to disable the digital signing to get the IDE to work with the Arduino (don't use Windows 8).

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? I have Windows 7, so anything I should be worried about there?

At this point you might want to read this:

10 Ways to Destroy an Arduino : Application Note ANCP01

If you have matched the tuts exactly you will be OK though.

I'll probably end up doing one of those!

With an Arduino, display and accelerometer connected, perhaps start by leaving them as the as the (0-1023) analogue voltage to binary conversion numbers, when that works on the display, you can convert them to accelerations using new lines of code in the Arduino sketch. Are you glad you paid attention in maths and physics in school? You will be in the next bit.

So make sure the connections work, then do the conversion work. Paid attention? Oh oh...

In effect, you will have created an Arduino based voltmeter that measures acceleration data. You then have to manipulate the x, y and z data to get an acceleration vector that translates into a slope. The convention for vehicle axes is +x is forward, +y is right, +z is down (changed, per edit). Broadly, the acceleration in the x direction, with vehicle acceleration removed, expressed as a percentage of 1g, indicates the slope up which you are travelling.

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. What about the opposites? Back, left and up? Would a second accelerometer help me with that at all? What math do I need to do to get from voltage measurement to slope? If I know the equation I can plug the numbers in, I just don't know what that equation is. Maybe we should save this until after I have everything else setup.

This is where the hand holding has to stop and you're into your own project.

You will have to calibrate the unit on a level surface as a baseline. You might do that, with a lot of effort, by physically adjusting the angle that the accelerometer sits at relative to the (level) car or in the software. The latter either with a calibration switch, that captures the x, y and z data when an input (calibration request) occurs on an Arduino pin wired to the switch (use a pull up resistor to limit the current the Arduino gets on that pin), or by displaying and noting the x,y,z data and writing that into the sketch manually. You then subtract that in the sketch from subsequent readings to get the real readings. See here, under "Rotation":

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. I *think* I understand what you're saying here. 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. 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.

Cartesian coordinate system - Wikipedia, the free encyclopedia

Sorry, how does this relate?

It's a shift in coordinates from those of the sensor to those of the car. Arduino uses radians, rather than the more familiar degrees, in its trig. functions but otherwise it will be straightforward.

So more math to convert from radians to degrees! Whoohoo!

You are probably going to need a vehicle speed input. Use pulseIn() and the VSS to get it. You may have to modify a signal taken out of the VSS into a square wave, if it's not that already, to use it. You can then measure the vehicle acceleration independently of the accelerometer. You can use this directly to separate out the vehicle acceleration from the gravity acceleration or only as a determination that the vehicle is at rest for a reset of the accelerometer data back to the reference you found above.

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? This? There are cheaper ones, but this one is specifically for Arduino, does it matter? This is, of course, assuming I need one. 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?
Wow, this is a lot! It will definitely take some time to do this! I may need to find somebody here in town that can help me. I have some friends that *may* be able to help, I'll have to ask them. I really appreciate your insight though, I wouldn't be anywhere near this close without you. Anything else you can drudge up for me would be greatly appreciated, I'm going to need it! I'm going to start a list in a new post that I will edit based off of what you say is needed, that way I can comprehend better what I need.

Thanks again!
__________________
Don't forget to like our Facebook page!




Best EM Quotes:
Quote:
Originally Posted by aerohead View Post
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 View Post
subscribed with a soda.
Quote:
Originally Posted by aerohead View Post
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 03:17 AM..
  Reply With Quote