Arduino Pro Micro, add 2 more pin on B0 and D5

Dear all,
according to this article GOLEM, it is possible to remove two Arduino Pro Micro LEDs to have two new pins usable with I/O. After removing the two leds and soldering the cables on the pads how is it possible to access the two pins from code in Arduino IDE?
Thank you

Edit: Seems that this code compile correctly.. so B0 and d5 as Pin Number works?

Well, did you try using the pins using those names?

Perhaps you haven't gone to the trouble of modifying your Pro Micro yet.

Found this, seems plausible

The TX LED is connected to PD5 (D30) and the RX LED is connected to PB0 (D17). If you want to use them as generic I/O pins you will need to modify the pins_arduino.h file for the board in the Arduino core and clear the TX/RX LED preprocessor defines so that the USB core doesn't toggle the pull-up state (PORT register).

So PD and PB are references to the physical ports on the pro micro. PD5 is pin 5 on port D, PB0 is pin 0 on port B.

To use them as # 30 and # 17 you can follow the instructions I quote.

If you do modify your board and the recipe I found does not work, come back and say, there are a few other ways to get at the pins but none with the same convenience as having them show up as Arduino numbering scheme pins.

Good luck with the pesky soldering… you do know there are boards with more i/o pins already, right? :wink:

a7

1 Like

The first thing I would do is get the LEDs to work, if you cannot then you cannot access them. Then with a multimeter measure the voltage on the pins when on and off. You should get about zero and VCC, if you get about 2 volts or less you are on the wrong side of the resistor. If the pins are to be outputs you are set, just do not push much of a load on them. If inputs ;you may have to remove the resistors. Post an annotated schematic of what you want to do. Frizzies are not schematics.

Looking at the appropriate pins_arduino.h file, it looks like you can reference those pins with nice names:

#define LED_BUILTIN_RX 17
#define LED_BUILTIN_TX 30
1 Like

Thank you so much for your replies and advice.

@alto777
I haven't done the modification to Arduino Pro Micro yet. I know there are boards with more I/O but I have a project based on ProMicro already made and I needed to expand a functionality by adding 2 remote buttons.

@gilshultz
I will also try this as soon as possible, I found some useful information here (Pro Micro & Fio V3 Hookup Guide - SparkFun Learn)
immagine
It seems easy to be able to make a hook of pin 17, more complex that of pin 30 always according to what is written in the article...

@westfw
thanks for this clarification

Be aware that any Serial prints / writes will make the TX LED flash. Not sure if that also happens with keyboard prints, you'll have to test.

Uploads also will make both LEDs flash.

1 Like

Hi, @ClaudioCas
Are you using all the analog pins as well?
They can be configured as digital I/O.

Tom.. :grinning: :+1: :coffee: :australia:

Yes @TomGeorge,
I'm using all the pin. My first project was based on Arduino Mega, now I'm using Serial Led controller WS2811 so I reduce the number of pin used by led feedback and I'm using native midi port without serial to midi conversion.

// Pro Micro Test Code
void setup(){}void loop()
{digitalWrite(17, LOW);   
 TXLED0; 
 delay(1000);
 digitalWrite(17, HIGH);
 TXLED1;
 delay(1000);}

Given

# define TXLED0			PORTD |= (1<<5)
# define TXLED1			PORTD &= ~(1<<5)

why do both digitalWrite HIGH and invoke the macro that sets the same bit?

Oh, wait, as I read those, TXLED1 clears the bit. Which makes even less sense.

a7

i copied it some years ago. have used it only once when SD card fails to init, just before Keyboard.begin().

@ClaudioCas did you hear about STM32 BluePill?

Dear All
thanks. I removed the resistors and soldered two wires to the pads. Everything works great!
I leave below an example code. I have a standard test pin to check function and the two are soldered.
With button not pressed I read 1, when I press 0.

#define pushButton A9
#define B0_Button 17
#define D5_Button 30

void setup() {
 
  Serial.begin(57600);

  pinMode(pushButton, INPUT_PULLUP);
  pinMode(B0_Button, INPUT_PULLUP);
  pinMode(D5_Button, INPUT_PULLUP);

}

void loop() {

  int buttonState = digitalRead(pushButton);
  int buttonStateB0 = digitalRead(B0_Button);
  int buttonStateD5 = digitalRead(D5_Button);

  Serial.print("P: ");
  Serial.print(buttonState);
  Serial.print(" | B0: ");
  Serial.print(buttonStateB0);
  Serial.print(" | D5: ");
  Serial.println(buttonStateD5);

  delay(100); 

}

@alto777
TXLED1 is a macro for D5 pin, so it is the same as digitalWrite(30,HIGH);

@kolaha
Thanks for the suggestion, for now I'm happy with the ProMicro, very cheap and more than enough for my goal

Fixed that for ya.

The LEDs are wired to shine when the pin is at 0 volts.

a7

Unfortunately bad news. As written by @sterretje Arduino actually interacts with those pins even though they have been initialized as Output. The blink leds conflict with the button pressure reading... I don't know if it's going to be as simple as I imagined it :slight_smile:

I will do some more investigation as suggested here Arduino Pro Micro - switch off LEDs - Arduino Stack Exchange

I keep you updated

you need erase bootloader and upload sketch via ISP

This may be the problem mentioned in post #2. The site you link goes into that.

a7

@alto777
Exactly. I thought that setting the pin as Input this behavior would not occur. It is also written in solution 1 of StackExchange, but I use Input_pullup and perhaps this leads to the manifestation of the problem.
Anyway modifying pins_arduino.h (solution 2) everything seems to work correctly.
FYI with Arduino IDE 2 the pins_arduino.h is located on windows in C:\Users[USERNAME]\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\leonardo\

@kolaha
I don't have many skills on low level arduino. I'm sure wiping the bootloader and using the ISP programmer will solve the problem, but I'm not able to implement this solution. I found StackExchange's solution 2 more comfortable.

Thanks again for the valuable advice!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.