Diode question in my Arduino project...

Hi there...

I want to power either a 12v socket or an Arduino using a spdt switch.

so, ON(socket) - OFF - ON(Arduino) but not both at the same time.

I wish to have a single warning light on when the switch is in either of the ON positions. Obviously I can't just power the light from both of the switch terminals - it would make all of it live.

I am, therefore, looking to use 2 diodes to resolve this...

Is the diagram correct? Will it work as I want?

Thanks for your time, help and patience...

Hello there!

The diode part of the circuit looks good, as each diode would prevent powering the unwanted unit.

Just a couple things.

First, do you have any sort of current-limiting device for the warning light?

Second, can the diodes withstand the current you want flowing through the warning light.

Third, are you making sure that the voltage you are applying to the Arduino is not too much for the on-board regulator?

bos1714:
First, do you have any sort of current-limiting device for the warning light?

Second, can the diodes withstand the current you want flowing through the warning light.

Third, are you making sure that the voltage you are applying to the Arduino is not too much for the on-board regulator?

Thanks for your reply... Unfortunately for me, I'm not an electronics person, so I'm always open to advice from those that are... As it stands at the moment the answers are:-

  1. No

  2. I'd get relevant ones (with guidance)

  3. I thought the Arduino could run from 12v (supplied to VIN)?

This is why I ask those that know... :-[

Excellent.

So you are going to need some current limiting device, unless you want the warning light to explode.

When you decide what current you want through the light, we can look at some diodes.

You are correct in that the Vin pin can take 12V! I just wanted to double check.

Have you already selected the light and the switch that you are going to use? If so can you post some electrical specifications like a datasheet?

I was thinking of an automotive dashboard light or 12v LED (12v LED)

The switch is a generic spdt one... it has 6A 125VAC ; 2A 250VAC on it's side.

So, I have the switch the rest I can get once I know what will work....

Awesome.

So the datasheet for the LED says that at 12VDC you do not need a resistor for current limiting. The datasheet also mentions, indirectly, that the current would not exceed 50mA, so a 1N4148 diode should work just fine.

As for the socket, how much current would it be drawing at any given time? You will have to make sure that the switch can handle that much current.

The socket is so that the battery can be trickle charged in situ rather that used for power which is why I don't want it live all the time...

Oh I see now.

I'd say you are ready to get the components and start assembling.

OK.. on looking at these, the LED is from RS and they only list the 1N4148TR as a 400ma not 200ma... will this make a difference? If not, I can order it all from the same place.

Yes, you can use the RS diode. It can handle far more current than the LED can. That LED has a current limiting resistor built in so it is ready to operate at 12V. Looks like a good design to me.

The absolute maximum DC forward current for the 1N4148 is listed as 300mA, you want to be well
below that, 150mA perhaps, for trouble-free use and long life. That 400mA is the absolute maximum pulse
rating, not useful to you...

The 1N4148 is a high speed signal diode, not a rectifier diode designed for power, but here the
load current is within its limitations, just be aware its not going to scale to higher current uses!

bos1714 - many thanks for your help, very much appreciated.

Thanks guys... Wasn't looking to increase the load, just if it would be an OK alternative :slight_smile:

This is exactly what forums should be like.. friendly, informative and helpful. Thank you.

He is only running one led on the diode. That is less than 20ma. But yes, I would not want to run more than 100ma through a 1N4148 on a long term bias. I would pick a different diode if I needed current higher than that.

SkyDyno:
3. I thought the Arduino could run from 12v (supplied to VIN)?

Sort of.

Only if you do not expect to power anything from the 5 V or 3.3 V pins, or more than a couple of LEDs on the data pins.

No relay modules, no display modules, no shields ...

If you anticipate doing any of these things, you need a "buck converter" module to provide 5 V.

Paul__B:
Sort of.

Only if you do not expect to power anything from the 5 V or 3.3 V pins, or more than a couple of LEDs on the data pins.

No relay modules, no display modules, no shields ...

If you anticipate doing any of these things, you need a "buck converter" module to provide 5 V.

only to send a signal to a servo.

So I connect it all up as per my diagram. Just to make sure that it's behaving as I want I've checked the voltages at the switch

12v at the centre pin, OFF - LED off

ON 1 - 12v out to Aruino, 0v to Socket, LED on

ON 2 - 12v out to Socket, 0v to Arduino, LED on

now the problem is that in the centre - OFF position the LED is off but there is 2v at the other 2 switch pins.... and I need it to be 0v out, LED off

now, if I unplug the bulb, it all works as expected.

So, how do I fix it...

As I stated at the beginning, I'm not an electronics bod, so help and a solution is very much appriciated.

Sounds like power is leaking from the Arduino. Do you have it hooked up to the computer at the same time? The Arduino is the only place I can see power coming from resulting in 2 volts on the other switch contacts.

amdkt7:
Sounds like power is leaking from the Arduino. Do you have it hooked up to the computer at the same time? The Arduino is the only place I can see power coming from resulting in 2 volts on the other switch contacts.

To protect it whilst I checked, the Arduino is not connected at all. The 2v only happens when the LED is wired in. Take it out and the system works as I want.

To check that all the components are OK I built a second basic switch.. just the switch, LED and 2 diodes... it does the same. OK when no bulb, 2v when a bulb is included... I can only assume it's something to do with resistance or some such... but i sure as help can't see why I get a voltage when the switch contacts aren't touching....

Perhaps you are just seeing residual voltage due to the capacitance of the LED. If you hold your meter on it for a little while does it start to drop? The caps on the Arduino might be feeding it, they might take a while to discharge. If you put a 10K resistor to ground I bet it would go to zero fast. Probably nothing to worry about.

The Arduino isn't / hasn't been connected at all...

As for a 10k resistor, how would that be added, exactly?

...and thanks for all your time and help again.