Maker Pro
Maker Pro

Clamp a floating input

Vegas2012

Sep 4, 2012
16
Joined
Sep 4, 2012
Messages
16
I was also thinking I should beef up my transistors as well. I am using 2N2219 with a collector current of 800ma - enough for the 30-40ma draw on the relays. I was thinking of going to a TO-220 package with a TIP 31 (for example) which is rated much higher : 3A collector current.
A bit of overkill, but enough of a safety margin. And they are just about as cheap.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
And they are just about as cheap.

And their gain is much lower.

For a 30 or 40 mA load, the transistor you have there already has plenty of margin.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Hi, sorry for the delay. Here's a simple suggestion.

attachment.php


The voltage on C1 represents the state of the LOW/DRL input. Whenever LOW/DRL is low (0V), C1 is discharged quickly through R1 and D1. Whenever LOW/DRL is high, C1 charges relatively slowly through R2. So while LOW/DRL is low, or has the 56 Hz square wave on it, C1 is kept mostly discharged.

Only when LOW/DRL is steadily high will C1 charge up significantly. This corresponds to the "low beam" state of the signal on the LOW/DRL (which is one of the inputs to the headlight assembly). In the other relevant state (daylight running lights or DRL), the LOW/DRL signal carries a 56 Hz rectangular wave alternating between 0V and automotive supply, with an average voltage around 8.2V, which keeps C1 nearly fully discharged.

The time constant of R2 and C1 is 0.1 seconds which means (with a few approximations) that the C1 voltage will reach 63% of the applied voltage (automotive V+) after 100 ms from the last instant when LOW/CRL is low (0V).

Therefore, in DRL mode, C1 will be kept mostly discharged, and in the LOW mode (LOW/DRL constantly high), C1 will reach around 8.7V in 100 ms from the last low state on MODE/DRL.

The voltage on C1 is fed through D2 to Q1 which operates as an emitter follower. Its emitter follows the voltage on C1 with a two-junction voltage drop (around 1.4V).

Current through Q1's collector-emitter path forces C2 to follow the emitter in an upwards direction, but when the C1 voltage is low, C2 holds its voltage and discharges slowly through VR1 and R3. This provides the hold-on delay, which forces the relay to stay energised for a short time after the end of the LOW condition.

VR1 and R3 in series provide the R part of the time constant for C2. VR1 and R3 also form a voltage divider with its output feeding Q2 gate. Q2 has a gate threshold of a few volts (not a very well controlled parameter in MOSFET manufacture) and will conduct and energise the relay while its gate is above this voltage.

When C2 is not being held charged by current from Q1's emitter, it discharges through VR1 and R3, and when its voltage drops low enough that Q2's gate goes below its threshold voltage, Q2 turns off and the relay drops out.

D3 protects Q2 from the "back EMF" generated by the relay coil when Q2 turns off and the relay's magnetic field collapses.

R4 protects the circuit against automotive power spikes and surges, and should be connected directly across the power (automotive +ve) and ground (chassis).

The circuit's operation is only well-defined with those three conditions on LOW/DRL: low, high, or alternating at 56 Hz with about 60% duty cycle. Other conditions could cause the circuit to behave in a poorly defined way. For example, a slower alternating signal on LOW/DRL could cause borderline behaviour and put Q2 into its linear region, where it would overheat and possibly be destroyed.

All the parts listed here are available from Digikey or Mouser. The relay type is not specified since you already have one in mind. Q2 is rated to switch 200 mA so the relay coil current must not be more than this.

I haven't drawn in the components for the HIGH beam circuit because I'm not sure how you want it to work. If you want the relay to switch on when the headlight is in high beam, the circuit needs a resistor (1k) and diode (e.g. 1N4001) in series, feeding C2 directly. Let me know if you want me to add this to the schematic.
 

Attachments

  • vegas2012.gif
    vegas2012.gif
    6.8 KB · Views: 320
Last edited:

Vegas2012

Sep 4, 2012
16
Joined
Sep 4, 2012
Messages
16
Hi Kris.
Thanks for your suggestion. It works perfectly on the bench :D
I will connect this to the rest of my circuit and see how everything goes in the vehicle.

The relay I am using is a SANYOU SRD-S-112D with a coil resistance of 400ohms
http://www.datasheetdir.com/SRD-S-112D-F+download
So the coil current will be approximately 35mA - this is within the 2N7000 FET

You mention a slower alternating signal could possibly cause some strain on the FET, should I be looking to beef up the FET in case lower frequencies may be experienced?
I have to assume higher frequencies won't cause a problem as the voltage on C1 would not reach a charge high enough to activate Q1, correct?
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Good! Yes, that relay sounds good. I like the brand name - close enough to Sanyo to be confusing, not close enough to get sued!

The statement about the FET is really just for thoroughness, and to warn you that the signal on LOW/DRL must always be as you described. I'm not suggesting a bigger FET.

Yes, higher frequencies won't cause a problem, for the reason you say.

I'm considering changing the circuit to avoid any possible problem due to different input signals. It will involve adding at least one more transistor. Is that cool with you?

And do you want the HIGH signal to operate the relay too
 

Vegas2012

Sep 4, 2012
16
Joined
Sep 4, 2012
Messages
16
Adding one more transistor isn't a problem.
Sanyou already exists and the relays are cheap hahah - I will leave it up to Sanyo to sue Sanyou. :D

I have already implemented the HIGH beam signal into the rest of my circuit (if that is what you were asking) and it works exactly as intended - by maintaining voltage to C2 portion of the schematic when switching from Low to High.

Cheers !
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
OK, here's an improved design. It adds a Schmitt trigger to ensure that the relay always turns on and off cleanly.

attachment.php


The first part operates as described before.

PNPs can cause confusion, as they are often shown upside down (i.e. with the emitter at the top). PNPs are the pin-for-pin match of NPNs with the polarities of all voltages, and the direction of all currents, reversed from positive to negative or vice versa. Just like NPNs, they respond to current into the base, though with this drawing convention, the current seems to flow "out of" the base of the PNP, which is right, but the PNP is still controlled by the base current, which is related to the voltage between the base and emitter. Just this time, the emitter is more positive. The base-emitter voltage and current, and collector-emitter current rules of behaviour apply to a PNP as an NPN; it's just that they have the opposite polarity (of voltages and currents).

Q2 is an emitter follower with the opposite polarity from Q1, driving R4 and R5 which operate as a voltage divider working from the positive rail to set Q3's base voltage. This is the input to the Schmitt trigger circuit.

Assuming C2 is discharged and Q2's emitter is near 0V, there will be plenty of bias from the R4/R5 voltage divider to turn Q3 ON. This pulls Q4's base voltage near its emitter voltage and forces Q4 OFF, turning the relay OFF.

As C2's voltage rises, a "rising trigger voltage" point will be reached where there will not be enough bias to keep Q3 turned ON. As Q3 turns OFF, current through R6 turns Q4 ON. This current causes a voltage drop across R7 and D4, which causes Q3's emitter voltage to drop. This means that Q3's emitter-base voltage drops, and this turns Q3 OFF even more. The result is a very quick transition to the opposite state, because of this positive feedback path.

The relay is now energised, and Q3's emitter voltage is about 0.7V below the positive supply. Q3's base voltage threshold is now lower, because its emitter voltage is lower. Therefore the voltage on Q2's emitter (from C2) has to go lower than the other trigger point before Q3 will begin to conduct.

When Q3 begins to conduct, it robs the base current from Q4 and Q4 starts to turn off. This reduces the current flow in R7 and D4, and therefore the voltage dropped across them. This in turn causes Q3's emitter voltage to rise, so Q3's emitter-base voltage increases. This positive feedback adds to the bias on Q3 that was caused by the falling voltage on Q2 emitter, and the circuit "snaps" into the opposite state, again due to the positive feedback.

So, Q3's base threshold voltage for conduction is relative to its emitter, and its emitter voltage changes depending on Q4's state. When Q4 is OFF and the relay is not energised, very little voltage is dropped across R7, so Q3's emitter voltage is near the positive rail. When Q4 is ON and the relay is energised, current through R7 and D4 cause Q3's emitter voltage to be about 0.7V less than the positive rail. The difference between the two voltages at Q3 emitter is the hysteresis, the voltage difference between the upwards-going and downwards-going trigger point voltages for the input (at Q3 base). I like this little two-transistor Schmitt trigger. Schmitt triggers are described in detail at http://en.wikipedia.org/wiki/Schmitt_trigger

In simulation I found the trigger voltages (measured at C2) were about +9V (rising, which turns the relay ON) and +7.5V (falling, which turns the relay OFF).

The specified transistors can carry 100 mA so the coil current should be limited to 100 mA absolute maximum. Any coil resistance over 150 ohms is fine. Again D5 protects Q4 against back EMF from the relay coil and R8 protects the circuit from spikes and surges.

BTW what is the best title for this schematic drawing?
 

Attachments

  • vegas2012.gif
    vegas2012.gif
    8.7 KB · Views: 281
Last edited:

Vegas2012

Sep 4, 2012
16
Joined
Sep 4, 2012
Messages
16
Hey KrisBlueNZ.

I implemented the use of transistors/charging capacitors as the solution to my comparator problem, as outlined in your first schematic. I didn't use your exact design because I had to modify a few things so that they would work properly with the rest of my circuit.
Bench testing showed everything worked fine and I just installed my circuit into the vehicle. So far, everything is doing exactly what it is supposed to do... now I just hope that any problems with the circuit will show up before I go out of town in 3 weeks ! I don't want to be on the highway in the middle of nowhere and my circuit fails :D

I have designed a bypass toggle switch on my circuit just for this reason... if my headlight circuit fails, all I have to do is flip a switch on the outside of my circuit enclosure and it bypasses power around my box directly to the headlights.

In your opinion, what is the main advantage of the second schematic you drew up?
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
The main advantage of my second design is robustness, because it doesn't use any ICs, which can be damaged fairly easily by large spikes on the positive power supply rail. As long as you have good clamping on your supply, your op-amp should be safe.

I also did a simulation of it, that shows how it works, which I can upload if you like.

The circuit you're using has C1 and C2 with the emitter follower in between, then the C2 voltage goes into the op-amp, is that right?
 

Vegas2012

Sep 4, 2012
16
Joined
Sep 4, 2012
Messages
16
Sorry for the late reply... working late.

I am no longer using an op amp in the circuit that is in the vehicle at this time, as I initially outlined at the beginning of this thread. I implemented some of the electronics you forwarded in your first draft.

I have already implemented the changes to my initial circuit and installed it in the vehicle as a 'beta' test... I guess I jumped the gun after the first schematic you posted and after successful bench testing, I decided to put it through its paces right away.

So far so good. No operational problems with the circuit change and this is why I asked about your second revision. I can always pull the circuit from the vehicle and revise it to implement portions of your Schmidt Trigger modification (Ver. 2), however the changes made to date seem to be holding up at this time.

I appreciate your help !!
If I experience any problems in the near future, I will definitely pull the circuit and experiment with Ver. 2, but I am confident that the initial changes will do the trick :D
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
So you're using a BS170 to drive the relay, are you? It has a gate threshold voltage of a few volts, and no hysteresis. That's fine. As long as your DRL/LOW signal doesn't do anything different from what you described, you shouldn't have to worry.

Good luck :)
 
Top