OpenRB-150 library calls interfere with digital inputs

I’m using OpenRB-150 board with three XL430 servos and writing the code with Arduino IDE version 2.3.2. The board is powered from a high quality 60W 12V DC switching power supply. There is a switch between pin #1 (Arduino numbering) and GND. This is the test code:

#include <Arduino.h>
#include <OpenRB-150.h>

using namespace ControlTableItem;

constexpr uint8_t DXL_ID = 1;
constexpr float DXL_PROTOCOL_VERSION = 2.0;
constexpr int pin = 1; // Problem with pin 1

Dynamixel2Arduino dxl(Serial1, -1);


void setup() {
  Serial.begin(115200);
  pinMode(pin, INPUT_PULLUP); 

  // dxl.begin(57600);
  // dxl.setPortProtocolVersion(DXL_PROTOCOL_VERSION);
  // dxl.ping(DXL_ID);
  // dxl.torqueOff(0);

  delay(1000);
}


void loop() {
  Serial.println(digitalRead(pin));
  delay(100);
}

It behaves as expected when the dxl calls are commented as shown above. Unfortunately, when I uncomment them, the state of pin #1 is stuck at zero. Why is that?

I would expect an occasional zero reading due to noise, but not all readings at 0 when the switch is open. When I use an external 1K pullup resistor, the behavior is back to normal.

I have a feeling this might be a side effect related to the OpenRB not needing a dedicated TX/RX switching pin.

For our Arduino shields, pin 1 is used as the pin to switch between transmit and receive mode, but the OpenRB doesn’t need to use up an Arduino pin to do so. I wouldn’t be surprised if the backend code is still trying to occupy the pin in some way, does everything operate as expected with the external pullup resistor connected?

1 Like

Yes. 1K external pullup solves the problem. I also observed cyclical behavior on another floating pin with internal pullup: a few seconds low, a few seconds high.

Hi - this caught me out as well - I was using a rotary encoder and had a few custom circuit boards made before I realised.

Is there anything that could be changed in the backend code, do you think ?

And can I just check - the 1k resistor goes between 3v3 and pin 1 - why does this fix it ? (ie is it robust as a solution - I’ve not soldered one in yet).

Many thanks

It should be possible to modify the underlying library to completely disable the line switching on OpenRB-150 boards, but I’m not sure exactly how much of the code would need to be modified to make sure things behave properly.

The pullup resistor should be reliable enough for a permanent solution in hardware though.

1 Like