I currently working on a project where an Arduino has to communicate with a pi. Since the pi is running out of USB ports, I am forced to use the ux/tx ports on the Arduino and pi.

The communication in between those to consist of writing and reading from rostopic, meaning that rosserial is establising the serial communication.

I have only tested this using USB and between a pc and arduino, which works well, but haven tested on those pins and are bit unsure on a few things.

Do I need to use certain pins? And should they be setup for serial communication? in that case how?

I guess I would need a logic level converter. It should be easily made using a voltage divider. But should both have separate ones, or is just one enough?


2 Answers 2


I guess i would need a logic level converter

Yes. I don't think there is any arrangement of voltage divider you can use for the Pi's TX -> Arduino RX. So you need at least a 2 channel shifter that's either bidirectional or has a channel going each way.

I use a shifter like the one shown and described here. Although that's a question about "Arduino devices" I mostly do it directly with the Arduino itself.

The relationship is very reliable at the Arduino's max baud rate (115200) in my experience. The thing you have to watch out for is state management -- you should have a means of resetting the Arduino to a predictable state. This is usually pretty easy as it would be hard to create a situation where simply pushing "reset" doesn't work, since even if the content of information sent at that point is unknown, the format should not be (e.g., a set of 3 2-byte unsigned integers constitutes one message or whatever).

If you need to do that remotely you can connect a GPIO to the Arduino's reset pin then you just need to pull it low momentarily and leave it high for normal operation. This also needs to pass through the level shifter, so if you think you want that you need at least 3 channels. The four channel ones are very common and cheap anyway.

  • Thanks for that. My next stop, once getting the Arduinos to talk to each other, is to include the Rpi3. I may yet use I2C for that, now that @Joan has upgraded the gpgio package to include it. I am new to all this but am positive I can make things work, once I know their parameters.
    – SDsolar
    Commented Dec 3, 2016 at 0:58

You should not need to shift the RPI Tx ---> Arduino RX The Arduino will be able to read the 3.3V logic produced by the pi, so you can use a simple voltage divider to shift Arduino TX ---> RPI RX

The RPI3 does have a different setup for the UART, there are actually 2 that can be used (not at the same time) One is always tied to the Bluetooth unit(i think) The default is the better(more stable) of the two is used for bluetooth and the other is tied to the UART pins on the GPIO. So make sure to look into that. If you list out the /dev directory, you will see the linked device at Serial1 (which will always point to the actual UART being used) But if you have any performance issues you can switch which internal UART is tied the GPIO

Here is some reading on the UARTS on the pi

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.