Author Topic: Adding a horn on a delay: where to begin?  (Read 7966 times)

0 Members and 1 Guest are viewing this topic.

Offline vmalletTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: us
Adding a horn on a delay: where to begin?
« on: March 28, 2019, 06:15:09 am »
TLDR: I'd like to add a 2nd horn to my car with a (configurable) 500ms delay; I'm just starting to learn about electronics and would like to see how folks would go about implementing something like this.

I have a car with a crappy old horn and a new air horn ready to be installed. Because I have just started learning electronics (with online courses starting with the basics of resistors, capacitors, etc) (i'm a software guy by trade), I figured it'd be nice to do something that would teach me something along the way.

I'd like to hook up the new horn as a "supplemental" horn that would trigger only after a "configurable" delay, say 500ms. So on just a tap of the horn, only the old one would go; but press longer and after 500ms the new one would kick in too. Ideally, I'd like to have a 4-way switch so the new horn can be: OFF, 0ms-delay, 250ms-delay, 500ms-delay (or something).

My newbie intuition would be to have some sort of small MCU that would be able to take in input the "delay" configuration switch, and the horn on/off action; have some basic logic in there to decide whether or not to drive the air horn; and then some way to switch the air horn on/off as an output. Easier said than done for me; there's plenty of voltage concerns I'm not too sure about. If I were to tap into the 12v line to the existing horn, how do I translate that to the 5v input of the MCU? Or, what's the right way to drive a 10A 12V current for the air horn with the MCU's 5v-low-current output? mosfet? relay? both?

I'm hoping that with a few suggestions I'll be able to go dig and learn about some areas and eventually come up with some design that could make this happen. Right now it's just very nebulous :)

Thanks for your ideas!


 

Offline RobertHolcombe

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: au
Re: Adding a horn on a delay: where to begin?
« Reply #1 on: March 28, 2019, 06:28:19 am »
Using only discrete components may be more useful as a beginner in learning the basics

https://www.electronicshub.org/time-delay-relay-circuit/
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13216
Re: Adding a horn on a delay: where to begin?
« Reply #2 on: March 28, 2019, 07:05:55 am »
While I agree with
Using only discrete components may be more useful as a beginner in learning the basics
and its necessary to have that understanding of the basics to successfully interface a MCU with automotive systems, it helps if you provide a link to a well designed circuit to start with.

The circuit linked has no hysteresis, so relies on the magneto-mechanical hysteresis of the relay mechanism to provide snap action contact operation.  Unfortunately, the relay will be critically underpowered at the moment of contact closure, which, depending on the exact relay mechanism design, may cause excessive contact bounce, and due to the high load current, this may result in contact damage, possibly even contact welding.

Also, with a 3.3V Zener in the base circuit, at least 20% of the potentiometer adjustment range will produce an infinite delay, and the relationship between  potentiometer position and time delay will be highly non-linear.

The circuit description is also somewhat lacking.  It doesn't mention that the TIP122 is actually a Darlington pair, nor explain how the capacitor at the transistor base performs its alleged function of preventing "relay clicking".
« Last Edit: March 28, 2019, 07:44:28 am by Ian.M »
 

Online AndyC_772

  • Super Contributor
  • ***
  • Posts: 4315
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Adding a horn on a delay: where to begin?
« Reply #3 on: March 28, 2019, 07:10:04 am »
I'd argue that the 'basics' these days do involve using a microcontroller for this kind of thing.

Many years ago, it used to be the case that the sensible, appropriate way to perform simple timing and logic functions was to use 74 series logic, the classic 555 timer, and similar components.

Nowadays, though, that's no longer true. A PIC12F is the same size as a 555 timer but is way more flexible, capable, and easier to make changes to.

That said, in this particular application, the power supply you have available is 12V plus a lot of noise and spikes, so it may be simpler to come up with a discrete design that can run off that supply directly, rather than adding protection and a voltage regulator to produce a sufficiently clean 5V (or 3.3V, or whatever) to run a microcontroller. The final design will probably end up with similar complexity whichever route you go down.

Why not try both approaches, and see which you prefer? I guarantee you'll learn a lot of useful things either way.

For switching a simple load on/off in an automotive environment, I'd use a relay.

Offline emece67

  • Frequent Contributor
  • **
  • !
  • Posts: 614
  • Country: 00
Re: Adding a horn on a delay: where to begin?
« Reply #4 on: March 28, 2019, 09:50:44 am »
.
« Last Edit: August 19, 2022, 05:52:58 pm by emece67 »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13216
Re: Adding a horn on a delay: where to begin?
« Reply #5 on: March 28, 2019, 11:18:48 am »
Its always nice to see a circuit that's been tested in practice for several years in a similar application.

However, sticking with the idea of building the delay from discretes, here's a two transistor discrete Schmitt power-on delay circuit.  Q1 can be any jellybean PNP with gain>100.  Q2 needs to be a high gain NPN and beefy enough to drive the relay coil - a power Darlington may be required.



How it works:  Q1 acts as a comparator, with a threshold of approx 7V less than the supply voltage (nominally 14V for 12V car with engine running) set by the Zener D2.  It has input from the RC timing circuit R1,C1 via R2 and positive feedback via R4 to provide hysteresis (to get clean 'snap action' switching).   The hysteresis is set by the ratio of R2 to R4.

LTspice sim attached.

Edit:  For anyone who cant run the sim, I set R1 {rt} to sweep between 10K and 110K in 20K steps, to simuate a 100K pot or preset with a 10K series resistor.  It gave a delay varying fairly linearly between 75ms at 10K and 885ms at 110K.  At the low resistance end the slope was about 8ms/Kohm and at the high resistance end about 8.5ms/Kohm.
« Last Edit: March 29, 2019, 09:07:59 am by Ian.M »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20357
  • Country: gb
  • 0999
Re: Adding a horn on a delay: where to begin?
« Reply #6 on: March 28, 2019, 11:47:57 am »
What the heck is going on with that LM311 symbol with the output transistor drawn upside down?

The original poster is more familiar with software, so it's understandable they'll be more comfortable using a micro-controller, which I think is a good solution.

There's still plenty of electronics involved:

1) Powering the MCU off the 12V supply, providing sufficient overvoltage protection.

2) Using the MCU to control the second horn.

3) Interfacing the MCU with the existing horn switch.

Here is an example of a power supply for running a 5V MCU from a 12V automotive system.


The microcontroller can drive the second horn using a logic level MOSFET, such as the old IRL540.

A potential divider can be used to connect the MCU input to the horn switch.
 

Offline vmalletTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: us
Re: Adding a horn on a delay: where to begin?
« Reply #7 on: March 29, 2019, 12:53:55 am »
This is awesome, thanks for the input!

I am going to experiment with both the discrete and the MCU routes, looks like there is plenty to learn either way. I already have more questions looking at the schematics in the thread but I am going to try to do a bit of homework first to see what I can understand on my own.

Re: the "noisy and junky" 12v supply from the car: how would one go about "seeing" or "measuring" the noise? (Or maybe that should be a new thread on its own?).
 

Online AndyC_772

  • Super Contributor
  • ***
  • Posts: 4315
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Adding a horn on a delay: where to begin?
« Reply #8 on: March 29, 2019, 07:58:47 am »
It's actually quite difficult to measure the characteristics of a vehicle supply in a way which is truly accurate and representative.

You can start by just connecting a multimeter across any convenient 12V supply in the car. You'll see a nice, steady 12.5V or thereabouts if the battery is in good condition. The voltage will be a bit higher if it's been driven recently.

Start the engine and it'll rise to somewhere near 14V. The exact voltage will vary with engine speed, and you'll see that on the meter.

The voltage will reduce when you turn on accessories like headlamps or electric window motors, and rise again when you turn them off again. Try it!

It'll dip considerably during starting. Some devices detect this and intentionally turn off, in order to reduce the load on the vehicle's electrical supply when all the available current is needed to start the engine. Others - like, say, the engine management computer - must keep working reliably during this time, so they're designed accordingly.

If you have one, a meter with data logging capability can be very revealing. I learned a lot by strapping a Fluke 289 to my motorbike, connecting it across the battery, and going for a ride.

There's noise at much higher frequencies than you'll see with any multimeter, though. On a petrol engine, the ignition system produces very short duration pulses which an oscilloscope can pick up, but it's surprisingly difficult to measure them accurately because the system also produces radio interference that the scope probe leads pick up.

Accurate probing in a noisy environment is a huge topic in its own right, but I do have a tip: any time you suspect the scope might be showing noise on a signal that's not really there, move the probe tip so you're measuring the exact point at which the probe ground is attached. In theory you should, of course, see exactly 0V - but you won't. Whatever you do see, subtract it from whatever you measure at the point you're really interested in.

Offline vmalletTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: us
Re: Adding a horn on a delay: where to begin?
« Reply #9 on: April 02, 2019, 06:46:49 am »
I received some components today and started playing around with the 5V power supply.

@Zero999 a few questions for you...
Here is an example of a power supply for running a 5V MCU from a 12V automotive system.


  • What is D1 used for, some sort reverse polarity protection?
  • D1: I'm using a 1N4001; is that ok?
  • What is R1 used for? Some form of current limiting? Why?
  • What is D2 here for? Shunts the current in case V1 gets too high (> 15V) to protect the regulator?
  • D2: I couldn't find BZX84C15L so I used BZX55C15 R0; it looked similar enough but I'm not sure what the differences really are, it's hard for me to tell at the moment what's important and what's not in a data sheet..
  • C1/C2: do they need to be of a specific type? I used MLCCs for both but the two symbols on the schematic are different, not sure if I should read something through that

Here's a picture of my experimental power supply:


The "black" resistor resting (in peace) on top of the breadboard is the first 22R resistor I used; the cloud of smoke it produced when I ramped the input towards 12V helped me realized I had put the Zener backwards :) 1/4W is not going to deal very well with a few W of power, one more lesson learned!

Thanks!
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20357
  • Country: gb
  • 0999
Re: Adding a horn on a delay: where to begin?
« Reply #10 on: April 02, 2019, 08:52:34 am »
  • What is D1 used for, some sort reverse polarity protection?
  • D1: I'm using a 1N4001; is that ok?
  • What is R1 used for? Some form of current limiting? Why?
  • What is D2 here for? Shunts the current in case V1 gets too high (> 15V) to protect the regulator?
  • D2: I couldn't find BZX84C15L so I used BZX55C15 R0; it looked similar enough but I'm not sure what the differences really are, it's hard for me to tell at the moment what's important and what's not in a data sheet..
  • C1/C2: do they need to be of a specific type? I used MLCCs for both but the two symbols on the schematic are different, not sure if I should read something through that
  • Yes.
  • Yes.
  • When the zener conducts, the resistor will limit the current to a safe level.
  • Yes, high voltage spikes are common in automotive systems, so over-voltage protection is necessary.
  • That's a better choice: the higher the power rating, the better.
  • They're decoupling capacitors. The symbol for C1 is polarised and C2 non-polarised. It's fine to used non-polarised for both. Be careful with MLCCs, they often have a much lower capacitance, when the voltage is near the rated value. This circuit will still work with lower capacitance values. Indeed, you'll probably find it works with no capacitors, but it just won't work very well and you may have problems with the power supply voltage dropping, causing the microcontroller to crash and reboot randomly.

Quote
The "black" resistor resting (in peace) on top of the breadboard is the first 22R resistor I used; the cloud of smoke it produced when I ramped the input towards 12V helped me realized I had put the Zener backwards :) 1/4W is not going to deal very well with a few W of power, one more lesson learned!
I'm sure that sort of thing has happened to most people who build circuits at some stage.

I notice you appear to be using the LM7805, which is fine, but bear in mind it's rated to 1A and often doesn't current limit until 2.2A, so if there's a short circuit, R1 will get hot. Using a higher wattage resistor >0.5W or lower current regulator, such as the LM78L05, which will limit the current to  <220mA, will prevent this. I meant to write LM78L05 on the schematic: LM7805L was a typo.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17427
  • Country: us
  • DavidH
Re: Adding a horn on a delay: where to begin?
« Reply #11 on: April 02, 2019, 09:58:49 am »
The easiest way will be a 12 volt time-delay relay.  Building your own circuit includes building it for an automotive environment.

 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20357
  • Country: gb
  • 0999
Re: Adding a horn on a delay: where to begin?
« Reply #12 on: April 02, 2019, 12:04:57 pm »
The easiest way will be a 12 volt time-delay relay.  Building your own circuit includes building it for an automotive environment.
Yes, that will work, but I thought this was just as much for educational purposes, as anything else.
https://www.littelfuse.com/~/media/protection-relays/catalogs/littelfuse_protectionrelays_time_delay_relays_catalog_section.pdf
« Last Edit: April 02, 2019, 02:07:32 pm by Zero999 »
 

Online Kasper

  • Frequent Contributor
  • **
  • Posts: 793
  • Country: ca
Re: Adding a horn on a delay: where to begin?
« Reply #13 on: April 02, 2019, 03:28:57 pm »
To adjust the delay, you might find something you like on digikey in this category:
"Potentiometers, Variable Resistors"

Create a voltage divider with a resistor and a variable resistor and the variable output voltage can be used in discrete circuit or MCU circuit to set the delay time.
 

Offline vmalletTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: us
Re: Adding a horn on a delay: where to begin?
« Reply #14 on: April 02, 2019, 05:32:51 pm »
The goal is definitely to learn plenty along the way and so far it's been very helpful. The fancy relays from littlefuse.com are quite awesome though, it would make it ultra easy if the only thing I cared about was really just a delayed on/off. Epic!
 

Offline vmalletTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: us
Re: Adding a horn on a delay: where to begin?
« Reply #15 on: April 02, 2019, 06:11:53 pm »
When the zener conducts, the resistor will limit the current to a safe level.

Ok cool. Now, would putting R1 in series with the zener (either before or after) instead of upstream of the whole thing make sense if its only purpose was to limit the over-voltage current?
In the case of over-voltage, how do you size R1 (in terms of power ratings)? Would I have P = (Vsource - Vzener(15V)) ^ 2  /  22R ? Can we expect that over-voltage will always be spiky in nature and not a sustained high voltage and use that as part of the sizing?

With R1 being where it is, it also limits current going into the regulator. When the load starts drawing more current, the voltage drop over R1 is going to increase; wouldn't that be a problem where eventually R1 will drop enough voltage that the input to the regulator will be too low?

Quote
They're decoupling capacitors. The symbol for C1 is polarised and C2 non-polarised. It's fine to used non-polarised for both. Be careful with MLCCs, they often have a much lower capacitance, when the voltage is near the rated value. This circuit will still work with lower capacitance values. Indeed, you'll probably find it works with no capacitors, but it just won't work very well and you may have problems with the power supply voltage dropping, causing the microcontroller to crash and reboot randomly.

Ah I see. My 10uF is a 10V cap so clearly too small from a voltage point of view; the .1uF is 50V; and now I see why the .1uF is bigger physically than the 10uF when I would have expected the difference to be the other way.

I have a 15uF 50V electrolytic at hand, would that be a good replacement for the 10uF? (I don't think I have understood how to size coupling capacitors yet, I'll get there..)

Quote
I notice you appear to be using the LM7805, which is fine, but bear in mind it's rated to 1A and often doesn't current limit until 2.2A, so if there's a short circuit, R1 will get hot. Using a higher wattage resistor >0.5W or lower current regulator, such as the LM78L05, which will limit the current to  <220mA, will prevent this. I meant to write LM78L05 on the schematic: LM7805L was a typo.

Ah-ha! I see, yes I couldn't find the LM7805L and "5V voltage regulator" sounded like a right description when I found the LM7805. If I needed more current (for example to drive LED strips to bling the car out -- just kidding) then LM7805 would work but I'd have to be careful with R1 (re: power and voltage drop question from above); otherwise I should get a LM78L05 and be in a safer zone.

Last question around the power supply: I was thinking of using a mini arduino 5V board that I had around (see pic). Overkill but it's all in the name of learning :) This thing has its own 5V voltage regulator (supposedly a microchip mic5205) and can be fed via its regulator, or past the regulator if the source is already regulated. In my case, should I bypass its regulator, or be double-safe and feed the output of the power supply to its regulator?



(arduino mini schematic: https://www.geeetech.com/Documents/Arduino%20Pro%20Mini%20Schematic.pdf)
(mic5205 regulator datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/20005785A.pdf)
 

Offline vmalletTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: us
Re: Adding a horn on a delay: where to begin?
« Reply #16 on: April 02, 2019, 09:13:35 pm »
However, sticking with the idea of building the delay from discretes, here's a two transistor discrete Schmitt power-on delay circuit.

I'm trying to wrap my head around this one but it is very nebulous at the moment. I tried to put it together on a breadboard and I realized I don't understand where to even inject the source voltage. Ground is easy, but where does my + go? Is it where C1/D1/D2/L1 all join? But if so, this is also where "out" is coming from. So when power comes up, why would the load (connected directly between power and ground) care about the rest of the circuit?

As a side note I tried loading the circuit in LTSpice and running it (after bridging the switch it doesn't know about with a wire) but I can't say I saw anything meaningful on the little graph window that shows up. I'm going to have to do a few LTSpice tutorials, so many things to learn!
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13216
Re: Adding a horn on a delay: where to begin?
« Reply #17 on: April 02, 2019, 10:22:01 pm »
I drew it up as a straight power-on delay.  The rail at the top is Acc (14V accessory power) from the ignition switch.   

The switch symbol is actually redefined as a behavioural resistor* (Ctrl-RightClick on a component to get to the dialog that lets you override what SPICE sees it as and modify hidden parmeters if permitted for that component type). I changed the prefix to R and the value to R=sw(I(L1)>30mA) and that (with the .func sw on the schematic) makes the switch act as relay contacts, ON if the current through L1 is over 30 mA.

However if you don't have the swSPST.asy symbol, LTspice looses all that when it opens the schematic, and one of the *MAJOR* problems with LTspice is keeping track of what symbols and models are standard and what are custom or 3rd party.   Probably the easiest fix would be to paste this:
Code: [Select]
Version 4
SymbolType CELL
LINE Normal -15 0 -33 0
LINE Normal 1 -15 -15 0
LINE Normal 15 0 0 0
LINE Normal 31 0 15 0
CIRCLE Normal 3 -13 -1 -17
CIRCLE Normal 2 2 -2 -2
PIN -32 0 NONE 8
PINATTR PinName 1
PINATTR SpiceOrder 1
PIN 32 0 NONE 8
PINATTR PinName 2
PINATTR SpiceOrder 2
into a text editor and save it as swSPST.asy in the same folder as you downloaded the  .asc file to then reopen the unmodified .asc file.

Alternatively simply delete the switch and load as its sufficient to plot the current through the relay coil.

When you run the sim the plot window comes up empty unless you have a saved .plt file.  With the plot window open, and no specific schematic drawing tools active,  click a node (connection) to plot a voltage and click a component to plot the current through it.    For components with more than two leads, you must click the lead to plot individual lead currents (where you see a 'clamp ammeter' cursor if you hover).  Finally, to plot a voltage difference drag from the node you want to plot to the node you want as reference.

I would suggest plotting the nodes vc and drv (or instead of drv, plot I(L1) ).  The sim runs five times with increasing {rt} so you will see five curves for the capacitor and five increasing delays for drv or I(L1), all on the same plot.  If you find that confusing comment out the .step param rt command.

To use it for real, connect it in parallel to the existing horn so it gets power when you press the horn button.  As the horn is a nasty inductive load, it will need a beefy diode in parallel, cathode positive to prevent the back-EMF spike killing the delay circuit when you let go of the horn button.  You'll   probably want to power the new horn off a spare fuse in the fusebox, off the switched accessory supply, via the delay circuit's relay contacts, so you don't overload the horn button. 

* see: http://ltwiki.org/?title=Undocumented_LTspice
« Last Edit: April 02, 2019, 10:43:56 pm by Ian.M »
 

Offline vmalletTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: us
Re: Adding a horn on a delay: where to begin?
« Reply #18 on: April 03, 2019, 12:10:09 am »
Ah-ha! Thanks, it makes so much more sense now :)

I would suggest plotting the nodes vc and drv (or instead of drv, plot I(L1) ).  The sim runs five times with increasing {rt} so you will see five curves for the capacitor and five increasing delays for drv or I(L1), all on the same plot.  If you find that confusing comment out the .step param rt command.

Yep, LTSpice is a lot happier with the additional file and I see the different startup delays now, nice.

I was super confused because I didn't understand L1 was representing the relay's coil and wasn't actually part of the circuit. It's all coming together :)

Thanks for all the basic info about LTSpice.

Quote
You'll   probably want to power the new horn off a spare fuse in the fusebox, off the switched accessory supply, via the delay circuit's relay contacts, so you don't overload the horn button. 

I was thinking of pulling power straight from the battery to the air compressor, like:  BAT+ --  fuse -- RELAY -- horn compressor -- BAT-
The delay circuit would be powered by the existing horn circuit like you mentioned, so that would be controlled by the existing on/off rules. Is going straight to the battery a bad idea? I guess I'm wondering if I would easily find an accessory circuit that would have enough current for the compressor (I'm assuming it's going to pull quite a few amps on 12V).

Regarding D1, why is it there? Is it to protect against back-EMF from the relay's coil? If I were to drive say an LED instead of a relay, would I need the diode? Is there harm in having it there regardless?

Thanks again!
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13216
Re: Adding a horn on a delay: where to begin?
« Reply #19 on: April 03, 2019, 02:29:50 am »
There shouldn't be any problem adding a 10A load to the fusebox, but you could go straight to the battery terminal with a fuse within 6" of the terminal itself.  i wouldn't want to add a 20A load at the fuse box, unless I was very sure there was enough spare capacity ie because there was an option model of my vehicle year that had such a load that my vehicle didn't have fitted,

An anti-parallel diode like D1 is standard practice when driving an inductive load.  it lets the load current recirculate when the transistor switches off and decay  to zero naturally, rather than generating a large back-EMF spike that is likely to kill the transistor.  Its not needed when driving plain LEDs, though its still a good idea to use a diode if there's a significant risk the load will be hooked up using very long wires as the loop inductance may be significant.
« Last Edit: April 03, 2019, 02:34:26 am by Ian.M »
 

Offline vmalletTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: us
Re: Adding a horn on a delay: where to begin?
« Reply #20 on: April 03, 2019, 06:22:46 am »
Thanks again Ian, very helpful.

One more question. In your original message you said:

It has input from the RC timing circuit R1,C1 via R2 and positive feedback via R4 to provide hysteresis (to get clean 'snap action' switching).   The hysteresis is set by the ratio of R2 to R4.

"The hysteresis is set by the ratio of R2 to R4". Do you mean "R2 to R1"? R4 is just there for the positive feedback and 'snap action', right?

Thanks

   Vince.


 

Offline vmalletTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: us
Re: Adding a horn on a delay: where to begin?
« Reply #21 on: April 03, 2019, 07:29:29 am »
Progress!

Picture: on the right side of the board I have emece67's design; on the left side I have Ian.M's discrete Schmitt design with a 100k R1 resistor. As expected, Ian's circuit brought the green LED on in close to a second, and emece67's circuit turned the red led on after ~14s.


Now on to some questions about emece67's design:

  • DI1/DI2 are reverse polarity protection just in case. Yes?
  • RZ/DZ/CZ are current limiting, over-voltage protection and decoupling. Yes?
  • RO is effectively a pull-up resistor that will bring the MO's gate high once the comparator turns on. Question though: why 10k? to limit the wasted current that will flow through it?
  • DO: what is this diode used for?
  • overall function: RT1/RT2 provide a reference voltage to the comparator. RC1/RC2 provide the target voltage that will eventually be much higher than RT1/RT2 and trigger the comparator to turn on and activate the mosfet. At first C is discharged and brings the RC1/RC2 voltage down, but as it charges it will slowly get to the target voltage, hence the delay. About right?
  • Now what's DC in here for?
  • In a circuit like this, how would you model C's charging time? Is it a standard RC circuit with C/RC1? or C/RC2? or C/(RC1/(RC1+RC2))? Or something else? :)

This project is teaching more than expected!
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13216
Re: Adding a horn on a delay: where to begin?
« Reply #22 on: April 03, 2019, 08:22:42 am »
"The hysteresis is set by the ratio of R2 to R4". Do you mean "R2 to R1"? R4 is just there for the positive feedback and 'snap action', right?

Thanks

   Vince.



Nope.  I meant what I said, although its an oversimplification.

Its easiest to see if you override Vc with a voltage source (- terminal grounded), with its value set to PWL(0 0 0.5 14 1 0) which sweeps from 0 to 14V in half a second then sweeps back down to 0.  The easiest way to do that is to use the copy tool to duplicate the source V1 (bottom left)complete with its label and ground, then edit the label of the copy V2 from Acc to vc and its value to the PWL expression above.

You can then plot Vc, drv and Ib(Q1)and explore the effects of changing the ratio of R2 to R4 yourself.     Consider the balance of currents through R2 and R4 when Ib(Q1) is zero, which is right next to the switching point, and what that must mean about the voltage across each resistor.   

Decreasing R3 to 1K will make the ref voltage steadier and the hysteresis effect easier to understand.

Nice to see you've got it working in real life on the breadboard. :)
 

Offline emece67

  • Frequent Contributor
  • **
  • !
  • Posts: 614
  • Country: 00
Re: Adding a horn on a delay: where to begin?
« Reply #23 on: April 04, 2019, 08:40:00 pm »
.
« Last Edit: August 19, 2022, 05:53:08 pm by emece67 »
 

Offline vmalletTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: us
Re: Adding a horn on a delay: where to begin?
« Reply #24 on: April 09, 2019, 12:05:18 am »
Thanks Ian.M and emece67 for your recent answers, every bit helps with the overall understanding :)

I am exploring the arduino route a bit further as I believe I will have other uses for that chip once it's in the car (maybe drive a volume knob for the head unit instead of those "+" "-" buttons).

I've downloaded KiCAD and tried to draw the schematic of what my design might look like. First time putting a circuit together (on my own), first time drawing a circuit, and first time doing so with an EDA software...


I would appreciate any comment on the design (form or content) as I have so much to learn here.

The relay coil has an 85.5 ohm resistance and draws about 145mA at 12.5V. I am currently driving it with a single 2N4401 which can pass ~600mA max if I read the datasheet correctly so that should work. The 200ohm resistor is there to limit the current through the base; I tried to pick a value that lets enough current pass through so the transistor would let enough current go through for the relay, yet not too much to avoid dropping too much voltage and risk taking the transistor out of full saturation. Clearly something is still nebulous in my mind here!

Next step is to try driving the relay coil with a mosfet instead, it seems it would be more straightforward.

I did not know how to represent the fact that the trigger to the system (the existing horn circuit) is an external signal that will go high at 12V when turned on. I represented it with a switch but obviously that's not what it is.

The "Setup" section is a way for me to have a switch to choose how the new horn should behave from a few predefined settings: OFF, no-delay, 300ms, 600ms (or something, i'll tune the values once it all works). I played with this config and I can easily pick up my 4 values with a wide margin of error. Not sure if it is the right way to approach something like that.
« Last Edit: April 09, 2019, 12:07:06 am by vmallet »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf