# UART LED Driver using MOSFET

I was looking around at some other questions that were asked dealing with how to use an LED to indicate UART activity. One of them provided the image below, however it was stated in the comments that factors such as cable length and baud rate will cause significant signal degradation.

Other questions recommended using a MOSFET to drive the LED instead. I haven't dealt with those before and wanted to confirm some of the specifications before proceeding.

When choosing a MOSFET for this portion of my circuit I came across the BSS138 N-Channel on DigiKey and the specs I don't exactly understand/want to confirm are adequate are:

• Current - Continuous Drain (Id) @ 25°C: 200mA (Ta)
• Drive Voltage (Max Rds On, Min Rds On): 2.75V, 5V
• Vgs(th) (Max) @ Id: 1.5V @ 1mA

These are my own interpretations for the three items:

• Current: The maximum current that the MOSFET can switch.
• Vgs(th): The threshold to switch the MOSFET (<1.5V: Off, >1.5V: On).
• Drive Voltage (Max Rds On, Min Rds On): This is one I just really do not understand.

With that being said would the BSS138 be suitable for the following circuit and not have any major affect on the communications?

simulate this circuit – Schematic created using CircuitLab

• nfet has wrong polarity - led on when uart idle – Henry Crun Apr 22 '18 at 23:32
• Oh woops. I thought this was an answer, not the question. Hmmm. Hmm hmm hmm. Oh well. – Harry Svensson Apr 23 '18 at 6:18

NFet is wrong. UART idles HI. So your fets are wrong polarity, and led would be lit on idle. (I assume you mean you are doing this at the UART pin (TTL level) not the RS232.)

Just use low current - hi efficiency leds, and forget the driver.

But anyway. Using BJT's it will still work on low voltages.

Note this circuit arrangement has the same component count as using a fet. This also give the minimum base current required at any time compared to the commonly used arrangement (Q5)

simulate this circuit – Schematic created using CircuitLab

A problem with directly connecting an led, is that brightness depends on data rate, and 1/0 balance of the data. If you only send the occasional char, the LED is not visible. The second version stays on for a fixed time, so you can see a single char.

Note, if you are using FTDI usb-ttl port or similar, they have an LED hole, with this monostable behaviour, so that is a much better point to attach the LEDs

The drive voltage refers to the $V_\mathrm{GS}$ at which those $R_\mathrm{DS}$ values are reported. The maximum $R_\mathrm{DS}$ was measured with $V_\mathrm{GS}$ = 2.75 V, and the minimum $R_\mathrm{DS}$ was measured with $V_\mathrm{GS}$ = 5 V. Your understanding of the other parameters is correct.

Your circuit will probably work, but you may encounter problems at higher baud rates. The MOSFET has a gate capacitance $C_\mathrm{GS}$ which will distort the edges of your serial signal. This value is referred to as $C_\mathrm{iss}$ in the datasheet, with a maximum value of 50 pF.

The example given is suitable for 74HC’ or similar family 5V logic with limited path lengths and LED currents using the UART’s negative logic idle High. Let’s be clear, your suggestion to use Nfet’s is good for inverting RS232 outputs.

Although in the 70’s we made RS-232 breakout boards with passive LED indicators drawing only 2mA . RS-232 raises the driver resistance to reduce ringing on long lines.

This is analyzed by the reactive/resistive impedance ratio. Also RS-232 , has not much excess current to power LEDs and long lines but works OK across the lab.

Any additional loads on signals must be considered for its effects on integrity of driver current limit and receiver threshold. CMOS is near Vdd/2 while RS-232 being bipolar voltages is still TTL input threshold of 2 diode (or Vbe) drops or near 1.4V.

Conclusion —

Your idea is valid ( often done ) but there could also be other solutions with multiple devices in one package. With 10000mcd LEDs now , you can easily get away with 2~3 mA for indicators ... unless you want too see them far away...