EcoModder Forum On-the-Go Slope Measurement

Register Now
 Remember

 05-09-2013, 04:14 PM #11 (permalink) ...beats walking...   Join Date: Jul 2009 Location: . Posts: 6,190 Thanks: 179 Thanked 1,525 Times in 1,126 Posts Pendulum on a string = DIY inclinometer. Use protractor and algebra to calculate pendulum distance vs. angle.
 Today Popular topics Other popular topics in this forum... View the most popular topics in this subforum by views or by posts
 05-09-2013, 08:13 PM #12 (permalink) Master EcoModder     Join Date: Oct 2012 Location: USA Posts: 1,408 awesomer - '04 Toyota prius Thanks: 102 Thanked 249 Times in 201 Posts the way airplanes do it is to get the gyroscope spinning on level ground before moving around, then it stays level enough for the rest of the flight. Accelerometers can be used in much of the same way, but there will be a lot more drift. You can also use a 2d "gravity driven" inclinometer with a fore-aft accelerometer to account for motion, with a sanity check when the car is not moving. Assuming you do not spend all your time fishtailing.
Lots of Questions

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

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.2 mpg (US)
Thanks: 338
Thanked 97 Times in 76 Posts
First, Ugghhh! I was trying to reply earlier today on my phone and all I was having was problems. OK, rant over!

Quote:
 Originally Posted by Occasionally6 No interest in an Arduino and 3-axis accelerometer based measuring device? Maybe with VSS input to strip out longitudinal acceleration. I think it should be called the Gduino.
I wouldn't even know where to start with an Arduino. It would be good practice for when I do an automatic grill block though I don't know if it would be worth the cost of an Arduino board plus the accessories. At least with a grill block, I can see a payback, not really with a Gduino.

Quote:
 Originally Posted by Sean.Heihn With a OBD2 to Bluetooth adapter, you don't need an USB OTG capable device. And generally if your phone has a gyroscope, it'll have an accelerometer, too. For just reading gyro/accelerometer data off your phone, you don't need an OBD2 adapter, that's only if you want to use your phone as a 'scan gauge', so to speak, with Torque.
So I downloaded some different sensor apps on my phone this morning, just trying them out now. Holy cow!, I didn't realize my phone had so many sensors! So far, I can't really see any app that's better than another. I have noticed that I have no idea what the numbers mean (at least, I have nothing to compare them to, so I don't know how to "decode" them).
I would like to try the torque app and compare it to my UG, but I don't feel like spending the money just to try it.

Quote:
 Originally Posted by Old Tele man Pendulum on a string = DIY inclinometer. Use protractor and algebra to calculate pendulum distance vs. angle.
Not sure how facetious you were trying to be, but I will respond with a facetious answer nonetheless... It will be pretty hard to drive with one hand, shift with the other and hold a string up in the air with my third hand! Also, I like to follow the law: don't derive and drive!

Quote:
 Originally Posted by P-hack the way airplanes do it is to get the gyroscope spinning on level ground before moving around, then it stays level enough for the rest of the flight. Accelerometers can be used in much of the same way, but there will be a lot more drift. You can also use a 2d "gravity driven" inclinometer with a fore-aft accelerometer to account for motion, with a sanity check when the car is not moving. Assuming you do not spend all your time fishtailing.
Didn't know planes did that, thanks for the info. Is that one of the procedures they do when on the tarmac waiting for the tower to let them take off?
Definitely am not planning on doing too much fishtailing any time soon! (:

Can anybody help me figure out a way to do this to match the signs on the road (i.e. 7% slope ahead, etc.) I want a display with a # like this, so I can use it and compare it.

Thanks!
__________________
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.

 05-10-2013, 04:22 AM #14 (permalink) EcoModding Lurker     Join Date: Apr 2013 Location: MN Posts: 53 Land Shark - '11 Toyota Yaris 3dr Hatchback Team Toyota 90 day: 36.68 mpg (US) Thanks: 0 Thanked 5 Times in 4 Posts The percent slope measurements mean for a given distance, your elevation will increase or decrease that percent of the distance. I.e. 7% downgrade means if you travel 100 ft, you'll drop 7. Also torque can read and clear trouble codes, and it's only free, well the free version is, but it's not quite as nice as the paid version, which is \$5. Both will need a OBD2/Bluetooth adapter, which is \$15-20.
...beats walking...

Join Date: Jul 2009
Location: .
Posts: 6,190
Thanks: 179
Thanked 1,525 Times in 1,126 Posts
Quote:
 Originally Posted by jeff88 Not sure how facetious you were trying to be, but I will respond with a facetious answer nonetheless... It will be pretty hard to drive with one hand, shift with the other and hold a string up in the air with my third hand! Also, I like to follow the law: don't derive and drive!
I wasn't being facetious at all! Just suggesting a genuine K.I.S.S. 100%-mechanical solution.

Hang the pendulum from the rearview mirror, with the pendulum weight "centered" over a 6" x 6" piece of white cardboard with concentric rings (like a bullseye target) drawn on it.

The longer the pendulum length, the further apart the 'rings' will be.

The distance between each concentric 'ring' would indicate inclination. You could even do 1º increments (if you do the algebra/trig correctly) if you're really good at drawing concentric circles (use a compass).

To "calibrate" the device, simply "center" cardboard directly under the pendulum with the car on level surface, then "verify" the accuracy by driving up a known incline (a home driveway). Use: "rise-over-run" to calculate (trig table) the driveway inclination angle.

Last edited by gone-ot; 05-10-2013 at 12:42 PM..

 The Following User Says Thank You to gone-ot For This Useful Post: mcrews (05-10-2013)
Lots of Questions

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

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.2 mpg (US)
Thanks: 338
Thanked 97 Times in 76 Posts
Quote:
 Originally Posted by Old Tele man I wasn't being facetious at all! Just suggesting a genuine K.I.S.S. 100%-mechanical solution. Hang the pendulum from the rearview mirror, with the pendulum weight "centered" over a 6" x 6" piece of white cardboard with concentric rings (like a bullseye target) drawn on it. The longer the pendulum length, the further apart the 'rings' will be. The distance between each concentric 'ring' would indicate inclination. You could even do 1º increments (if you do the algebra/trig correctly) if you're really good at drawing concentric circles (use a compass). To "calibrate" the device, simply "center" cardboard directly under the pendulum with the car on level surface, then "verify" the accuracy by driving up a known incline (a home driveway). Use: "rise-over-run" to calculate (trig table) the driveway inclination angle.
Oh got it! That makes total sense! I like the idea, but I'm really looking for a little digital display that will tell me a specific # in a set unit. If I could have this in my ultragauge, it would be even better, but I guess I will have to make my own. I need a way to measure what that pendulum swing is (or any other measurement device, say a gyro) and then display it.

It sounds like even though it might be expensive, the Gduino would be my best route unless somebody has another idea.

Thanks!
__________________
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.

 05-12-2013, 06:57 AM #17 (permalink) Master EcoModder   Join Date: Apr 2013 Location: World Posts: 385 Thanks: 82 Thanked 82 Times in 67 Posts I really like Old Tele man's pendulum accelerometer. It's so simple and easy I think you have to try it and see if it will do what you want. You could also home build the fluid filled inclinometer. It would be a loop (to prevent spills - use an irrigation pipe joiner to form the loop) of clear plastic tube, part filled with water, fastened to a board using U staples with an angle scale marked on it. Food colouring in the water would make it easier to read. Did you find Accelmeter and Clinometer iPhone apps. which amount to the same thing as the physical pendulum and inclinometer? Maybe you can find a used first generation G-Tech cheaply. Could you find a digital protractor/inclinometer cheaply. (New I think they start around \$50.) A problem with each of those is they don't separate vehicle acceleration from the change in acceleration due to the slope. That would be OK if you could hold a steady speed on the slopes. Maybe you could 'map' the slopes of roads you regularly travel on by stopping or ensuring that you were travelling at a steady speed when taking the measurement. To use an Arduino: Arduino - ADXL3xx might get you started on how to measure the accelerations. The adafruit ADXL335 3-axis board is U\$15. The display could be 2 or 3, 7-segment LED's, driven by a 4511 binary coded decimal to 7-segment driver and multiplexed. There's any number of tut's on how to do that. Three displays, the 4511, 3 transistors and the current limiting resistors would be ~U\$15. (You might prefer to use a 16x2 LCD display instead if you intend to use the Arduino for other things as well.) A prototype shield board for maybe \$5 and some wire plus the Arduino @ ~\$40. Under \$100 for the whole thing and you will still be able to use the Arduino for the grill block as well. Too expensive? You will have to do some 3D trig. in the code/sketch to convert the outputs from the sensor into something sensible to you on the display. You will also have to read the vehicle speed sensor (I'll assume that your car does have one - it should), convert the rate of change in that into a linear acceleration, and subtract or add that to the 3-axis sensor acceleration. That won't require extra hardware to do though. It still doesn't address lateral acceleration. There are the gyro. sensors that might be used to remove that due to turning - the car will be yawing if there is lateral acceleration - but it gets more complex with it. A lateral slope will still be a problem. If it helps, the maximum acceleration, slope plus change in vehicle speed, that I saw on a G-Tech when I was checking typical acceleration, some time ago, during 'normal' driving, was a little over 0.30g. That means you will probably need the 3 digits to get something meaningful in terms of slope i.e. to display the 'g' reading as something like (.)300(g). 7% (^) would read 070. The decimal point being implied.
 The Following User Says Thank You to Occasionally6 For This Useful Post: jeff88 (05-12-2013)
Lots of Questions

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

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.2 mpg (US)
Thanks: 338
Thanked 97 Times in 76 Posts
I agree, the pendulum is a great idea, unfortunately, for this application I am looking for something a little different. It would definitely be fun to play with though!

I also like the DIY fluid inclinometer, but again, not quite what I am looking for in this application. I think of the two options, I would try this one first though as in my mind, it would be easier to read the markers on a vertical axis, rather than on a flat board underneath a pendulum. Both would make for some interesting projects though!

I found the apps for my Galaxy S3, but again, difficult to read while driving and I will have to remember to turn the app on when I get in the car (meaning it won't happen ) One inclinometer app I found has the degrees unit that I am looking for, though! (:

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

As far as the arduino goes, I think I will probably end up doing that, but will need a TON of hand-holding as it will be my first time. I *think* I found the ADXL335 board: ADXL335 and a display: Display

For the prototype shield board do you mean this: Prototype Shield Board or this: Mini Breadboard or something else?

What else would I need? Do I still need the Arduino itself? Would this: Mega 2560 or this: Arduino UNO be it?

Like I said, hand holding

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.

I really appreciate the help!
__________________
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.

 05-12-2013, 04:59 PM #19 (permalink) Master EcoModder   Join Date: Sep 2009 Posts: 5,927 Thanks: 877 Thanked 2,020 Times in 1,303 Posts A curved piece of clear plastic tubing (could be hose) with a bubble of air in it with a mirror so you could look ahead and see the angle without having to take your eyes off the road would be neat. Just thought of it, maybe I'll build one. Where I live the grades are very mild, with the worst being the Interstate overpasses, but when I get in the mountains my perception of grades is terrible. regards Mech
Master EcoModder

Join Date: Apr 2013
Location: World
Posts: 385
Thanks: 82
Thanked 82 Times in 67 Posts
Quote:
 Originally Posted by jeff88 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:
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.

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.