View Single Post
Old 05-22-2013, 03:50 AM   #39 (permalink)
Master EcoModder
Join Date: Apr 2013
Location: World
Posts: 385
Thanks: 82
Thanked 82 Times in 67 Posts
Originally Posted by jeff88 View Post
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.

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.

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

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.

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.

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.

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.

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.

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.

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

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.

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.
Attached Thumbnails
Click image for larger version

Name:	Voltage  Divider Map Patch - C.png
Views:	58
Size:	11.7 KB
ID:	13068  

Last edited by Occasionally6; 05-22-2013 at 04:25 AM.. Reason: power, ground and common cathode and anode relations transposed
  Reply With Quote
The Following User Says Thank You to Occasionally6 For This Useful Post:
jeff88 (05-23-2013)