Adding a horn on a delay: where to begin? - Page 1
Forum section: electronics / beginners

author: vmallet
author_rank: Regular Contributor
timestamp: March 28, 2019, 06:15:09 am
content: 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 nebulousThanks for your ideas!

author: RobertHolcombe
author_rank: Frequent Contributor
timestamp: March 28, 2019, 06:28:19 am
content: Using only discrete components may be more useful as a beginner in learning the basicshttps://www.electronicshub.org/time-delay-relay-circuit/

author: Ian.M
author_rank: Super Contributor
timestamp: March 28, 2019, 07:05:55 am
content: While I agree withQuote from: RobertHolcombe on March 28, 2019, 06:28:19 amand 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".

author: AndyC_772
author_rank: Super Contributor
timestamp: March 28, 2019, 07:10:04 am
content: I'd argue that the 'basics' these daysdoinvolve 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.

author: emece67
author_rank: Frequent Contributor
timestamp: March 28, 2019, 09:50:44 am
content: .

author: Ian.M
author_rank: Super Contributor
timestamp: March 28, 2019, 11:18:48 am
content: 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.LTspicesim 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.

author: Zero999
author_rank: Super Contributor
timestamp: March 28, 2019, 11:47:57 am
content: 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.

author: vmallet
author_rank: Regular Contributor
timestamp: March 29, 2019, 12:53:55 am
content: 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?).

author: AndyC_772
author_rank: Super Contributor
timestamp: March 29, 2019, 07:58:47 am
content: 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.

author: vmallet
author_rank: Regular Contributor
timestamp: April 02, 2019, 06:46:49 am
content: I received some components today and started playing around with the 5V power supply.@Zero999 a few questions for you...Quote from: Zero999 on March 28, 2019, 11:47:57 amWhat 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 thatHere'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 backwards1/4W is not going to deal very well with a few W of power, one more lesson learned!Thanks!

author: Zero999
author_rank: Super Contributor
timestamp: April 02, 2019, 08:52:34 am
content: Quote from: vmallet on April 02, 2019, 06:46:49 amYes.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.QuoteI'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.

author: David Hess
author_rank: Super Contributor
timestamp: April 02, 2019, 09:58:49 am
content: The easiest way will be a 12 volt time-delay relay. Building your own circuit includes building it for an automotive environment.

author: Zero999
author_rank: Super Contributor
timestamp: April 02, 2019, 12:04:57 pm
content: Quote from: David Hess on April 02, 2019, 09:58:49 amYes, 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

author: Kasper
author_rank: Frequent Contributor
timestamp: April 02, 2019, 03:28:57 pm
content: 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.

author: vmallet
author_rank: Regular Contributor
timestamp: April 02, 2019, 05:32:51 pm
content: 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!

author: vmallet
author_rank: Regular Contributor
timestamp: April 02, 2019, 06:11:53 pm
content: Quote from: Zero999 on April 02, 2019, 08:52:34 amOk 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?QuoteAh 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..)QuoteAh-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 learningThis 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)

author: vmallet
author_rank: Regular Contributor
timestamp: April 02, 2019, 09:13:35 pm
content: Quote from: Ian.M on March 28, 2019, 11:18:48 amI'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!

author: Ian.M
author_rank: Super Contributor
timestamp: April 02, 2019, 10:22:01 pm
content: 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 toRand the value toR=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:Version 4SymbolType CELLLINE Normal -15 0 -33 0LINE Normal 1 -15 -15 0LINE Normal 15 0 0 0LINE Normal 31 0 15 0CIRCLE Normal 3 -13 -1 -17CIRCLE Normal 2 2 -2 -2PIN -32 0 NONE 8PINATTR PinName 1PINATTR SpiceOrder 1PIN 32 0 NONE 8PINATTR PinName 2PINATTR SpiceOrder 2into 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

author: vmallet
author_rank: Regular Contributor
timestamp: April 03, 2019, 12:10:09 am
content: Ah-ha! Thanks, it makes so much more sense nowQuote from: Ian.M on April 02, 2019, 10:22:01 pmYep, 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 togetherThanks for all the basic info about LTSpice.QuoteI 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!

author: Ian.M
author_rank: Super Contributor
timestamp: April 03, 2019, 02:29:50 am
content: 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.

author: vmallet
author_rank: Regular Contributor
timestamp: April 03, 2019, 06:22:46 am
content: Thanks again Ian, very helpful.One more question. In your original message you said:Quote from: Ian.M on March 28, 2019, 11:18:48 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?ThanksVince.

author: vmallet
author_rank: Regular Contributor
timestamp: April 03, 2019, 07:29:29 am
content: 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:Quote from: emece67 on March 28, 2019, 09:50:44 amDI1/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!

author: Ian.M
author_rank: Super Contributor
timestamp: April 03, 2019, 08:22:42 am
content: Quote from: vmallet on April 03, 2019, 06:22:46 amNope. 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 toPWL(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 tovcand 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.

author: emece67
author_rank: Frequent Contributor
timestamp: April 04, 2019, 08:40:00 pm
content: .

author: vmallet
author_rank: Regular Contributor
timestamp: April 09, 2019, 12:05:18 am
content: Thanks Ian.M and emece67 for your recent answers, every bit helps with the overall understandingI 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.

author: vmallet
author_rank: Regular Contributor
timestamp: April 20, 2019, 12:48:28 am
content: I updated the design a bit to get rid of the pre-made arduino board and use an MCU directly (ATTiny85v) and replaced the switching transistor to a mosfet to try it out. I then spent some time trying to lay out the circuit on a protoboard and I realized it's harder than it looks!Here's the updated schematic:and here's the assembled version, ready to be mounted somewhere in the car...Thanks everyone for the help. There are still some unanswered questions earlier in this thread and if someone found time to answer them it would be very helpful

author: Ian.M
author_rank: Super Contributor
timestamp: April 20, 2019, 01:59:49 am
content: Add a 300mW 4.7V Zener diode across RH2, anode to ground, to provide some input protection for the MCU.Get a ratchet crimping tool to do insulated spade connectors for the relay terminals, as soldering heavier wires to them typically FUBARs the relay because the plastic base usually isn't very heat resistant, so the contacts go out of alignment. You've probably got away with soldering the coil wires, but I'd still scrape off the solder and re-do them with crimp terminals: Auto relays go bad more often than one would like, so you might as well plan for future replacement.

author: vmallet
author_rank: Regular Contributor
timestamp: April 20, 2019, 05:44:33 am
content: Quote from: Ian.M on April 20, 2019, 01:59:49 amAh nice, yes I was wondering how a spiky voltage would work from this line but wasn't sure how to protect it. I have a 5.1v zener, maybe I can use that until I find a 4.7v (attiny85 datasheet says "maximum voltage on any pin is Vcc+0.5v" i.e. 5.5v in my case; 4.7v would be safer overall). Now I have to figure out how to retrofit it on the board!QuoteYep all the lines to/from relay / compressor / battery were going to be crimped, it's hacked up on the bench just to test it out. Thanks for the extra explanation.

author: Ian.M
author_rank: Super Contributor
timestamp: April 20, 2019, 08:46:29 am
content: 5.1V will be OK if its close tolerance (+/-5%). However if its +/-10%, it wont be very effective if its at the upper end of its range: 5.6V. Also that assumes the 5V rail is 5.000V If its actually 3% low, that's 4.85V, so you *MUST* clamp at under 5.35V, which is cutting it close for even a 5% Zener. Therefore its preferable to clamp at 4.7V in a 5V system. You can't go much lower or you wont guarantee to be over the logic '1' threshold voltage.Adding a 1K resistor between the potential divider + Zener and te I/O pin would also help - if the Zener clamping voltage is slightly too high during a big spike, it limits the current into the MCU's internal clamping diode (to Vcc).I don't see much problem fitting it in - you are wasting a lot of space accross the board from the board to the 4 way terminal block.

author: vmallet
author_rank: Regular Contributor
timestamp: April 21, 2019, 02:27:58 am
content: Very help explanation of how we get to choose 4.7v for the zener, thanks!Quote from: Ian.M on April 20, 2019, 08:46:29 amI see. As an alternative, could I limit the current by increasing the values of RH1/RH2 while keeping the ratio I was going for (and skipping the 1k)? Like 33K & 51K, or something in between? Is there a drawback in doing this?

author: Rerouter
author_rank: Super Contributor
timestamp: April 21, 2019, 03:05:19 am
content: I should mention most auto stores should have timer modules with a pot to set the delay.

author: Ian.M
author_rank: Super Contributor
timestamp: April 21, 2019, 03:32:07 am
content: Quote from: vmallet on April 21, 2019, 02:27:58 amYes, but the order of magnitude higher impedance makes it more sensitive to noise pickup and its also more sensitive to Zener leakage. Muntzing it to save one resistor isn't (IMHO) worth it.I would suggest also adding a small capacitor across the Zener to filter out RFI. 10nF should do nicely. Otherwise there is a (small) risk of the horn triggering if an active mobile phone is near the control box.@Rerouter: That's probably the right way to go if you are in the custom auto business, but the O.P. isn't going to learn much electronics from simply using an off-the-shelf module.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: April 22, 2019, 04:26:14 pm
content: Whether you use an LM555, a 4017 or a microcontroller, when you want to build a reliable circuit the power supply section is very likely the most difficult to get right.For example, automotive power supplies should be able to handle "load dump" situations, where the voltage can have short peaks of 80V.

author: vmallet
author_rank: Regular Contributor
timestamp: April 22, 2019, 09:38:20 pm
content: Quote from: Ian.M on April 21, 2019, 03:32:07 amThanks. I was more wondering about the additional voltage drop over the new resistor; but I've since then understood that given that the input pins have super high impedance, there will be effectively no current flow into the pin and so pretty much no voltage drop over the extra resistor. Makes sense.QuoteNoted. Would you have a short explanation of how that can happen? Or where to read about this type of interferences for a newbie?Quote from: Rerouter on April 21, 2019, 03:05:19 amSomeone else mentioned this early in the thread but like Ian said, it's really all about learning. And I've sure learned plenty!Quote from: Doctorandus_P on April 22, 2019, 04:26:14 pmHave you taken a look at the latest schematic a few posts up? Could you comment on the current design of the power supply?