Thursday, 6 December 2018

transistors - How to switch an LED using logic 0 and 1


The PL2303HX is used to convert USB serial bridge controller.


I would like to connect an LED to TXD pin so that it lights when it is logic 1 and off when it is logic 0.


PL2303HX enter image description here


enter image description here


PL2303HX datasheet


I would like to consider 5mm white LED (3.3v,20mA).



Can I directly connect the LED anode to TXD with a resistor and cathode to GND.


Does it affect the baud rate?


Is it safe to draw 20mA from TXD pin?


Is there a better way to light the LED using Vcc(5v) as power source and TXD as on and off like-


enter image description here


EDIT


I tried above circuit, but getting error.


I want the LED to turn off when logic 0 and turn on when logic 1. LED is powered by 5v separately. It should switch at the rate of 9600 baud rate.



Answer



You need to reverse the orientation of the LED. Connect the anode of the LED to the output of the NOT gate, then connect the cathode to the resistor and the other end of the resistor to ground. The LED will light when the output of the NOT gate is high, which is when TX is low.



No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...