Electronic – RX/TX LED for MAX232

communicationledmax232

I want to use two LEDs to show send and receive on my max232 RS232 to TTL (5v) converter. I have seen this method as the most conventional way to power an LED for max232:

enter image description here

I tested it and the LED light was very dim and decreasing the resistor value resulted in voltage drop at TTL level.

What is a more intelligent way to do this? Can I use two N-channel MOSFET and connect the gates to RX and TX and use a separate 5v between the Source and Drain? What are the pros and cons of this approach?

I have too many IRF3205 and I can use them. I think they will serve the purpose unless you think the specs are not good.

If it is good what resistor value seems reasonable between Rx/Tx and the gate of the MOSFET?

And one last question. Do you think a pulse stretcher is going to be necessary with this approach? or at least recommended? I am not familiar with them. If it is necessary or recommended I'd be thankful if you could show me a simple way to implement it. I am a tyro at best in electronics so I need a very simple solution… (like LM780x for voltage regulation / max232 for level conversion without too many details and components)

Thank you very much in advance.

Best Answer

For transmit/receive indication, you want the LED to light when the line is NOT at idle. This means you need the LEDs to be lit when the line is low, since this indicator will be connected to the digital logic side of the converter, not the RS-232 side. The other issue is that the LEDs will likely take more current to light well than the UART signals can supply. You need some current amplification:

The resistor value shown assumes 5 V power and 20 mA thru the LED when on. The LED will be lit whenever the line goes low. Due to the gain of the transistor, most of the LED current will be sunk by ground, not the digital signal.

This is still not a great circuit. The LED will light for the start bit and any 0 bits. Maybe that's good enough for a quick and dirty indicator, but the average brightness will be data-dependent, and it will stop immediately when the line is no longer in the active state. It may be very difficult to see a single character being transmitted, especially when it contains mostly 1 bits.

A more user-friendly way to do this is to insert a retriggerable one-shot in front of the transistor. This guarantees the LED is lit for some minimum time after the first sign of activity. 20 ms is usually a good value for this. That's long enough to be a clear blip to a human observer, but still look like the indication goes away "instantly".

If you are going to do all this, you might as well add the logic to the micro instead of trying to recover the activity indication after the fact in external hardware. I've done this a few times where the UART interrupt would reset a counter to 20, then the regular clock tick interrupt decrements it every millisecond until it reaches 0. The LED is lit whenever the counter is non-zero. Depending on the micro and the LED and how bright you need it, you may be able to drive the LED directly from a micro pin with just a resistor in series.