I have the (more or less) Leonardo-compatible board Olimexino-32u4. Both, the TX- and RX-LED are permanently on. To reduce power-consumption, I want to disable them by software. What is the reliable way to do it?

  • Examine the schematic and determine if they are wired to supplies, or to I/O pins. If supplies, desolder the associated resistors. If I/O pins, modify the bootloader and USB core to leave them off, or try issuing raw ATmega I/O access to turn them off if the are simply left on after the bootloader and not being constantly re-driven by USB traffic. Jul 24 '14 at 18:24
  • @ChrisStratton why not just desolder them in the first place? I don't know why it'd be bad to desolder the LED in the first place... Jul 24 '14 at 23:19
  • Just put a piece of tape over them... Jul 25 '14 at 0:07
  • 5
    Software modifications are cheaper and easier to reverse. Tape doesn't save power. Jul 25 '14 at 1:52
  • How they are driven currently? The straight-forward way using digitalWrite(pin, LOW) does not work. pinMode(pin, INPUT) doesn't work either.
    – Thomas S.
    Jul 25 '14 at 6:18

Try adding this to your setup routine:


These macros (and their cousins TXLED1, RXLED1) are used to control the TX an RX LED's on Leonardo. They are defined in https://github.com/arduino/ArduinoCore-avr/blob/9f8d27f09f3bbd1da1374b5549a82bda55d45d44/variants/leonardo/pins_arduino.h#L95-L98

If that doesn't work you can try the solutions suggested here: http://forum.arduino.cc/index.php?topic=145262.0

  • 1
    Switching the IDE to upload to "Micro" instead of "Leonardo" really solved the LED problem.
    – Thomas S.
    Jul 25 '14 at 16:10
  • See my new answer for more elaborate explanation and a maybe better solution.
    – user2973
    Jul 25 '14 at 16:19
  • Alternatively: the pin mapping in the Arduino world is D17 for RX and D30 for TX, so instead of TXLED1 you can also use digitalWrite(30, HIGH).
    – volzo
    Jun 13 '17 at 18:51

Reading the answer from Gerben I realised the core of the issue: The TX/RX LED's on the Leonardo are wired PIN-LED-5V(common anode), whereas on the Olimexino-32U4 they are wired PIN-LED-GND(common cathode). So the two boards will need inverse signals for the same visual output.


The most elegant solution will be to add a new board type (the code below is for IDE 1.0.x):

  • In your sketchbook create a folder 'hardware' and inside that 'olimexino'. In the olimexino folder create a file boards.txt with this content:

  • Create another folder 'variants' inside the olimexino folder.

  • Inside that, create the folder 'olimexino32u4'.
  • Now copy 'arduino/hardware/arduino/variants/leonardo/pins_arduino.h' to that folder
  • Open the copy for editing - the path should be 'sketchbook/hardware/olimexino/variants/olimexino32u4/pins_arduino.h'.
  • Change the section that deals with TXLED and RXLED by swapping the macros that end in 1 with those that end in 0. It should look like this:

    #define TX_RX_LED_INIT  DDRD |= (1<<5), DDRB |= (1<<0)
    #define TXLED1          PORTD |= (1<<5)
    #define TXLED0          PORTD &= ~(1<<5)
    #define RXLED1          PORTB |= (1<<0)
    #define RXLED0          PORTB &= ~(1<<0)

I don't own the board so I can't test the solution. I hope that it solves your problem - just choose 'Olimexino-32U4' from the Tools->Board menu.

  • I've tried both values on TXLED and RXLED - one did not work. Only selecting the "Micro" board worked.
    – Thomas S.
    Jul 29 '14 at 9:58

The TXled is connected to physical pin 22, or PD5. RXled is connected to pin 8, or PB0. They are connected to the cathode of the led, so they have to be HIGH to turn off the leds.

To turn them HIGH use:

PORTD |= (1<<PORTD5);
PORTB |= (1<<PORTB0);

Not sure what the firmware does, and if it sets the leds back to low every once and a while. So in addition I would suggest also setting those pins to inputs.

DDRD &= ~(1<<DDD5);
DDRB &= ~(1<<DDB0);
  • The Olimexino-32u4 connect the LEDs to GND, but as written in my comment, this approach does not work.
    – Thomas S.
    Jul 25 '14 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.