2

For a robot project I am using an Arduino Uno, and am running out of pins. The simplest solution would be to use digital pins 0/1. I know this means that I won't be able to use Serial communication (which is fine), but I also know that these pins are also used when uploading code to the board, and connecting components to these pins can interfere with the upload.

Are there certain types of components/interfaces that can be connected to these pins that won't interfere with the upload (without having to disconnect them every time I want to upload)?

In my case, I can choose between either using these pins to drive inputs for an L298N motor driver (TTL inputs), or to read quadrature motor encoder signals. My guess would be that the latter won't work, as these signals may be high and interfere (and I don't know whether applying a voltage to the encoder outputs would cause damage - I have no datasheets for them).

However maybe the TTL inputs of the L298N would be fine? Or do I have no choice but to either have a switch to disconnect the when uploading or find some other way to reduce pin usage (or go for a bigger Arduino)?

1

1 Answer 1

4

This is a general electronic problem, not specific to pins 0/1 of the Arduino.

The basic rule is:

  • An input can only accept one signal

But

  • One signal can go to many inputs

In other words any INPUT pin can only accept a signal from one place, but an OUTPUT pin can send its signal to many places at once.

The Arduino's serial connection has two signals - one input (RX) and one output (TX). The input pin (RX) can only get its signal from one place, and when programming that "one place" needs to be the USB to UART converter's TX pin. So anything connected to that pin that "sends a signal" will confuse everything and communication will fail.

Similarly the USB to UART converter's RX pin can only receive a signal from one place - in this case the Arduino's TX pin - connecting anything to this pin that could output a signal would confuse things and break communication.

So to round that up: you should be fine connecting anything that only receives a signal of some form (i.e., anything that is an INPUT, such as an RX pin or some form of control input like your motor controller) to either of those pins, but do not connect anything that can send a signal.

There is one caveat though: whatever you connect will receive the serial communication used while programming. That could have unintended consequences, like a motor spinning when you program the board.

3
  • Thanks, this is largely what thought. However, I would assume that some inputs may cause loading on the pin that would interfere? Such as an input with a pull up/down resistor will hold the voltage at a certain level, preventing correct operation?
    – Rustony
    Aug 17, 2022 at 6:26
  • And unwanted inputs to the motor drivers should be fine - when programming I wouldn't have the motors powered, and even they were these inputs would only be the direction controls - the pwm input should still be 0.
    – Rustony
    Aug 17, 2022 at 6:28
  • @Rustony The idea of a pullup or pulldown resistor is to provide a steady state when no logic signal is being applied. Any logic signal (such as the serial communication from the PC) should happily override a pullup or pulldown resistor.
    – Majenko
    Aug 17, 2022 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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