EcoModder.com

EcoModder.com (https://ecomodder.com/forum/)
-   Instrumentation (https://ecomodder.com/forum/instrumentation.html)
-   -   On-the-Go Slope Measurement (https://ecomodder.com/forum/showthread.php/go-slope-measurement-25776.html)

jeff88 05-08-2013 03:57 AM

On-the-Go Slope Measurement
 
Was thinking today if there was a way to measure the slope of the road while driving, so you would know how much uphill and how much downhill you are driving at any given time. It would be nice to know in general, but could also help with FE measurements.

Maybe a gyro and measure the change/movement?

Any ideas?

Sean.Heihn 05-08-2013 04:11 AM

The Android app Torque can, as long as your phone/tablet has a gyroscope. Plus it can measure 3 axis acceleration and body sway.

andyn666 05-08-2013 06:59 AM

The instrument your looking for is called an inclinometer, you can get them in either digital or analog format, you see them in some 4x4s
Andy

jeff88 05-08-2013 11:40 AM

Thanks guys!

I'll look into that inclinometer, see what I can find.

Does the Galaxy S3 have a gyroscope?

andyn666 05-08-2013 03:40 PM

Yes the S3 does, you should be able to find an app for it

Andy

brucey 05-08-2013 03:54 PM

The problem with inclinometers is they are affected by curves and movement.

You know, what happens when you drive through mountains.

The most reliable slope gauge I have is actually my scan gauge. The instant MPG reading will tell you if you're going up or down hill or flat. When it's reading 15 MPG I'm going up a 7 percent grade. When mine hit's 60 mpg, I can shift into neutral and coast. Anything steeper (more INSTANT MPG) than that going down hill and I will gain speed.

These speeds are only true at 60 mph, give or take.

Sean.Heihn 05-08-2013 03:54 PM

To be able to measure ECU sensor data, you'll need some sort of OBD2 adapter, Bluetooth are the most convenient but USB to OBD2 adapters will work if your phone is USB OTG capable. Otherwise, you'll only be able to read the phone's onboard sensor data, like GPS, gyroscope, accelerometer, etc...

Also, a gyroscope will be more accurate than the fluid filled inclometers in respects to false readings. And it wouldn't be hard for an app to differentiate between acceleration/deceleration body tilt and incline by using accelerometer data. I.e. braking would produce a different accelerometer reading than going down hill, yet both would cause the body to tilt forward.

jeff88 05-08-2013 09:55 PM

Quote:

Originally Posted by brucey (Post 370240)
The problem with inclinometers is they are affected by curves and movement.

You know, what happens when you drive through mountains.

The most reliable slope gauge I have is actually my scan gauge. The instant MPG reading will tell you if you're going up or down hill or flat. When it's reading 15 MPG I'm going up a 7 percent grade. When mine hit's 60 mpg, I can shift into neutral and coast. Anything steeper (more INSTANT MPG) than that going down hill and I will gain speed.

These speeds are only true at 60 mph, give or take.

Yeah, mis-reads from curves and movement around mountains and hills won't work around here in the Bay Area... just a mountain or two around here! :)

Actually, watching my MPG go up and down on my UG, while on cruise control is what gave me this idea, because the MPG change will tell me of a slope up or down, but not how much. I just wanted something a little more accurate.

Quote:

Originally Posted by Sean.Heihn (Post 370241)
To be able to measure ECU sensor data, you'll need some sort of OBD2 adapter, Bluetooth are the most convenient but USB to OBD2 adapters will work if your phone is USB OTG capable. Otherwise, you'll only be able to read the phone's onboard sensor data, like GPS, gyroscope, accelerometer, etc...

Also, a gyroscope will be more accurate than the fluid filled inclometers in respects to false readings. And it wouldn't be hard for an app to differentiate between acceleration/deceleration body tilt and incline by using accelerometer data. I.e. braking would produce a different accelerometer reading than going down hill, yet both would cause the body to tilt forward.

So now the question is does the S3 have OTG? Also, having a UG already, I don't know how I can get Torque or similar to work, unless I get a splitter cable, but then I am eating up an awful lot of bandwith.

So a gyroscope will indeed work then? How would I go about setting it up? How do I know if my car has an accelerometer? Do I need that with a gyroscope or would that be a separate system?

Thanks!

Occasionally6 05-09-2013 04:47 AM

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.

Sean.Heihn 05-09-2013 05:38 AM

Quote:

Originally Posted by jeff88 (Post 370307)
So now the question is does the S3 have OTG? Also, having a UG already, I don't know how I can get Torque or similar to work, unless I get a splitter cable, but then I am eating up an awful lot of bandwith.

So a gyroscope will indeed work then? How would I go about setting it up? How do I know if my car has an accelerometer? Do I need that with a gyroscope or would that be a separate system?

Thanks!

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.

gone-ot 05-09-2013 03:14 PM

Pendulum on a string = DIY inclinometer.

Use protractor and algebra to calculate pendulum distance vs. angle.

P-hack 05-09-2013 07:13 PM

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.

jeff88 05-10-2013 12:26 AM

First, Ugghhh! I was trying to reply earlier today on my phone and all I was having was problems. :mad: OK, rant over!

Quote:

Originally Posted by Occasionally6 (Post 370343)
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 (Post 370347)
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 (Post 370447)
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! :p

Quote:

Originally Posted by P-hack (Post 370487)
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!

Sean.Heihn 05-10-2013 03:22 AM

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.

gone-ot 05-10-2013 11:34 AM

Quote:

Originally Posted by jeff88 (Post 370534)
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! :p

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. :D

jeff88 05-11-2013 04:33 PM

Quote:

Originally Posted by Old Tele man (Post 370624)
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. :D

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!

Occasionally6 05-12-2013 05:57 AM

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.

jeff88 05-12-2013 03:45 PM

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 :D) 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 :D

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!

user removed 05-12-2013 03:59 PM

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

Occasionally6 05-14-2013 03:37 AM

Quote:

Originally Posted by jeff88 (Post 371103)
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 :D
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.

gone-ot 05-14-2013 08:18 PM

Maybe you could *revise* this 1968 "G-whiz" idea into an inclinometer SENSOR that provides input to your handheld to read and calculate the road angle from?

• source: Popular Electronics Magazine, Sept 1968: Popular Electronics Magazine, September 1968

Xist 05-15-2013 01:16 AM

I have been coasting down hills in neutral for years and had also wanted an inclinometer. This Sunday was the first time that I drove to my parents' house using pulse and glide. I pulsed up. I glided down. If the hills were not steep enough, I would pulse again, but it was interesting, I was not as concerned with maintaining speed, I was satisfied with a slow deceleration.

I wish that I could say that it was a record trip.

I did forget to check my tire inflation, but when I noticed uneven wear, I stopped over-inflating.

Occasionally6 05-15-2013 04:33 AM

Quote:

Originally Posted by Old Tele man (Post 371574)
Maybe you could *revise* this 1968 "G-whiz" idea into an inclinometer SENSOR that provides input to your handheld to read and calculate the road angle from?

• source: Popular Electronics Magazine, Sept 1968: Popular Electronics Magazine, September 1968

That's fantastic. Yes, I can see no reason why it could not be modified to feed the output into a digital display (if that is desired). I think it would be cool to build as described though. (I'm tempted to do it but I already have too many other projects I want to build.)

It is still an accelerometer, not (yet?) something capable of measuring an incline in a moving vehicle that is also accelerating. The error due to the slope across the road is also present. That's small in comparison to vehicle acceleration, so can be ignored if that is the intended purpose but not in an inclinometer. An easy way to illustrate the effect is to induce a 90 degree xy "slope" by turning the unit on its side. It then won't work quite as well. For an inclinometer I think digital is required.

I need to correct an error: +z is by convention down not up. (That makes the coordinate system right handed, matching the 3-axis output.)

Another source of Arduino tutorials can be found here:

Getting Started with Arduino!

I picked that page because it is doing exactly the same thing that is required to get 3-axis accelerometer data into an Arduino, process it and ultimately display it. It just uses the single temp. sensor voltage as an input where the 3-axis has 3 voltage inputs.

It occurs to me that maybe measuring an incline isn't necessarily the most useful thing to do with the accelerometer data. I am pretty sure the accelerations can be integrated (in the math sense), the vehicle mass added in and the kinetic and potential energies of the vehicle calculated. I can see those being really useful.

At the very least, setting up a real time lateral and longitudinal g force display is a cool project, however it is done.

Nevyn 05-15-2013 10:04 AM

Why not get one of these?

Angle Slope Level Meter Finder Tool Gradient Balancer Car Vehicle Inclinometer | eBay


http://i.ebayimg.com/t/Angle-Slope-L...Wf!~~60_12.JPG

gone-ot 05-15-2013 11:02 AM

A weighted ball in clear viscous fluid, inside a see-through ball!

Nevyn 05-15-2013 11:08 AM

Yep. I've wanted one FOREVER for in my car. However, only recently did I find them inexpensive enough to consider getting.

In airplanes, they're known as "artificial horizons." The technical term is "Attitude Indicator."

However, getting one from a plane to put in a car is several hundred dollars - USED!

chumly 05-15-2013 11:26 AM

Thanks, I've been looking for something like this for a long time. Chumly

jeff88 05-16-2013 05:08 PM

Quote:

Originally Posted by Old Mechanic (Post 371106)
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

That is a good idea, it sounds like a construction level, but again I'm looking for a digital gauge. You should definitely build one, though and let us know how it goes!

Quote:

Originally Posted by Old Tele man (Post 371574)
Maybe you could *revise* this 1968 "G-whiz" idea into an inclinometer SENSOR that provides input to your handheld to read and calculate the road angle from?

• source: Popular Electronics Magazine, Sept 1968: Popular Electronics Magazine, September 1968

I'll look into that, thanks. I wonder if I will need it if I can just attach an accelerometer that is designed for an Arduino directly to the Arduino board.

Quote:

Originally Posted by Xist (Post 371599)
I have been coasting down hills in neutral for years and had also wanted an inclinometer. This Sunday was the first time that I drove to my parents' house using pulse and glide. I pulsed up. I glided down. If the hills were not steep enough, I would pulse again, but it was interesting, I was not as concerned with maintaining speed, I was satisfied with a slow deceleration.

I wish that I could say that it was a record trip.

I did forget to check my tire inflation, but when I noticed uneven wear, I stopped over-inflating.

Having a reading of the slope of the road would definitely help you determine what the best time to glide/coast is. After a learning period, knowing a grade of 7% will help you determine how far you can get just by coasting. I have been learning how to maintain a slow deceleration in neutral and slow down to the perfect speed right when I get to a turn into a parking lot or streetlight or whatever. It's kinda a little victory when I can do it right!

Over inflation can definitely be as bad as under inflation. Unfortunately the tire pressure threshold for up or down is really small and that range is different for every car. Good to hear you noticed the uneven wear and made a change.

Quote:

Originally Posted by Occasionally6 (Post 371614)
That's fantastic. Yes, I can see no reason why it could not be modified to feed the output into a digital display (if that is desired). I think it would be cool to build as described though. (I'm tempted to do it but I already have too many other projects I want to build.)

It is still an accelerometer, not (yet?) something capable of measuring an incline in a moving vehicle that is also accelerating. The error due to the slope across the road is also present. That's small in comparison to vehicle acceleration, so can be ignored if that is the intended purpose but not in an inclinometer. An easy way to illustrate the effect is to induce a 90 degree xy "slope" by turning the unit on its side. It then won't work quite as well. For an inclinometer I think digital is required.

I need to correct an error: +z is by convention down not up. (That makes the coordinate system right handed, matching the 3-axis output.)

Another source of Arduino tutorials can be found here:

Getting Started with Arduino!*

I picked that page because it is doing exactly the same thing that is required to get 3-axis accelerometer data into an Arduino, process it and ultimately display it. It just uses the single temp. sensor voltage as an input where the 3-axis has 3 voltage inputs.

It occurs to me that maybe measuring an incline isn't necessarily the most useful thing to do with the accelerometer data. I am pretty sure the accelerations can be integrated (in the math sense), the vehicle mass added in and the kinetic and potential energies of the vehicle calculated. I can see those being really useful.

At the very least, setting up a real time lateral and longitudinal g force display is a cool project, however it is done.

Build one! Would love to see what everybody comes up with! I'll stick with the digital (hopefully a pre-built module) if I am going to do an Arduino. Thanks for the extra link, that looks like it will be a great resource! I'm still a little lost, so I'm not sure what you mean by integrating the acceleration #s, adding mass and KE and PE. I would like the inclinometer output, but if these numbers can give me other useful information, I would be open to looking into it.

Quote:

Originally Posted by Nevyn (Post 371634)

That is very interesting and I like the price tag, but I would like something with a digital display. A quick glance I know the incline. Also, my dash is not flat, so by default, I think it would be off, unless I make something to force it into level.

jeff88 05-16-2013 06:51 PM

Quote:

Originally Posted by Occasionally6 (Post 371438)
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! :p

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! :D

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... :p

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!

jeff88 05-16-2013 07:20 PM

What I Need...
 
  • Arduino Mega board Mega 2560
  • Accelerometer/Gyro MPU 6050
  • Display Common Cathode Display
  • Tools: Soldering Iron, digital multimeter, Phillips/Flathead screwdrivers, etc.
  • Wire (CAT5, ribbon cable)
  • Solder Lead-Free Electrical Solder
  • Transistors (BC337 NPN's)
  • Veroboard
  • Diodes 1n4004 Diode
  • Resistors (4 kinds, 1 type for LED, 1 type for transistor/ground wire of LED, 1 type for part A of voltage divider, 1 type for part B of voltage divider)
  • Pin Headers?
  • A whole lot of knowledgeable people who know more than me!

gone-ot 05-16-2013 07:21 PM

...sorta makes the K.I.S.S. "string & plumb-bob" idea look much better?

Occasionally6 05-17-2013 07:15 AM

Quote:

Originally Posted by Nevyn (Post 371634)
Why not get one of these?

Because, like the other suggestions we've come up with, from 5 cent pendulum to $100 Arduino plus accelerometer but minus speed input, it won't measure slope in a moving vehicle. They will all be measuring the slope plus some component or all of whatever acceleration the vehicle is subject to.

It's easiest to describe using the pendulum device. Stop on a slope and the pendulum will be at some angle relative to the car. Accelerate away from rest and the pendulum will swing towards the back of the car, no longer indicating the slope.

What is needed is a way to determine the acceleration of the car relative to the road and subtract that acceleration from the total acceleration (along the slope; x direction) to leave the gravitational component. It will be possible to do that with the Arduino. I expect it would also be possible with the G-Whiz, a speed sensing input and some analog computing but the Arduino will be easier.

Occasionally6 05-17-2013 07:31 AM

Quote:

Originally Posted by jeff88 (Post 371847)
Build one!

Maybe but you've drawn me into building an Arduino based one now. (I had to buy only the prototype board and some connectors.)

Quote:

I'm still a little lost, so I'm not sure what you mean by integrating the acceleration #s, adding mass and KE and PE. I would like the inclinometer output, but if these numbers can give me other useful information, I would be open to looking into it.
That's probably trying run before walking but it's feasible.

Integration in the mathematical sense. If you have acceleration you can sum that over time to get velocity or measure the (x-direction) velocity directly with the speed sensor input. With x-direction velocity, KE=(m x v^2)/2.

Integrate velocity you have displacement. Use z-direction displacement to get PE=m x g x h. Where m = mass, v=velocity, g=gravitational acceleration, h=height from an arbitrary reference.

I can explain it further but maybe we should wait until the basics are sorted.

Occasionally6 05-17-2013 11:59 AM

Quote:

Originally Posted by jeff88 (Post 371864)
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.

Quote:

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.

Quote:

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

Quote:

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.

Quote:

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

Quote:

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.

Quote:

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.

Quote:

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.

Quote:

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.

Quote:

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

Quote:

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.

Quote:

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

Quote:

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.

Quote:

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.

Quote:

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.


Quote:

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.

Quote:

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.

Quote:

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.

Quote:

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.

Quote:

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.

Quote:

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.

Quote:

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.

Quote:

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.

Quote:

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

Quote:

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?

Xist 05-17-2013 03:27 PM

If nothing else, until you can get your project to work, you can use it as a pendulum! :D

jeff88 05-17-2013 09:49 PM

Quote:

Originally Posted by Occasionally6 (Post 371929)
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 (Post 371946)
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 (Post 371946)
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 (Post 371946)
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 (Post 371946)
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 (Post 371946)
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 (Post 371946)
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 (Post 371946)
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 (Post 371946)
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 (Post 371946)
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:
http://i1289.photobucket.com/albums/...ps65a31695.png
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 (Post 371946)
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?

Occasionally6 05-19-2013 02:04 AM

Quote:

Originally Posted by jeff88 (Post 372025)
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.

That would be like using two measuring tapes; there's no need. A gyroscope (unless that's what you meant) would add additional data. That could work too/instead.

Quote:

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
Says it's analog here: https://www.sparkfun.com/products/9652

Quote:

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

Quote:

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.
There are a number of ways to get power to the Arduino. They can also be powered via the USB connector, indeed will be while programming. Another suggestion to consider is gutting or using intact a cigarette lighter/accessory socket to USB socket adaptor.

When calculating the "battery" voltage, consider that the alternator will be charging at something more like 14V with the engine running. It would be sensible to check what it is.

Quote:

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?
It would make the sketch simpler. It may be difficult to achieve physically.

Quote:

BTW, do I have to mount the board horizontally, or can I mount it vertically?
You can mount it vertically. That just means that what is nominally the z axis becomes the x or y axis. You just relabel the variables in the sketch to suit.

Quote:

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.
Perfect. It's uses a Hall sensor. It should be 50% duty cycle. That means it will be at 0V for the same angle of rotation as it is at 11V for. With the DMM you can easily check that. With 4 pulses per pinion rotation you should see 11V for 45 degrees of pinion rotation (= driveshaft rotation if they are both rotating together), then 0V for the next 45 degrees and the pattern repeat for the next 270 degrees.

You will tap into the "11V" signal wire. You can do that at the VSS or, more easily, at the ECU (especially if the ECU is in the cabin). Easiest is simply to splice into the signal wire but I don't like cutting into the harness.

When doing things like this I will make a patch harness. Find a wreck (junkyard) and cut off the terminal connector of the equivalent ECU or VSS harness with ~6-8" of the wire still attached.

Unpin the VSS ECU wire or use the VSS connector intact and replace it with the salvaged wire + pin socket or connector. (Be careful not to damage the terminal if unpinning - practice on the wreck).

Solder a pin (same diameter as that which is used on the ECU) or terminals (for connection at the VSS) to the 6-8" of wire (cut it shorter to suit) and attach the vehicle terminal or connector to that. Use heat shrink to protect the terminals against a short circuit.

You can then splice into the new wire without damaging the car wires and return the wiring to stock when you remove the accessory.

You will need to modify the signal on the splice before feeding it into the Arduino. It needs to be between 3V and 5V, not exceed the current limit for the Arduino pin and not pull the signal down so far it affects the VSS input to the ECU.

The way to do it is to put a voltage divider in the splice wire, which is connected to earth. The signal to the Arduino is taken from between the two resistors. The ratio of each resistor to the total resistance is such that the voltage drops give 5V at the point between the two resistors.

The total resistance should be as high as you can use and still get the Arduino to detect the speed input. Total resistance too low will pull the VSS signal to the ECU down. I would start with 10M Ohm and 8.2M Ohm 0.5W resistors (the closest that you can buy to the 8 Ohm a simple V=IR calculation would suggest) and go progressively lower if the Arduino doesn't work with that.

Don't go below 600 Ohm between the VSS signal wire and the Arduino (that will limit the current into the Arduino to < 10mA). Also check that the VSS signal to the ECU is still ~11V. Also check that the VSS signal voltage is actually 11V with the engine running (i.e. with the alternator supplying ~14V). If it goes higher with the engine running you will need a different ratio in the voltage divider to get the 5V.

I would build that circuit on a piece of veroboard (or similar) and put it in a potting box.

Here for reference:

Arduino - PulseIn

Arduino - Constants

Voltage divider - Wikipedia, the free encyclopedia

Quote:

Is that a generic question? If it is, I don't know the answer.
Just that someone else using an MPGuino in the same model will have solved the problem before.

__________________________________________________

Quote:

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)?
Each output - x, y and z - from the analog (i.e. not I2C) 3-axis board needs a separate analog pin. You might want one more of those reserved if you anticipate multiple switch inputs. You're going to run out of pins if you want to use gyro and linear accel. with analog inputs, and want to use a voltage divider on an analog pin for multiple switch inputs as well. You can still use the other pins as digital inputs for switches. You do have 6 pins already used by the LCD module.

Quote:

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")?
analogRead() is implicitly an input command.

Quote:

Would a gyro help me in this endeavor at all? Gyro, or is it not necessary?[/LIST]
You might be able to use a gyro to "dead reckon" the angle i.e. integrate angular acceleration (as for the linear accelerations) to get the total angle moved from a reference point. The integration in Arduino can't be a perfect sum of the accelerations so you would need to reset periodically back to a known starting angle avoid a creeping error.

You might use a situation where there is no change in any of the accelerations for a period of time, like 5 seconds, and/or the vector sum is equal to 1g to indicate the car is stopped. Then use the fact that the linear acceleration will only be that due to gravity when at rest. If you're on a slope in that situation you would use trig. to determine the angles.

jeff88 05-21-2013 09:44 PM

I decided to take a few days to think about this, sleep on it, research a little more and decide what I want to do. I am definitely behind as I will have to learn on the fly how to set everything up as my Arduino knowledge is nothing and my car knowledge is minimal at best. That just means I will continue to have lots of questions throughout this process. :D

Quote:

Originally Posted by Occasionally6 (Post 372154)
That would be like using two measuring tapes; there's no need. A gyroscope (unless that's what you meant) would add additional data. That could work too/instead.

But shouldn't we measure twice and cut once? :p JK, that makes sense. From what I have read, gyros tend to be highly accurate, but drift and accelerometers tend to be less accurate, but don't drift, is that right? So for the best accuracy, I should have both and in the Sketch write in the equation to use both. Would something like this work? It has a +/-2g accel.Accelerometer/Gyro I can't seem to find one built into one module with a +/-1.5g accel. I'm not sure what to look for in a gyro. I can do two separate shields, but 1 would be simpler and cleaner.

Quote:

Originally Posted by Occasionally6 (Post 372154)
When doing things like this I will make a patch harness. Find a wreck (junkyard) and cut off the terminal connector of the equivalent ECU or VSS harness with ~6-8" of the wire still attached.

Unpin the VSS ECU wire or use the VSS connector intact and replace it with the salvaged wire + pin socket or connector. (Be careful not to damage the terminal if unpinning - practice on the wreck).

Solder a pin (same diameter as that which is used on the ECU) or terminals (for connection at the VSS) to the 6-8" of wire (cut it shorter to suit) and attach the vehicle terminal or connector to that. Use heat shrink to protect the terminals against a short circuit.

You can then splice into the new wire without damaging the car wires and return the wiring to stock when you remove the accessory.

I get what you're saying about the patch harness and I like that idea so I don't need to make any permanent cuts. My only problem is I'm a little confused about the execution of it. How do I attach the patch harness to the OEM harness? I'm not getting how to do that without cutting in or doing anything permanent to the OEM harness.

Quote:

Originally Posted by Occasionally6 (Post 372154)
You will need to modify the signal on the splice before feeding it into the Arduino. It needs to be between 3V and 5V, not exceed the current limit for the Arduino pin and not pull the signal down so far it affects the VSS input to the ECU.

The way to do it is to put a voltage divider in the splice wire, which is connected to earth. The signal to the Arduino is taken from between the two resistors. The ratio of each resistor to the total resistance is such that the voltage drops give 5V at the point between the two resistors.

The total resistance should be as high as you can use and still get the Arduino to detect the speed input. Total resistance too low will pull the VSS signal to the ECU down. I would start with 10M Ohm and 8.2M Ohm 0.5W resistors (the closest that you can buy to the 8 Ohm a simple V=IR calculation would suggest) and go progressively lower if the Arduino doesn't work with that.

Don't go below 600 Ohm between the VSS signal wire and the Arduino (that will limit the current into the Arduino to < 10mA). Also check that the VSS signal to the ECU is still ~11V. Also check that the VSS signal voltage is actually 11V with the engine running (i.e. with the alternator supplying ~14V). If it goes higher with the engine running you will need a different ratio in the voltage divider to get the 5V.

I would build that circuit on a piece of veroboard (or similar) and put it in a potting box.

Just wanted to make sure I understand how the voltage divider works. I did a little mock up, using the Wikipedia pic, is this right?

http://i1289.photobucket.com/albums/...ps6b7af013.png

So the difference between the two resistors is what gives the Vout, so the size of the resistor doesn't matter as long as there is a difference (the size matters for current, but not for voltage)?

Can you explain how the V=IR works out to 8M ohms please? So if 5volts and 8.2Mohm, an online calculator says that would mean amps is 6.09e-7. Is that right? I need to have it less than 40milliamps (I think), but that is way less according to the calculator.
Is this what you are talking about? 8.2M ohm resistor What does the % mean?

Quote:

Originally Posted by Occasionally6 (Post 372154)
Each output - x, y and z - from the analog (i.e. not I2C) 3-axis board needs a separate analog pin. You might want one more of those reserved if you anticipate multiple switch inputs. You're going to run out of pins if you want to use gyro and linear accel. with analog inputs, and want to use a voltage divider on an analog pin for multiple switch inputs as well. You can still use the other pins as digital inputs for switches. You do have 6 pins already used by the LCD module.

It looks like I will have to get the MEGA board. The UNO only has 6 analog inputs, which sounds like won't be enough. 3 for the accel., 3 for the gyro, 1 for the VSS, and any others I might need. If I get the MEGA, I will know I have enough pins to do what I want and have extra for any other projects I want to do. I put the display I would like to use in the parts list. Common Cathode LED There is also a common anode display (in the parts list), but I'm not sure what I need (if it will work at all). It says it uses 10 pins, but I wasn't sure if I can use that for an Arduino setup. If it will work with the Arduino, I assume it uses digital pins.

Quote:

Originally Posted by Occasionally6 (Post 372154)
You might be able to use a gyro to "dead reckon" the angle i.e. integrate angular acceleration (as for the linear accelerations) to get the total angle moved from a reference point. The integration in Arduino can't be a perfect sum of the accelerations so you would need to reset periodically back to a known starting angle avoid a creeping error.

I found a forum where somebody has figured out how to setup a gyro and accel. and eliminate the creep. Creep elimination Would this help so I don't have to reset to the starting angle?

Quote:

Originally Posted by Occasionally6 (Post 372154)
You might use a situation where there is no change in any of the accelerations for a period of time, like 5 seconds, and/or the vector sum is equal to 1g to indicate the car is stopped. Then use the fact that the linear acceleration will only be that due to gravity when at rest. If you're on a slope in that situation you would use trig. to determine the angles.

Would this be done to eliminate creep? Would this be necessary with the Kalman filter. Would there be a way to set it up so that after so at a set time (using the time code: time), say 5:00AM, the arduino will reset itself? I don't know if there is a way for the Arduino to automatically come on and then shutoff after re-calibration.The idea would be that when I am at home (parked in the same spot as always), it will reset and the angle of the car would then be implied. Again though, would this be necessary with the filter?

Occasionally6 05-22-2013 03:50 AM

1 Attachment(s)
Quote:

Originally Posted by jeff88 (Post 372565)
I decided to take a few days to think about this, sleep on it, research a little more and decide what I want to do.

That's what I do too.

Quote:

From what I have read, gyros tend to be highly accurate, but drift and accelerometers tend to be less accurate, but don't drift, is that right?
You've got me on that. It may depend upon the context in which they are being used though. A low speed robot can be easily referenced to gravitational acceleration to correct drift.

Quote:

So for the best accuracy, I should have both and in the Sketch write in the equation to use both.
It's just that there's going to be more than one way to do what you want. VSS input and calc. slope from the separated x-axis accel., or use the gyro to dead reckon the angles from a known starting point (or points).

Quote:

I can do two separate shields, but 1 would be simpler and cleaner.
I think there may be some extra error with using separate IC's for accel. and gyro. There's some comment on that in one or more of the Sparkfun descriptions for their 6-axis boards.

Quote:

I get what you're saying about the patch harness and I like that idea so I don't need to make any permanent cuts. My only problem is I'm a little confused about the execution of it. How do I attach the patch harness to the OEM harness? I'm not getting how to do that without cutting in or doing anything permanent to the OEM harness.
See thumbnail.

Quote:

Can you explain how the V=IR works out to 8M ohms please? So if 5volts and 8.2Mohm, an online calculator says that would mean amps is 6.09e-7. Is that right? I need to have it less than 40milliamps (I think), but that is way less according to the calculator.
V=IR is the basis for the proof. 10MOhm is my ballpark safe minimum resistance to avoid altering the ECM signals. It's arbitrary but based on the spec. that many vehicle manufacturers have for DMM's being used for diagnosis; >10M Ohm impedance.

The current you pull through the Arduino plus that through R2 also goes through the VSS, in addition to what is already being drawn by the ECM. Keeping the extra to a minimum minimises the possibility of damaging the VSS and avoids altering the signal that the ECM gets. I doubt it's going to be a problem though.

You might like to measure the current being drawn by the VSS (with the signal high i.e. 11V). That will tell you proportionally how much extra you are adding to it through the voltage divider.

Vout = {R2/(R1 + R2)} x Vin

5V = {R2/(10M + R2)} x 11V

Solving for R2 gives ~8M

Those resistances may be too high to get the Arduino to register the signal and you will have to reduce them. I don't know the lowest possible current it will detect on a pin. There's got to be spec. somewhere though.

Quote:

Is this what you are talking about? What does the % mean?
Yep. That's an expensive resistor though (I know it's the price for a pack).

"2%" is the tolerance. eg. a nominally 100 Ohm resistor could be between 98 and 102 Ohms.

Quote:

It looks like I will have to get the MEGA board. The UNO only has 6 analog inputs, which sounds like won't be enough. 3 for the accel., 3 for the gyro, 1 for the VSS, and any others I might need.
The VSS can be a digital only pin i.e. any Arduino input/output pin, but otherwise, for analog accel and gyro input, yes.

Quote:

I put the display I would like to use in the parts list. There is also a common anode display (in the parts list), but I'm not sure what I need (if it will work at all). It says it uses 10 pins, but I wasn't sure if I can use that for an Arduino setup. If it will work with the Arduino, I assume it uses digital pins.
Yes, you can use that. As it stands, it will require 9 or 10 pins on the Arduino, yes, configured as digital pins. You use 7 pins to drive each of the segments, plus 2 to switch between which of the two digits is on. (Very fast; like a movie film, the human eye doesn't register that the displays are being switched on and off.) Use transistors between the Arduino and each common pin.

You don't necessarily need to use an Arduino pin for the decimal point(s). If that doesn't move; wire it to ground (common anode) or power (common cathode) through a current limiting resistor. The 7 led segments also each need (just 7, not 2 x 7; only 1 digit is on at a time) resistors in between them and the Arduino pin.

A way to reduce the number of pins from 7 to 4 is to use the BCD to 7-segment IC (4511) that I mentioned earlier. That converts a 4 bit binary number to the 7-segment output. You use 4 of the Arduino pins to describe the binary. eg. 8 dec is 1000 bin; one of the Arduino pins is switched high, the rest low (in the sketch), and that is fed into 4 of the 4511 pins. The 4511 IC then switches (all) the 7 segment outputs on to display the 8. With a common anode 7 segment you might need transistors to reverse the 4511 output from supply to ground. (I'd have to look at a data sheet to check how it works. I am pretty sure that it supplies current.)

If you are going to use that, you will need a board to make the circuit on i.e. a shield.

Are you sure you want to use that though? The LCD display module is easier and allows more display options (any ASCII character). The only downside is it costs more.

Quote:

I found a forum where somebody has figured out how to setup a gyro and accel. and eliminate the creep. Would this help so I don't have to reset to the starting angle?
Thanks for the link. I will have to read that more thoroughly than I can atm (that guy is way ahead of where I am) to understand what he did but in general, I think there's a lot there that could be adapted. The principle is the same. (I have a few sketches that I got to via links from there. Some of them look like they will be useful.)

Quote:

Would this be done to eliminate creep? Would this be necessary with the Kalman filter.
The Kalman filter is new to me. I think any filter can only reduce the error, not eliminate it. He did use it on a robot. There will be some differences with that and a vehicle.

Quote:

Would there be a way to set it up so that after so at a set time (using the time code: time), say 5:00AM, the arduino will reset itself? I don't know if there is a way for the Arduino to automatically come on and then shutoff after re-calibration.The idea would be that when I am at home (parked in the same spot as always), it will reset and the angle of the car would then be implied. Again though, would this be necessary with the filter?
You will have to reset at some point; there will always be some error. The time idea is interesting. You may have a better idea if it is workable or not with more accurate knowledge of how much error there is. I suspect that a typical length trip is too long not to require a baseline reset several times throughout it. That shouldn't be a problem if you stop at least a few times or possibly travel at a steady speed for a few seconds at a time.

Occasionally6 05-22-2013 04:05 AM

This what I have used. Items in brackets I could have omitted. The exact parts list will depend upon how you want to arrange the parts.

Gduino Parts List

Essential

Arduino
Hitachi HD 44780 compatible display module
+/-1.5g 3-axis analog output accelerometer board

Other parts

16 wire ribbon cable
prototype shield board
(2 x 100nF capacitors)
(PCB mounted momentary tactile switch)
(LED)
(1k 1/2W resistor)
4 core twisted pair, solid core telephone cable (With the outer insulation stripped off this gives 8 color insulated solid core wires for the circuit board connections.)
(6.0mm (1/4" ) heatshrink)
14 pin Oupiin circuit baord to ribbon cable connector
2 of (8 x 1) pin and 2 of (6 x 1) pin header pins

Consumables

resin cored solder
(solder wick/braid)

Non-Consumables

USB a - USB b cable

Tools

Soldering iron
(DMM)
Wet sponge or cloth (to clean the soldering iron)
blade (craft knife or box cutter)
wire cutter
wire stripper
(tweezers)

I have a quick and dirty sketch running that displays the x, y and z g readings in g. The $100 (actually just under $90) pendulum is up and running.


All times are GMT -4. The time now is 05:44 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com