Searching \ for '[EE] Automotive analog signal conditioning' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/io/atod.htm?key=analog
Search entire site for: 'Automotive analog signal conditioning'.

Exact match. Not showing close matches.
PICList Thread
'[EE] Automotive analog signal conditioning'
2005\06\03@202051 by Anthony Toft

flavicon
face
My car mp3 project has hit a bit of a snag...

The steering wheel controls use various values of resistor, connected to
the (nominally) 12v line. My original plan was to use a voltage divider
and some protection diodes and consume the signal directly into AN0 on
the 16F876A I am using. Little did I know how noisy the signal really
is, and the fact that the voltage varies so much between "engine on" and
"engine off" so much in fact that the controls had no hope of working in
the other state.

I have been trying to figure out the "best way" to sort this problem
out, I think I should be able to use a differential amplifier with one
side connected to the 12v line so I am only ever measuring the
difference between the signal (through a voltage divider) and the
highest it could be. I haven't 'scoped this but I imagine (and could be
very wrong) that the noise will be present on both (signal and
reference) and therefore be rejected.

I have googled for a circuit diagrams and explanations but none deal
with the fact that the inputs to the amp are higher (12v) than the
voltage difference the opamp has (5v) would this be negative gain? Can I
just use a voltage divider here to bring the voltages into range
(perhaps making the reference 1v?

I am not particularly concerned with respect to the output voltage
levels as I will derive them empirically with AN0 so I don't think the
resistors have to match exactly (or do they) How will this all affect
AN0 with respect to it's input impedance?

Does anyone have a favourite set of values for resistors? Anyone done
this before?

Any help is very appreciated, it was going great while I was just using
the PIC, now I'm quickly getting lost.

Anthony


--
Anthony Toft <spam_OUTtoftatTakeThisOuTspamcowshed.us>
    I'm Anton, and I approve this message

2005\06\03@215925 by PicDude

flavicon
face
Take the same voltage that feeds your switch/voltage-divider system, and also
divide it with another pair of resistors for use as an external Vref+ to the
PIC.  This way your switch signal is sort of ratiometric and the A/D value
will always be equal to some proportion of the 2 voltage signals no matter
what the vehicle's voltage.  Noise may still be a bit of a bother so add
proper filtering on the voltage input to both of the dividers.

Cheers,
-Neil.



On Friday 03 June 2005 07:20 pm, Anthony Toft scribbled:
{Quote hidden}

2005\06\04@014812 by Dmitriy Kiryashov

picon face
Better idea.

If you have unknown resistance you need to measure
use controlled current source.

In case if resistance is grounded controlled
current source will source current in it
in the range from zero to some max value.

If resistance is attached to +12v as in your case
controlled current source will sink current
from it in the range from zero to some max value.

First you apply zero current and measure average
( filter it to cancel the noise ) voltage.
Then you apply some other currents and measure
average voltage. The difference in voltage
divided by current will give you the resistance.

Just curious what vehicle you working on ? :)


WBR Dmitry.



Anthony Toft wrote:
{Quote hidden}

> -

2005\06\04@083708 by Anthony Toft

flavicon
face
> If resistance is attached to +12v as in your case
> controlled current source will sink current
> from it in the range from zero to some max value.

The problem is that it is nominally 12v, engine off other electric
(lights etc) off, it's in the region of 11.9v, engine on electrics off
13.4v engine and most other stuff on, it drops into the 10.5 area. Hence
the idea of measuring the difference to the +v.

> ( filter it to cancel the noise ) voltage.

I thought a differential filter _should_ filter the noise as it is
common (although I need to check this)

> Just curious what vehicle you working on ? :)

1995 Pontiac Grand Prix GT
--
Anthony Toft <toftatspamKILLspamcowshed.us>
    I'm Anton, and I approve this message

2005\06\04@175703 by Dwayne Reid

flavicon
face
At 06:20 PM 6/3/2005, Anthony Toft wrote:
>My car mp3 project has hit a bit of a snag...
>
>The steering wheel controls use various values of resistor, connected to
>the (nominally) 12v line. My original plan was to use a voltage divider
>and some protection diodes and consume the signal directly into AN0 on
>the 16F876A I am using. Little did I know how noisy the signal really
>is, and the fact that the voltage varies so much between "engine on" and
>"engine off" so much in fact that the controls had no hope of working in
>the other state.

Use a current source fed from your 12V source.  The various buttons set the
current value.

The PIC end has a load resistor (connected to ground) feeding a RC filter
feeding your a/d input.  Pick values of current that are easily differentiated.

The current source can be as simple as a LM317L if you can tolerate
relatively high currents (up to 10mA).  You'll probably have to do the
voltage reference / op-amp type current source if you want to stay with low
currents (LM285-1.2 reference feeding TL071 op-amp).  A TL071 is good here
because the inputs include Vdd within the common mode range.

Me - I'd probably use the LM317L.  +12V to Vin, Iset resistor string
between Vout & Adj, output is from Adj pin.  Pick currents above 2mA so as
to be way above the Iq of the regulator.  5V / 10mA gives you a 500R load
resistor - use 470R.  2mA into 470R gives you 0.94V.  10mA into 470R gives
you 4.7V.  Choose the in-between currents to make it easy for you to test
with simple bit tests.

The Iset resistors should be all in series.  One side of all the switches
is tied to one end of the resistor string; the other side of each switch
goes to one of the midpoints in the string.  Doing it that way means that
there are no in-between values - the switch that shorts out the most number
of resistors has priority.

Hope this makes sense.  One of those cases where a simple picture is much
easier to understand.  But - no time for that right now - sorry.

dwayne

--
Dwayne Reid   <.....dwaynerKILLspamspam.....planet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 21 years of Engineering Innovation (1984 - 2005)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

2005\06\04@200433 by Anthony Toft

flavicon
face
Unfortunately the buttons are factory fit and I don't want to change
them (at some point I will put the old radio in to sell the car) so I am
stuck with ~12v on one side of a fixed (and not by me) resistor.

I really think that a differential amplifier (difference between ~12v
and the switch output) is the way to go using negative gain as necessary
as the noise will get cancelled out (I hope) and the buttons will work
regardless of what the ~12v actually is. That coupled with the fact I
have the op-amp and resistors in the box makes it pretty attractive.

What I really ought to do is take the existing radio apart and see how
they did it, but that's probably easier said than done...

On Sat, 2005-06-04 at 17:57, Dwayne Reid wrote:
{Quote hidden}

--
Anthony Toft <toftatspamspam_OUTcowshed.us>
    I'm Anton, and I approve this message

2005\06\04@202836 by Bob Ammerman

picon face
What you want to do is use 'ratiometric' acquisition.

Set your A/D Vref to the +12V signal divided down through a voltage divider.

Now, as the nominal +12V signal goes up and down, so does the reference to
the converter.

Bob Ammerman
RAm Systems

{Original Message removed}

2005\06\05@100457 by olin piclist

face picon face
Anthony Toft wrote:
> Unfortunately the buttons are factory fit and I don't want to change
> them (at some point I will put the old radio in to sell the car) so I
> am
> stuck with ~12v on one side of a fixed (and not by me) resistor.
>
> I really think that a differential amplifier (difference between ~12v
> and the switch output) is the way to go using negative gain as
> necessary
> as the noise will get cancelled out (I hope) and the buttons will work
> regardless of what the ~12v actually is. That coupled with the fact I
> have the op-amp and resistors in the box makes it pretty attractive.

I don't understand why this is so difficult.  Certainly the existing radio
used an *easy* method, else they would have designed it differently to be
$.02 cheaper.

If I understand you correctly, pushing the buttons changes the resistance of
some line to the 12V supply.  Put a resistor from that line to ground,
selected to that you get the maximum swing possible for the various button
states you need to detect.  This signal is now ratiometric to the 12V
supply.  This means that if you use the same 12V supply as a reference,
fluctuations in that supply will cancell out.  In other words, think of the
signal as being a % of supply rather than a fixed voltage.

To decode this signal with a PIC, you can derive the A/D reference voltage
from the 12V supply.  Make sure that it can't exceed the A/D reference input
limits over the normal operating range, and that nasty spikes are clipped.
An alternative is to divide the supply down to the PIC A/D range and do a
divide in the firmware to use it as a reference.

You need to make sure that both paths are filtered about the same way, else
you will get erroneous readings whenever the supply voltage is changing.  Of
course you need to allow sufficiently fast reaction time so that the user
doesn't notice a delay.  My general rule of thumb is that humans don't
notice 50mS delay on pushbuttons.  I often use that as a debounce time.
Your filters will need to be faster so that you can detect the signal within
a window for long enough to know its stable and not just slewing between
other states.  I suggest maybe a two pole filter on each signal that has a
90% step response time of about 20mS.  That means your firmware can require
the signal to be within 10% of each target for 20mS or so before considering
it a valid new state.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

2005\06\05@122452 by Gerhard Fiedler

picon face
Anthony Toft wrote:

> Unfortunately the buttons are factory fit and I don't want to change
> them (at some point I will put the old radio in to sell the car) so I am
> stuck with ~12v on one side of a fixed (and not by me) resistor.
>
> I really think that a differential amplifier (difference between ~12v
> and the switch output) is the way to go using negative gain as necessary
> as the noise will get cancelled out (I hope) and the buttons will work
> regardless of what the ~12v actually is.

Like others have already said, what you need here is not a /difference/ (as
a differential amp provides) but a /ratio/ (as an ADC with the reference
being a fraction of the battery supply provides).

Calculate the output of the ADC (as a function of the switch resistor and
the battery voltage) in either case and you'll see that the approach
suggested by Bob and Neil eliminates the battery voltage as output
dependency. A differential amplifier won't do that.

Gerhard

2005\06\06@101707 by Toftat

flavicon
face
> If I understand you correctly, pushing the buttons changes the
> resistance of some line to the 12V supply.  Put a resistor from that
> line to ground, selected to that you get the maximum swing possible for
> the various button states you need to detect.  This signal is now

Yes, and this is what I have done, the "to ground" resistance is the one
that will swing as close as possible to 5 volts. Originally I had thought
to measure the voltage directly using the PIC supply as the references and
it didn't work at all well (massivly varying readings).
> ratiometric to the 12V supply.  This means that if you use the same 12V
> supply as a reference, fluctuations in that supply will cancell out.

Will this cancel out the fluctuations caused by the noise? Which I think
is my main problem...
> To decode this signal with a PIC, you can derive the A/D reference
> voltage from the 12V supply.  Make sure that it can't exceed the A/D
> reference input limits over the normal operating range, and that nasty
> spikes are clipped. An alternative is to divide the supply down to the
> PIC A/D range and do a divide in the firmware to use it as a reference.
>
> You need to make sure that both paths are filtered about the same way,
> else you will get erroneous readings whenever the supply voltage is

I have set these up with almost the exact same components and I will hook
this to Vref+ I will attach Vref- to ground. As an aside on the drive to
work this morning, my DVM measured 4.1v on the DC setting and 8.4v on the
AC setting.
> and not just slewing between other states.  I suggest maybe a two pole
> filter on each signal that has a 90% step response time of about 20mS.

I will google on this, it went right over my head...

> That means your firmware can require the signal to be within 10% of
> each target for 20mS or so before considering it a valid new state.

I am hoping that I won't have to etch the board again, but if that's what
it takes to fix it so be it.

More... (looser matching)
- Last day of these posts
- In 2005 , 2006 only
- Today
- New search...