Easiest way to make a current threshold switch?

L

LPEL88

Jan 1, 1970
0
I have a device which detects when the vehicle brakes are applied and does
some various data gathering with a microcontroller.

The detection is done by putting a tap connector on the power wire to the
brake light. The problem I am having is that I am getting 'false senses'.
The circuit between the wire and the microcontroller is through a resistor,
then through a reverse biased zener (about 6V), then I have a resistor
pulling to ground, and a cap to ground and I'm using an NPN to switch the
pin on the microcontroller to ground. This works flawlessly on 99% of
vehicles.

Problem is very very very occasionally I get false signals. It happens
always on about 1 in 100 vehicles, but never on the other 99. Unfortunately
I do not have access to the vehicles first hand to do any testing, but some
folks are seeing 10-12 volts on the power line going to their brake light
EVEN when the brake is not applied! The brake light does NOT illuminate.
Bear in mind my the circuit is NOT connected during testing.

The only thing I can think is there is a voltage on the line, but at a very
low current which is not enough current to illuminate the brake light, but
enough to cause my circuit to see a brake signal. I have confirmed that
when my circuit is connected, the transistor switches and my microcontroller
reads it as "brake applied", but when the wire is plugged back into the tail
light, it does not happen. This seems to me to be a very low current (not
enough to light the bulb) on the line with enough voltage to trip my input.

Maybe I'm thinking about this too much and missing the forest for the
trees - but does anyone have any ideas? I can't for the life of me figure
out why a brake line would have 11 or so volts on it when the brake is not
applied. When the user applies the brakes, the voltage goes from 11.2 or so
up to 12.4 or so. Considereing 1 out of 100 have this problem, my first
thought is a problem with the vehicle, but the brake lights work great, just
my MCU is getting a false signal. Can anyone suggest anything that may
help? I'm wondering if I should have some current threshold and if so, what
is the easiest and best way to achieve that?

Any insight is appreciated - either on how to solve the problem or what
might be causing it in the first place!

Thanks,
LP
 
D

Dana Raymond

Jan 1, 1970
0
LP... It appears to me that you have two problems going at the same time,
and thats perhaps why things are confusing.

1st: It is possible that your sense circuit is too sensitive to electrical
noise injected into the brake light wire. Vehicles are one of the harshest
environments to design for, and that includes electrical noise. Please post
the values of the resistors, cap, zener, and transistor used. I noticed you
didn't mention a pullup resistor on the collector of the transistor. If you
are relying on a "weak' pin pullup on the micro, then the very low pulldown
current required may make the transistor too sensitive.

2nd: If what we have is a 12V battery wired to a switch in series with a
lightbulb, then the measurements you are reporting are probably incorrect. I
just wouldn't trust them. Right?

Lets see the values for the input circuit. I have done this myself on an
automotive commercial product with success. However, I didn't use a
transistor since no gain was required in the input circuit.

Dana Frank Raymond
 
H

happyhobit

Jan 1, 1970
0
Hi LP,
Does your microcontroller program require a minimum pulse width?

Jay
 
F

Fred Bloggs

Jan 1, 1970
0
LPEL88 said:
I have a device which detects when the vehicle brakes are applied and does
some various data gathering with a microcontroller.

The detection is done by putting a tap connector on the power wire to the
brake light. The problem I am having is that I am getting 'false senses'.
The circuit between the wire and the microcontroller is through a resistor,
then through a reverse biased zener (about 6V), then I have a resistor
pulling to ground, and a cap to ground and I'm using an NPN to switch the
pin on the microcontroller to ground. This works flawlessly on 99% of
vehicles.

Problem is very very very occasionally I get false signals. It happens
always on about 1 in 100 vehicles, but never on the other 99. Unfortunately
I do not have access to the vehicles first hand to do any testing, but some
folks are seeing 10-12 volts on the power line going to their brake light
EVEN when the brake is not applied! The brake light does NOT illuminate.
Bear in mind my the circuit is NOT connected during testing.

The only thing I can think is there is a voltage on the line, but at a very
low current which is not enough current to illuminate the brake light, but
enough to cause my circuit to see a brake signal. I have confirmed that
when my circuit is connected, the transistor switches and my microcontroller
reads it as "brake applied", but when the wire is plugged back into the tail
light, it does not happen. This seems to me to be a very low current (not
enough to light the bulb) on the line with enough voltage to trip my input.

Maybe I'm thinking about this too much and missing the forest for the
trees - but does anyone have any ideas? I can't for the life of me figure
out why a brake line would have 11 or so volts on it when the brake is not
applied. When the user applies the brakes, the voltage goes from 11.2 or so
up to 12.4 or so. Considereing 1 out of 100 have this problem, my first
thought is a problem with the vehicle, but the brake lights work great, just
my MCU is getting a false signal. Can anyone suggest anything that may
help? I'm wondering if I should have some current threshold and if so, what
is the easiest and best way to achieve that?

Any insight is appreciated - either on how to solve the problem or what
might be causing it in the first place!

Thanks,
LP

Right- those uncooperative vehicles may be running some kind of bulb
continuity testing. The fact that the bulb does not light means the bulb
return line is at above chassis ground voltage too, or the testing is a
very brief pulse that is not visible. Your device has a chance of
working if you time qualify the pulse detection to say 0.1 seconds or
more- that is, don't read it as brake applied for anything of lesser
duration. If the bulb return is being switched then you will need to
convert to a differential voltage sense and use 2x taps. Another
possibility is that rocket scientist in Detroit has some oddball wiring
that transiently puts 12V on the bulb consequent to some unrelated
switching, the pulse duration qualification will eliminate that false
alarm too.
 
J

Jim Thompson

Jan 1, 1970
0
[snip]

Are you aware that *many* automotive lights have "hot" always applied
and the switch is to *ground*?

...Jim Thompson
 
I

Ian Stirling

Jan 1, 1970
0
Jim Thompson said:
[snip]

Are you aware that *many* automotive lights have "hot" always applied
and the switch is to *ground*?

But "when the switch is applied, it goes to 12.4V", or something.
Odd.
 
I

Ian Stirling

Jan 1, 1970
0
Jim Thompson said:
Jim Thompson said:
On Tue, 16 Sep 2003 17:15:52 +0000 (UTC), Ian Stirling

I have a device which detects when the vehicle brakes are applied and does
some various data gathering with a microcontroller.
<snip>
Problem is very very very occasionally I get false signals. It happens
always on about 1 in 100 vehicles, but never on the other 99. Unfortunately
I do not have access to the vehicles first hand to do any testing, but some
folks are seeing 10-12 volts on the power line going to their brake light
EVEN when the brake is not applied! The brake light does NOT illuminate.
Bear in mind my the circuit is NOT connected during testing.

[snip]

Are you aware that *many* automotive lights have "hot" always applied
and the switch is to *ground*?

But "when the switch is applied, it goes to 12.4V", or something.
Odd.

/
+12V <----(&)-----o ^----> GND

Power Lamp Switch Ground

Where are you looking?

At the OPs post.
 
J

Jim Thompson

Jan 1, 1970
0
Jim Thompson said:
On Tue, 16 Sep 2003 17:15:52 +0000 (UTC), Ian Stirling

I have a device which detects when the vehicle brakes are applied and does
some various data gathering with a microcontroller.
<snip>
Problem is very very very occasionally I get false signals. It happens
always on about 1 in 100 vehicles, but never on the other 99. Unfortunately
I do not have access to the vehicles first hand to do any testing, but some
folks are seeing 10-12 volts on the power line going to their brake light
EVEN when the brake is not applied! The brake light does NOT illuminate.
Bear in mind my the circuit is NOT connected during testing.

[snip]

Are you aware that *many* automotive lights have "hot" always applied
and the switch is to *ground*?

But "when the switch is applied, it goes to 12.4V", or something.
Odd.

/
+12V <----(&)-----o ^----> GND

Power Lamp Switch Ground

Where are you looking?

At the OPs post.

My neurons suddenly activated... the "odd" vehicles probably have lamp
burn-out sensors that trickle some current through the bulb all the
time.

My Q45 is so sensitive it shows fault if I try to replace a #1157 with
a #1141 (same base, different operating current).

...Jim Thompson
 
J

Jim Thompson

Jan 1, 1970
0
Doesn't work.
If the voltage goes up when the bulb is turned on, and it starts
at 10-12V, then it can't be an incandescant bulb.

Sure it can... if the bulb is fed via a resistor, then the resistor is
shorted out by the switch.

...Jim Thompson
 
I

Ian Stirling

Jan 1, 1970
0
Jim Thompson said:
Sure it can... if the bulb is fed via a resistor, then the resistor is
shorted out by the switch.

Well, yes, it could of course, but in that case the bulb wouldn't ever
go fully out, just dim a bit.

--
http://inquisitor.i.am/ | mailto:[email protected] | Ian Stirling.
---------------------------+-------------------------+--------------------------
"I meant, have you ploughed the ocean waves at all?" Colon gave him a cunning
look. 'Ah, you can't catch me with that one, sir' he said 'Everyone knows
horses sink' -- Terry Pratchett - Jingo
 
Top