Page 1 of 1

best, safest and easiest way to connect pi 3 b+ with arduino uno

Posted: Sun Jun 14, 2020 7:13 pm
by AGID
I I i have a project that will be working for very long time and i needed to connect an arduino for several reasons with raspberry pi 3 b+ which is power supplied with official charger but at the same time i have to use external power supply for arduino because the project is big and the power supply from coming from raspberry pi wont be sufficient so i was wondering what is the most safest, easiest and best way to connect them in my situation also without need of buying extra stuff as we are on quarantine and its hard to buy new stuff. also its great to mention that this project is gonna be on for very long period. last question is it possible to connect arduino to external power supply and its usb to raspberry pi AT THE SAME TIME without any damange for both of them. knowning that the uno power supply is 9v output.

Thanks in advance,

AGID

Re: best, safest and easiest way to connect pi 3 b+ with arduino uno

Posted: Sun Jun 14, 2020 7:53 pm
by wildestpixel
Depends on your project -

Are you sending commands over the AMA TTY to the Arduino or can you send them over UART TX/RX ?

The solution will depend on what the programmatic problem is ?

Do you need to gather data ? Do you need to send conditional commands back and forth ?

Are you wanting to exploit the PI's internet connectivity ? Would an ESP32 on the Arduino side as a UART send/receive acheive this instead (understand you don't want to spend / get delivered but these are $7 and available if like here in UK kind of in 2 days from eBay)

Re: best, safest and easiest way to connect pi 3 b+ with arduino uno

Posted: Sun Jun 14, 2020 8:00 pm
by AGID
I just want to communicate back and forth from rpi to arduino and vice versa and want to supply each device with its own power supply because as i mentioned before its big project and needs huge power supply for both. The project is big enough and i dont want to add any more components as well. i would prefer using USB A to USB B which is easiest option but if its safe to use it when both RPI and UNO are connected to power supplies at the same time.

Re: best, safest and easiest way to connect pi 3 b+ with arduino uno

Posted: Sun Jun 14, 2020 8:07 pm
by wildestpixel
You only need to wire into BCM14 and BCM15 of the pi from the opposing UART's of the Arduino then.

RX --> TX
TX --> RX

https://pinout.xyz/ for the Pi pinout

https://components101.com/sites/default ... iagram.png - for the Arduino using the most popular board as an example and looking at its PD0 and PD1.

All you have to do is have programs running either end that interact with the serial data.

A different concept with a raspebery pi and a micro:bit involved is referenced here https://arcanesciencelab.wordpress.com/ ... l-display/ but shows how a pi can interact over serial with another device by sending instructions (albeit micropython) to get collaborative functionality.

It should be safe to use both powered at the same time, just don't interpolate the power, only the comms, and remember Pi UART is 3.3v and may need a logic shift if you can't get it going on UART alone and need power.

I'd try to measure the actual power envelope of your Arduino side - depending on what pi you have and PSU (I reckon a Pi zero is enough right) you might have plenty in the loop.

You need to calculate all of this.

Re: best, safest and easiest way to connect pi 3 b+ with arduino uno

Posted: Sun Jun 14, 2020 8:12 pm
by AGID
wildestpixel wrote:
Sun Jun 14, 2020 8:07 pm
You only need to wire into BCM14 and BCM15 of the pi from the opposing UART's of the Arduino then.

RX --> TX
TX --> RX

https://pinout.xyz/ for the Pi pinout

https://components101.com/sites/default ... iagram.png - for the Arduino using the most popular board as an example and looking at its PD0 and PD1.

All you have to do is have programs running either end that interact with the serial data.

A different concept with a raspebery pi and a micro:bit involved is referenced here https://arcanesciencelab.wordpress.com/ ... l-display/ but shows how a pi can interact over serial with another device by sending instructions (albeit micropython) to get collaborative functionality.

It should be safe to use both powered at the same time, just don't interpolate the power, only the comms, and remember Pi UART is 3.3v and may need a logic shift if you can't get it going on UART alone and need power.

I'd try to measure the actual power envelope of your Arduino side - depending on what pi you have and PSU (I reckon a Pi zero is enough right) you might have plenty in the loop.

You need to calculate all of this.
You sure is it safe to use RX /TX with both devices when both have their own power supply connected and RPI 5v and UNO is 9v? also what about USB also when both power supplies connected 5v and 9v? is it safe ?

Re: best, safest and easiest way to connect pi 3 b+ with arduino uno

Posted: Sun Jun 14, 2020 8:19 pm
by wildestpixel
The UART on UNO is I think 5v, so you need to shift it to 3.3v, or connect UNO to PI via USB B --> Micro USB A and use the AMA TTY. Depends - if you have a Pi 1 or Pi Zero you should be able to power from the UNO if you are feeding it with a strong current source.

I would think if you have the know how on the program side , you will be able to appreciate what is needed on the electrical side (its much simpler than the device inter-communication by far!)

Re: best, safest and easiest way to connect pi 3 b+ with arduino uno

Posted: Sun Jun 14, 2020 8:29 pm
by AGID
I have pi 3 B+. still want to know if i connected UNO and pi 3 B+ through usb and both connected to different power supplies 5v RPI ans 9v UNO (without using level shifters or anything). will this be safe or dangerous on any of the devices and might cause damage.

Re: best, safest and easiest way to connect pi 3 b+ with arduino uno

Posted: Sun Jun 14, 2020 8:32 pm
by wildestpixel
Should be okay via USB on genuine UNO - only 5v can go through the regulator in front of it.

Re: best, safest and easiest way to connect pi 3 b+ with arduino uno

Posted: Sun Jun 14, 2020 8:43 pm
by davidcoton
AGID wrote:
Sun Jun 14, 2020 8:29 pm
I have pi 3 B+. still want to know if i connected UNO and pi 3 B+ through usb and both connected to different power supplies 5v RPI ans 9v UNO (without using level shifters or anything). will this be safe or dangerous on any of the devices and might cause damage.
USB is specified as 5V power and (whatever) signal levels -- should be compatible whatever power supplies are used. You may want to break the 5V connection to avoid back-powering one or the other. Or it might be possible to power the UNO from the Pi's USB -- every Pi with recommended PSU can supply 1A2 to USB/GPIO peripherals.

It is a different story through serial GPIOs. The Pi works with 3V3, not sure about UNO but most(?) Arduinos are 5V, so you will need level shifters.
Again the supply voltage is irrelevant, but you will need an 0V connection between the two systems if you have independent PSUs.

Re: best, safest and easiest way to connect pi 3 b+ with arduino uno

Posted: Sun Jun 14, 2020 10:54 pm
by drgeoff
I don't understand why "huge project" precludes powering the Arduino from an RPi USB.

Re: best, safest and easiest way to connect pi 3 b+ with arduino uno

Posted: Mon Jun 15, 2020 4:54 am
by MarkTF
AGID wrote:
Sun Jun 14, 2020 8:00 pm
I just want to communicate back and forth from rpi to arduino and vice versa and want to supply each device with its own power supply because as i mentioned before its big project and needs huge power supply for both. The project is big enough and i dont want to add any more components as well. i would prefer using USB A to USB B which is easiest option but if its safe to use it when both RPI and UNO are connected to power supplies at the same time.
Genuine Arduino Unos have circuitry which disables USB 5 Volts to the board if Vin is present, so you can use both simultaneously. This is generally, but perhaps not universally true of Uno clone boards. Thus the easiest way to connect RPi with Uno is via a USB cable.

https://www.arduino.cc/en/uploads/Main/ ... ematic.pdf