Go Down

Topic: Using a two transistor NAND gate as a IR LED modulator (PWM + I/O) (Read 1 time) previous topic - next topic

BlueBill

It might already have been done, it might be the wrong way of doing it but is anyone modulating IR LEDs (for remote control) using a two transistor NAND gate.
The idea is setting one output pin (A) for PWM @ 38kHz ~ 33% duty (common for IR) and another other pin (B) just clocking out the data.
The NAND gate would be similar to this.


Comments.
Bill

Grumpy_Mike

It is a technique called a totom pole, used in old logic gates. It works if you want to do it that way. Note you get two times the Vsat voltage so the swing is a bit limited.

pwillard

Technically... the official "totem pole" output would send the signal out between the lower transistor's collector and the upper transistor's emitter.  I believe that this is the scenario where you get more limited swing... a bit less in your case when using the upper transistors collector.

BlueBill

Thanks, it seems like a cheap & cheerful solution. I'll give it a shot.
Bill

dhenry

You can use one transistor for that - one signal to the base and another to the emitter.


BlueBill

The IR LED and resistor will be on the top transistors collector. It's not uncommon to run an IR LED at 100ma or more (hence the 33% duty cycle). The AVR would have to sink 100ma if tied to the emitter.
Bill

dhenry

In that event, use two diodes on a power transistor's base.


michael_x

Quote
In that event, use two diodes on a power transistor's base.

... giving a wired OR instead of a NAND ... ?
    are you thinking of a PNP transistor ?

Quote
The IR LED and resistor will be on the top transistor's collector. It's not uncommon to run an IR LED at 100ma or more.


For directly controlling such a load, a logic IC might not be an alternative, neither.
But the swing is definitely big enough to clearly switch a LED on/off.

BTW: 6V and 4.7k allow for about 1.3 mA, if I remember Ohm's law.
If you replace that 4.7k resistor by a 47 Ohm resistor and a IR led, you should also reduce the base resistors from 10k to something about 1k,
and check if the 2N2222 transistors won't get too warm.

BlueBill

I'll try a PN2222A or 2N3904, both can easily handle 100ma, plus it'll be off at least 66% of the time :)

Thanks for the part values, exactly what I had in mind. These are the types of IR Blasters I'd like to control.
Bill

MarkT


Quote
In that event, use two diodes on a power transistor's base.

... giving a wired OR instead of a NAND ... ?
    are you thinking of a PNP transistor ?


technically NOR, since the output voltage is inverted (this is diode-transistor-logic I believe) - resistors will work in
place of diodes (resistor-transistor-logic), and with the diodes there should be a base resistor
too of course.  For gating an LED, wired-OR/NOR won't work as the neither input can suppress
current.

If using two transistors anyway then one can be a PNP high-side switch and the load can go in the middle - this is
then a 1x1 LED array perhaps!
[ I won't respond to messages, use the forum please ]

dhenry

If you work out the math, they are exactly the same: when the signal pulse is low, no output current. If the signal pulse is high, output current follows the carrier pulse.

Precisely what you need.

Go Up