0

I'm working with an Arduino Nano Every, and I'm trying to connect it to the Raspberry Pi Zero for data collection from I2C sensors and writing/program code from the Pi to the Arduino. Typically, I would use a USB cable to connect from the Pi to the Arduino. However, this is going to be in an area where space is limited, so I'm looking for ways to connect the Arduino to the Pi that does not involve a USB cable. Are there other ways for the Pi and the Arduino to communicate the same way as if they were connected together via USB cable, perhaps through the Raspberry Pi's GPIO pins? What are some advantages/disadvantages of doing it in other ways?

EDIT: Something that also occurred to me: When connecting the Arduino to the Pi, to ensure that the Arduino has enough power, is there no choice but to use USB?

3

You can connect via:

  • UART
  • I2C
  • SPI

All are available on the Pi's GPIO header and on the Arduino. You will of course need logic level translation for a 5V Arduino.

Using UART is probably simplest for you since that is identical to using the USB - you just use /dev/ttyS0 (or /dev/ttyAMA0 on older Raspberries) instead of /dev/ttyUSB0 or /dev/ttyACM0. Just connect the Pi TX to the Arduino RX, and the Arduino TX to the Pi RX through logic level translation (voltage divider is a possibility).

| improve this answer | |
  • Thanks for your comment. There was one other concern that just came to me. Previously, when I connected my Pi to the Arduino Uno via USB (I used an Uno as a prototype before), it powered the Arduino through USB. If I were to use UART as you suggested, how can I power the Arduino? If I can power it through the GPIO pins, would that ensure that the Arduino+sensors have enough current, or would the best way to ensure adequate power is through USB? – BestQualityVacuum Jan 9 at 21:22
  • Use the 5V pin of the Pi to power the Arduino through it's 5V pin. – Majenko Jan 9 at 21:24
  • Thanks again for your reply. If I use it with other devices, such as this Ethernet/USB Hub Hat, I just have to make sure that there's no contention with the UART pins in order for this to work? Are there any good tutorials that you can link to? amazon.com/Ethernet-USB-HUB-HAT-Compatible/dp/B07T16RSFM/… – BestQualityVacuum Jan 10 at 13:43
  • @user101402 It's unlikely you'd get contention with the UART. There's not many hats that would use it, instead using I2C and SPI for preference. – Majenko Jan 10 at 14:06

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.