0

Automotive application Using Boarduino
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Automotive application Using Boarduino

by Frank843 on Fri Feb 29, 2008 2:17 pm

I have a Boarduino on order and am planning on using it in an automotive application. I was wondering if anyone has any experience with the following:

1) mileage (odometer) **
2) trip odometer **
3) speed (speedometer) **
4) GPS coordinates
5) O2 sensor data, and other sensor data

** I would like to tackle #1 through #3 first, before I get into the more complicated items.

Although the Boarduino has a voltage regulator that can probably handle the car voltage (12v) to 5V conversion, I am unsure how "clean" it would be.

Also, I would prefer to count and display the mileage (#1 and #2 above) on an LCD and write to the EEPROM when the engine is shut off. Obviously, this creates a dilema, the Boarduino needs to be able to function for a few seconds AFTER the power has been turned off. I am unsure how to handle this.

If I had a PC with this situation, I would says "add a UPS", but how would I go about doing this with a Boarduino. My guess would be related to a capacitor, but I am unsure.

Anyone have any experience with this kind of thing? Any input would be welcome.
Thanks.
Frank843
 
Posts: 29
Joined: Sun Feb 24, 2008 12:34 am

by darus67 on Fri Feb 29, 2008 3:18 pm

Automotive power is notorious for being horrifically bad in terms of noise
and voltage spikes.

As for running after the car is shut off, simply power the Boarduino from a
circuit that is NOT switched off with the key. Then, have a connection to a
circuit that IS switched drive an input that the Boarduino can read.
That way it can know that the car has been switched off, take care of any
housekeeping, store data in eeprom, and then go to sleep.
In sleep mode it should draw an insignificant amount of power from the car's
battery. You also then need a circuit to wake it up when the car is turned on again.
"He's just this guy. You know?"
darus67
 
Posts: 246
Joined: Wed Sep 26, 2007 10:25 pm
Location: Minnesota, USA

Automotive application Using Boarduino

by Frank843 on Fri Feb 29, 2008 3:36 pm

darus67 -

So, how should one "smooth out the spikes"?

As for the circuit that is not turned off when the ignition is turned off... which circuit would that be? I don't know of any system in a car that is still running after I turn off my key....

Any thoughts?
Frank843
 
Posts: 29
Joined: Sun Feb 24, 2008 12:34 am

by caitsith2 on Fri Feb 29, 2008 4:00 pm

For circuits that still function even when the key is off, interior lights for one. (That is the light that turns on when you open the door.)

As for waking the AVR, Set up an interrupt, and have a relay ground the line that the interrupt is setup on. That should wake it up, to proceed. At this point, the AVR can turn the interrupt off, and poll the specific line, as part of its loop of doing everything else.
caitsith2
 
Posts: 217
Joined: Thu Jan 18, 2007 11:21 pm

by darus67 on Fri Feb 29, 2008 4:03 pm

Also, if you have #4, gps data, I believe you can get #'s 1, 2, & 3 for free.
The output of a GPS is typically serial data in NMEA (google for it) format.
Once a second you get a string that contains position, speed, & a timestamp.
That gives you #3, speed. If you integrate speed over time, you get #1 mileage.
The trip odometer is just another mileage counter that you can zero out.
"He's just this guy. You know?"
darus67
 
Posts: 246
Joined: Wed Sep 26, 2007 10:25 pm
Location: Minnesota, USA

Re: Automotive application Using Boarduino

by darus67 on Fri Feb 29, 2008 4:09 pm

Frank843 wrote:darus67 -

So, how should one "smooth out the spikes"?


Unfortunately I don't have a solid answer for that. I haven't any real
experience dealing with noisy power suppy.

As for the circuit that is not turned off when the ignition is turned off... which circuit would that be?


There are several circuits that are not switched off with the key.
Lights, as caitsith2 mentioned, often the cigarette lighter er... I mean
accessory power jack is always on.
"He's just this guy. You know?"
darus67
 
Posts: 246
Joined: Wed Sep 26, 2007 10:25 pm
Location: Minnesota, USA

by Jaguarjoe on Fri Feb 29, 2008 4:27 pm

Follow this link for the Megasquirt EFI system. The schematics will show how to massage the sensor inputs to it and also shows the bullet proof power supply for it:

http://www.megasquirt.info/
Jaguarjoe
 
Posts: 8
Joined: Fri Jan 04, 2008 7:58 pm

Automotive application Using Boarduino

by Frank843 on Fri Feb 29, 2008 4:54 pm

I believe there should be two sources of current:

1) one that is regulated and "smoothed" for the circuit to run on
2) one that is tied to an IC pin, so when the iginition is turned off, the pin will no longer have any current (this should tell the IC to the save data to the EEPROM because the ignition has been turned off).

It would seem to me that both sources need to be regulated, to avoid burning out a pin on the Boarduino (in reference to #2). Unless I use some kind of sensor that can handle the current, that would send a signal to the pin.

When #2 is off, #1 should continue to provide current for at least a few seconds so the data can be stored in the EEPROM.

Although, tapping power off the lights or dome lights sounds interesting, that implies that those lights would need to be on all the time. This is not feasible.

There must be a simpler way than this......

Using GPS data is interesting but not feasible. On rainy days, under trees, or in tunnels, there will be no satellite lock and therefore, the unit could not make the appropriate calculations.

Any other thoughts?
Frank843
 
Posts: 29
Joined: Sun Feb 24, 2008 12:34 am

Re: Automotive application Using Boarduino

by darus67 on Fri Feb 29, 2008 5:50 pm

Frank843 wrote:I believe there should be two sources of current:

1) one that is regulated and "smoothed" for the circuit to run on
2) one that is tied to an IC pin, so when the iginition is turned off, the pin will no longer have any current (this should tell the IC to the save data to the EEPROM because the ignition has been turned off).


Exactly.

Although, tapping power off the lights or dome lights sounds interesting, that implies that those lights would need to be on all the time. This is not feasible.


It doesn't mean that the lights have to be on all the time. You simply tap
the circuit upstream of the switch that controls the lights.

Using GPS data is interesting but not feasible. On rainy days, under trees, or in tunnels, there will be no satellite lock and therefore, the unit could not make the appropriate calculations.


Thats a good point. I hadn't considered that.

Then you will have to find a signal from the existing speedometer and
count pulses. The number of pulses per second gives speed, and the total
number of pulses gives distance. The exact details on the signal you need
to measure will vary greatly depending on what vehicle you're planning to
install this in. If its an older vehicle with a mechanical speedometer/odometer
then you'll have to install your own rotation sensor
on the driveshaft or axle.
"He's just this guy. You know?"
darus67
 
Posts: 246
Joined: Wed Sep 26, 2007 10:25 pm
Location: Minnesota, USA

Automotive application Using Boarduino

by Frank843 on Fri Feb 29, 2008 6:40 pm

[quote]It doesn't mean that the lights have to be on all the time. You simply tap
the circuit upstream of the switch that controls the lights. [/quote]

This means that there will be a constant drain on the battery even after the car is turned off. It doesn't sound like much, but have you ever been on vacation for 2-3 weeks?

I think it would make more sense to try to charge a capacitor as you are driving and as you turn off the ignition, have the capacitor discharge into the circuit. Since the capacitor would be feeding the circuit, it would give the circuit a chance to save the data to the EEPROM.

Its a form of battery backup like a UPS for PCs.
This eliminates the drain on the battery.

Of course, that leaves the question, how to design it?[/quote]
Frank843
 
Posts: 29
Joined: Sun Feb 24, 2008 12:34 am

Automotive application Using Boarduino

by Frank843 on Fri Feb 29, 2008 7:27 pm

JaguarJoe,
Thanks for the link to the MegaSquirt website.

In looking at the power schematics, it gave me some additional insight into how to approach my problem. Unfortunately, it still doesn't address my need to have the circuit powered after the ignition is turned off.

I'll probably go back to it often to see if there is anything else I can gleem from the pages.

Now, that I think about it, I wonder how the circuits are designed for the headlights that automatically turn off after you have exited a car.

Any way, thanks for the good reference.
Frank843
 
Posts: 29
Joined: Sun Feb 24, 2008 12:34 am

Re: Automotive application Using Boarduino

by Entropy on Sat Mar 01, 2008 8:59 pm

darus67 wrote:[
Lights, as caitsith2 mentioned, often the cigarette lighter er... I mean
accessory power jack is always on.

That is car-dependent. Some do not have switched accessory power like my '95 Chrysler LeBaron, some do like my parents '04 Subaru Outback and I think the same for their '96 Dodge Grand Caravan.

Now the radio almost ALWAYS has both a switched and unswitched power input. Usually the unswitched power is a heavy gauge cable, and the unswitched power is a small one. The radio draws all of its current from the unswitched line in this case, and the switched power is a signal to tell the radio to go to sleep. The reason for unswitched power to the radio is that most cars have a clock in the radio, even ones that have clocks elsewhere.

If you are careful about reducing "off time" current consumption, you should be able to use the "main power from unswitched, use switched power as a signal" approach safely, as many automotive systems do the same thing, with car radios being the best such example.
Entropy
 
Posts: 472
Joined: Tue Jan 08, 2008 12:43 am
Location: Owego, NY USA

Automotive application Using Boarduino

by Frank843 on Mon Mar 03, 2008 2:19 pm

My thoughts were that the Atmel chip would poll a pin and when the ignition was turned off, the chip would write the mileage information into EEPROM.

It makes no sense to me to write to the EEPROM at every mile but if you don't write to it some time, you can't maintain the odometer reading.

As for the power, since the ATmel chip only has to be on for a few seconds after the engine is turned off, it doesn't seem logical to me to keep in an always "on" state.

Instead, I would rather charge up a "battery/capacitor" somewhere in the circuitry, have it provide the few seconds of power after the ignition is turned off and have it discharge in the process.

The chip only needs to have time to write to the EEPROM before is loses all power (which should not be more than a second or two).

Any other thoughts?
Frank843
 
Posts: 29
Joined: Sun Feb 24, 2008 12:34 am

by sliverstorm on Tue Mar 04, 2008 6:38 am

sounds awesome. I wish my car actually used electrical signals to drive the speedo... cable. :/ that's 1986 for you though.

I agree with the above poster; a capacitor with sufficient capacity (as it were) should do you nicely. The real question is how much would you need.
sliverstorm
 
Posts: 16
Joined: Sat Apr 22, 2006 1:32 pm
Location: California

by dcmk1mr2 on Mon Mar 10, 2008 10:51 am

You may have a electric speed signal as well as the mechanical speedometer. If your car is fuel injected (not carburetor) there is probably a sensor on your transmission or drive train that is proportional to speed. If not, later models of your car may have gone to electronic sensors, but kept the transmission, so there may be a sensor that you could plug into in place of the speedo sender.

This takes advantage of the cars OBDII diagnostic information to get speed and fuel use and displays on a boost gauge, repurposed as a MPG gauge:
http://www.circuitcellar.com/AVR2004/first.html

You might get some ideas from here:
http://www.scangauge.com/

I have a '87 (Pre OBDII) and plan to build a MPG gauge. The engine has a current limiting resistor for each fuel injector, making it easy to measure when the injectors are on. It does have both a mechanical speedo and electronic speed signal.

dcmk1mr2
 
Posts: 3
Joined: Thu Jan 04, 2007 9:09 am

Please be positive and constructive with your questions and comments.