I have 2 PWM ports, one generates 5V PWM and another at 3V. But only 1 will be generating at a time. However, their output is going to a same wire or pin. So, to avoid the current to pass into each other, I want to put diodes on each port as protection. For this, I would need fast switching diodes as PWM frequency is KHz or few MHz. I searched for fast switching diodes and found 1N4148. It does what I need but its forward voltage is 1V. So, for 3V and 5V, it will blow up ? or am I understanding the datasheet wrong ?

I read in this answer that forward voltage is voltage drop ? so if its voltage drop, whats the max voltage that it can support ? also 3V will come out as 2V, so I will be required to level it up to 3V again, right ?


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Why don't you just set the unused pwm pin as input and activate the other? 3V pins are usually 5V tolerant. \$\endgroup\$ – Vladimir Cravero May 12 '15 at 9:50

The forward voltage itself is not really the value that you need to worry about - using it in this circuit won't break it as you aren't going to be intentionally dropping large voltages across the diode. In fact it is the power rating of the diode you need to look at.

Why? Well, you will need something at the output to pull it down when both are low - e.g. a resistor.

With the diodes your signal output levels will e reduced - by the forward voltage drop of the diodes. So if you have say a 10k pull down resistor, this would mean when the 3V logic signal is pulsing you will get a 0V low level (pulled down by the resistor) and a 3-Vf=2V high level (sourced through the diode). In this case you would have Id=2/10k=0.2mA flowing through the diode which should be fine for most diodes (it is only ~0.2mW).

For the 5V logic signal you would have a 4V high level output, and in this case there would be 0.4mA flowing through the diode, which again should be fine.

The problem with this is that if the load on the PWM signal is quite highly capacitive then it will switch from high to low quite slowly as you only have the resistor doing the switching. If the PWM signal was driving a large power transistor which would have a fairly high gate capacitance, this slow switching could cause excessive heating in the transistor (but that is a whole other story).

If you want to switch faster you may find you need to reduce the resistor value to increase the speed in which the output is pulled low. When doing this you have to be mindful of the current that flows through the diode and on through the resistor during a logic 1 and hence the power dissipation in the diode (Vf * Id).

Given you have a 3V signal and a 5V signal, what you can do (and I have done in the past) is use a TLL level 2-input OR gate (e.g. 74HCT32). These tend to have high input voltage thresholds (Vih) which are quite low and can thus run at 5V but support a 3V input (e.g. this 74HCT32 has a Vih of 2V on a 5V power supply). By using an OR gate like this you eliminate the issue of voltage dropped across diodes and get a Push-Pull output - the output of the logic gate sources and sinks current, so you don't need the pull down resistor.

  • \$\begingroup\$ True but problem with HCT32 was that it only have 2 input ports for 1 output because in future I may have more PWM ports to same output. Diode seemed to be goes to n number of ports. However, once I saw OR gate with more than 2 input ports. But I cant find it now. \$\endgroup\$ – xmen May 12 '15 at 4:42
  • \$\begingroup\$ Holy awesome, I think I got an idea for OR gate. I can use them as nested. \$\endgroup\$ – xmen May 12 '15 at 4:44
  • 1
    \$\begingroup\$ @xmenW.K. As there are 4 OR gates in the chip, if you want more inputs you can simply chain them together - output of one goes to the input of another. This would give you a 5-input OR gate on which the 3 currently unused inputs could have a 10k pull down resistor. You could then just connect any inputs later. \$\endgroup\$ – Tom Carpenter May 12 '15 at 12:35
  • \$\begingroup\$ Yes, thats exactly what I meant by nested :) but thank you Tom \$\endgroup\$ – xmen May 12 '15 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.