Electronic – How to use PNP transistor as a switch for serial communication

pnpserialtransistors

I am trying to interface a 3.3volt TTY bluetooth dongle to my arduino. The dongle requires 3.3volt but the arduino's Tx and Rx signals are 5 volt. Apperently the 3.3volt is enough for the arduino Rx, but the 5volt Rx for the bluetooth will be too much.

I have a couple PNP transistors laying around. I am not at all familiar with transistors (I do more with large electronics and relays). I know that a transistor can be used similarly to a relay though.

Would it be possible to control the state of the transistor with the 5 volt Tx from the arduino. But have the transistor output 3.3volt from a separate power source?

If it is possible. How can I do this? Could someone please explain.

Thank you.

Best Answer

You don't even need the transistor. A couple of resistors will do.

enter image description here

If you pick 10 k\$\Omega\$ for R1 and 20 k\$\Omega\$ for R2 an input voltage of 5 V will be scaled down to 3.3 V out. In general:

\$ V_{OUT} = \dfrac{R_2}{R_1 + R_2} V_{IN} \$

edit

Apparently the 3.3 volt is enough for the Arduino Rx

Olin rightly points this out. It may not be guaranteed, and then you're just lucky that it works, but then there's no guarantee that it will always work. The ATMega328 datasheet says

enter image description here

and since Arduino works at 5 V it looks like you're safe: 0.6 Vcc < 3.3 V, and Arduino's NCP1117 voltage regulator is 2% accurate, which also helps. Still you have little headroom, and you should check that the output high from the Bluetooth dongle will always be higher than 3.1 V (probably will).