Uncategorized

rpi arduino communication

Asked 
Active today
Viewed 33 times
2

I have Pi4 on a UPS and a 3.3 volt Arduino (Nano 33 IOT) supplied without a UPS protection.

I am designing a system where Pi monitors a 3.3V Arduino pin to know if there is a power outage (and shut down orderly if needed). Upon power return, Arduino would detect if Pi is off (by monitoring the 3.3V Pi pin) and briefly open the Pi power supply circuit to reboot the Pi. The Arduino-Pi connections diagram is below.

Pi-Arduino connection

Is it safe to connect the a GPIO Pi pin directly to the Arduino’s 3V3 pin, and vice versa as depicted in the schematic? Or should I have a 220 Ohm resistor between the Pi’s GPIO and Arduino’s 3V3 pin and between the Arduino’s D and Pi’s 3V3 pin?

  • Please confirm if you think my redrawn schematic is OK, before I move on. Cheers. – tlfong01 8 hours ago   

3 Answers

1

Whatever you do yo must not connect things directly. Us a resistor between these power source connections. The Arduino will be ok. But the rpi will burn if anything goes wrong. Use the analog reading codes for both end to read the voltages.

1

First the diagram you listed will NOT WORK and risks damaging either or both devices.

If you want to directly connect devices they MUST use a common reference. This is normally the 0V pin/s (often incorrectly labelled Gnd).

It is “safe” to connect a 3.3V logic device to the Pi, and you could connect 3.3V power pins (although I would NOT do this).

If you want to connect I suggest you use a series resistor, although it is better practice to use a voltage divider. This avoids problems due to any differences in nominal 3.3V voltage.

Any voltage >2.2V will definitely be detected by both the Pi and 3.3V Arduino.

0

Question

Rpi and Arduino checking each other’s power failure

(1) Rpi monitors Arduino’s 3V3 power failure and orderly shuts down Arduino (but isn’t it too late?)

(2) Arduino monitors Rpi’s 3V3 power failure and reboots Rpi (but even Rpi freeqze, 3v3 might still be alive!)


Answer

The design seems to have a problem. But let us first check if the following schematic agrees with the OP’s requirement.


power outrage 1

Notes

(1) The two resistors in series with GPIO are for current limiting protection. For example, if Rpi GPIO accidentally set to output mode and output High, and Arduino side is Low, then limiting current will be 3V3 / 470R = 7 mA.

(2) The two grounds must be shorted together, to make a “common ground” zero voltage reference (Ref 2, Appendix J of my answer).


(1) The design is in two parts:

(A) Rpi monitoring Arduino,

(B) Arduino monitoring Rpi.


Part A looks OK.


Part B seems confusing. If Rpi is powered by UPS. Then Rpi’s 3V3 power should always be alive, even if OS freezes.

So it is better to use a watchdog timer to monitor if Rpi freezes and reboots it. See Ref 1 for more details about watch dog timer.

And if a watchdog timer is used to watch if Rpi freezes, and reboots it, Arduino needs not do anything.

/ to continue, …


References

(1) How to monitor if a remote Rpi freezes and reboots it, using a watchdog timer or otherwise – rpi.stackexchange forum discussion

(2) Rpi GPIO Push Button Circuit Grounding Problem (Appendix J – Ground/Common Definitions)

/ to continue, …


End of Answer

shareeditundeleteflag
deleted by goldilocks 1 hour ago

Why was your post deleted? See the help center.

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: