Delay timer - will this work for a 2 second switch off delay?

I am trying to design a two stage 12v circuit on my breadboard which works like this:

  1. I turn on a toggle switch and 12v is supplied to two circuits (stage 1 and stage 2). When I turn the toggle switch off, I want the stage 1 circuit to turn off immediately, but the stage 2 circuit to stay live for about 2 seconds before powering off. This is to allow time for my arduino controlled circuit to save to EEPROM, then run a shutdown sequence to re-home stepper motors. The stage 1 circuit is pretty much just a signal so very low load, whereas stage 2 drives the whole Arduino board with LEDs and things, with a max load of around 2 amps.

After some research, I've come up with the following circuit:

A couple of questions:

  1. I'm planning to use this NPN transistor. It seems to work with 12v but it says the base to emitter is 5v - does this mean I can't drive it with a 12v signal like I have shown above?
  2. Is the circuit fit for purpose? It's just for test purposes at the moment to emulate a staged 12v supply I will have in my car at a later date so I'm trying to keep it as simple as possible...

You are not driving it with 12V, the 12V is applied to the 100k resistor, not to the transistor base, and the collector is not at 0V. Bi-polar transistors are current driven. The base - emitter voltage for a silicon transistor is about 0V6 when forward biased, as you have it. That you ask this question makes me think you need to learn Ohm's law - Wikipedia

The 5V base - emitter voltage will be for the B-E junction reverse biased. If you get 5V on the base with it forward biased then the transistor will work best in that round filing cabinet under your desk.

The configuration you have is called an emitter follower because the emitter voltage follows the base voltage minus the 0V6 B-E voltage drop, so the output will always be at least 0V6 below the collector voltage. You don't really need the resistor at all as the base current flows in the load via the emitter. Most of the load current will be from the collector, with a small contribution from the base. Because of this the time delay will depend to some extent on the load. Also note that the voltage at the emitter will fall away slowly, not suddenly drop to zero after some time period.

It would be wise to have a resistor to limit the charge current of the capacitor, as it is now the capacitor is dumped across the 12V supply when the switch is closed.

Is the circuit fit for purpose?

I doubt it, but build it and play around with it and see what it does, it is certainly fit for use to learn about transistors and Ohms law.

I don't think that circuit will work as you want it to.

I'm assuming that you are expecting the RC time constant of 100kΩ and 22μF (2.2s) to give you your 2 second delay.

However you have the transistor configured as an emitter follower.

An emitter follower has a high input resistance, so it will not discharge the capacitor as quickly as you were expecting. The output voltage going to stage 2 will follow the voltage on the capacitor and slowly drop off to zero, which is probably not desirable.

This might be a good circuit to slowly dim a lamp/LED.

I think you would be better with a circuit where an npn transistor drives a pnp transistor (or an n channel FET switching a p channel FET), this will give you a better switching speed.

You could even do away with the R and C, and get the Arduino to switch its self off after it has completed all its required tasks.

Thanks both for your input. The overall point of this circuit is that this will be used as a dash instrument pod. In the car, I will have two 12v feeds running to the pod, one which powers the pod, including LEDs, stepper motors, the aruduinos etc. The other is simply a signal from the power distribution system that the system is on. When the car starts, both lines will go high to turn on the pod. When the ignition is switched off, the signal line will switch off immediately, followed by the main pod power a couple of seconds later. In that time, the pod must re-home the steppers and various other functions before the power is cut, which is plenty of time and it works perfectly in the configuration I have currently working.

All I'm trying to do at the moment is build a little test PCB to function test the pod when it's not in the car, so I've stuck in some pots and toggles to replicate various inputs, but I'd like to build a simple circuit to replicate the 12v signals and how they will work in the car.

I see your point about the emitter following the voltage down - that's not going to be ideal as you both say! Would you mind sharing an example of a NPN driving a PNP as you mention to achieve a fast switching circuit?

https://www.amazon.com/12-volt-delay-off-relay/s?k=12+volt+delay+off+relay

Just sayin'.

Thanks Doug! These do look good, but I've got a board design that I'm about to get printed so I was hoping to be able to add a couple of simple components on there before I place the order to add the functionality on the same board. If I can do it that way then perfect.

On the actual car, the delay off will be controlled by a solid state power distribution unit where I can add control logic for this pretty easily.

Not sure what to suggest. You could search on your favourite search engine for monostable multivibrator, which is what you are trying to make. All the circuits I found use NPN transistors, but you will need PNP. Just mirror the circuit and swap positive for negative everywhere.

My favourite way of getting timeouts before micro-controllers was to use a CMOS 40106 hex Schmitt trigger with a resistor and capacitor. Also good for making oscillators.

However, I think what @JohnLincoln said is best:

Get the Arduino to switch its self off after it has completed all its required tasks.

To do this requires 2 transistors, ideally MOSFETs. This comes up on here sometimes, with people trying to do it with 1 transistor: It cannot be done with 1 transistor! Do some searching for the question and the solutions.

The Arduino already works great for how the car will work. I'm just trying to simulate how the car will work for my test board.

After some trawling of the interweb, I've come up with this hopefully slightly better circuit based on an NPN and a PNP transistor... Is this looking a little better??

It's better than the other one. I suggest you build it on breadboard and try it out.

I mentioned the CMOS 40106 in reply #7, do you happen to have any? That is still the device I'd use today if I wanted something like this, I just can't imaging wanting something like this now there are better things to use.

This is just a test board so I don't really want to spend any more time than I have to getting it to work and I don't understand how the other circuit you mention would work. This isn't about turning the Arduino off, it's just about being able to keep a 2A 12v supply live for 2 seconds after I turn off a toggle switch. The Arduino is already programmed to do everything it needs to do as soon as it sees one pin go low. It only needs a very short time to shut down, but the process of fading down LEDs, re-homing steppers and showing the exit splash screen on the OLED takes the time.

If the above circuit works then I will just use that as I can solder it pretty easily with some through hole components - it doesn't need to be elegant or perfect, just needs to do the job more or less :slight_smile:

There's a misunderstanding somewhere, I don't know if by you or me. In your OP you said:

So I think that means the Arduino circuit is powered off after about 2 seconds, but you've just said this is not about turning the Arduino off. Please clarify.

In any case:

If the Arduino is to remain powered then it can control the power to stage 2. This requires 2 MOSFETs, one P channel to switch the power and a low power N channel MOSFET to switch the P channel one.

If the Arduino is to be turned off then it can do this itself, this also requires 2 MOSFETs. This has been discussed many times on this forum, do some searching.

What I mean is, the Arduino will have no control over the power source in the car. The PDU will supply the dash pod with a ~2A supply which is used to power the complete pod, including 3 arduino boards, lots of LEDs, an OLED screen, 4 stepper motors, and a few other bits. When the ignition key is turned on, the PDU will enable this 12v supply which will cause the Arduinos to boot and start things up.

When the ignition is turned off, the PDU will first cut power to a signal wire (stage 1) which tells the Arduinos in the pod that main power is about to get cut and to initiate shutdown sequence. This involves not just super fast EEPROM updating but re-homing of the steppers, a LED fade sequence and a shutdown logo to be shown on the OLED.

What I'm building is a test board that can control the pod when not connected to the car to test and demonstrate its features. I have various pots, toggles and even another arduino to simulate various inputs, and it has a toggle to control the shutdown 12v signal. I'd like this same toggle to also control the main power to the pod and mimic the action of the PDU in the car, so both main power and shutdown signal go high when the toggle is turned on, then shutdown signal falls immediately followed by main power 2s later when it's turned off.

I think the circuit I have should do that?

Thanks. Somewhere along the line I misunderstood, thanks for the clarification.

I don't know. Try it. One of my pet things (apart from Simba, my cat) is that I strongly believe electronics is about experimenting and trying things out. There comes a time when it's time to stop asking questions and start plugging components into breadboard and finding out if they work the way you want. You have reached that point!

I would not build that circuit, I'd use whatever Arduino I had kicking around spare and use it to drive a MOSFET or 2 to give me the timed switching. However, I am not trying to put you off trying, go ahead and see if it does what you want, whether it does or it doesn't you will learn something useful.

1 Like

Yes that's very true... I will give it a try and see what happens.. If it all goes horribly wrong then it's only a test board so it doesn't matter too much. I think in this case I'm just rushing because of that fact... Thanks again for your help :slight_smile:

1 Like