View Single Post
Old 05-14-2013, 04:37 AM   #20 (permalink)
Occasionally6
Master EcoModder
 
Join Date: Apr 2013
Location: World
Posts: 385
Thanks: 82
Thanked 82 Times in 67 Posts
Quote:
Originally Posted by jeff88 View Post
I couldn't find the G-Tech, but did find this: Electronic Magnetic Protractor I'm not sure if it will do what I want, but it has a small display which is what I am looking for. It says it displays in degrees or tilt angle %. I think the latter is what I am looking for (to match up with road signs as I mentioned in a previous 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.

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).

Quote:
As far as the arduino goes, I think I will probably end up doing that,
It may be the only way to get what you want.

Quote:
but will need a TON of hand-holding as it will be my first time.
Fortunately there are plenty of hands around the Arduino to hold but there will be a point at which you have to take over.

Quote:
I *think* I found the ADXL335 board: ADXL335
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.

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?).

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.)

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.

Quote:
and a display: Display
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.

Quote:
For the prototype shield board do you mean this: Prototype Shield Board or this: Mini Breadboard or something else?
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?

Quote:
What else would I need? Do I still need the Arduino itself?
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.

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.

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.

Quote:
Would this: Mega 2560 or this: Arduino UNO be it?
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.

Quote:
Like I said, hand holding
Yes, but everyone has to start somewhere.

Quote:
If I can use the same hardware (i.e. main arduino board, display, etc.) for my grill block and anything else I might come up with, then less than $100 would definitely be OK! I'd be fine if the accessories end up costing a little more than something pre-done, because for one I will be learning and two, I will have one system to control multiple things.
Once you understand the basics, you will have a better idea of what you can do (and if you want to do it or not).

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.

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.

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).

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.

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.

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 up. 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.

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":

Cartesian coordinate system - Wikipedia, the free encyclopedia

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.

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.
  Reply With Quote