so I'm working on communication between arduino and RPi via GPIO pin.
It's basically connecting them by using a cable jumper. So I have a 2 channel relay shield attached to my arduino, and I've been wondered how do I connect them to RPi. I need help for this problem, any advice would be appriciated. I'll post the GPIO pin below.
Thankyou

-
Do you really need the arduino? you can attach the relays to the rPi directly.ratchet freak– ratchet freak2017-11-10 13:18:11 +00:00Commented Nov 10, 2017 at 13:18
-
1@ratchetfreak Thankyou for your answer, yes I do need the arduino, the relay is attached on my arduino, you can attach the relay to RPi by using the cable jumper, but I don't really know how it workdbz– dbz2017-11-10 13:21:15 +00:00Commented Nov 10, 2017 at 13:21
-
Why not just use the serial cable? Have you considered using the Raspberry Pi to program the Arduino then for communications also? That's what I do for my solar plant modults.SDsolar– SDsolar2017-11-12 00:26:43 +00:00Commented Nov 12, 2017 at 0:26
2 Answers
I assume you are using Arduino UNO. Pi's digital logic is at 3.3 V and that of Arduino Uno is at 5 V. Anyway to send data from Pi to UNO, you can connect the pins directly. UNO can recognise both the logic levels of Pi's output. But to receive data from UNO to Pi, make sure you build a voltage divider using resistors, that brings 5V output from UNO's pin to 3.3 V. Also the grounds of both Pi and UNO should be connected to each other.
-
Thanks, I really appreciate it. The thing is I've attached relay channel shield on top of my arduino. So i just connect them like RPi pin 1 to Arduino GND 5v Like that?dbz– dbz2017-11-10 13:32:35 +00:00Commented Nov 10, 2017 at 13:32
-
why are you using relay shield?Mitu Raj– Mitu Raj2017-11-10 13:43:23 +00:00Commented Nov 10, 2017 at 13:43
-
@tbh Using relay shiled so i can attach another device called xbee(cc2530) for wireless transmissiondbz– dbz2017-11-10 13:52:22 +00:00Commented Nov 10, 2017 at 13:52
-
2What on earth does a realy shield have to do with connecting an xBee? I think you are a little confused about what you actually want to do and are suffering from a severe case of xy-problem.Majenko– Majenko2017-11-10 14:09:59 +00:00Commented Nov 10, 2017 at 14:09
-
1@MITURAJ thankyou , i really appreciate that, also thanks for your time for spending in heredbz– dbz2017-11-10 14:54:07 +00:00Commented Nov 10, 2017 at 14:54
What you are asking really makes no sense at all.
You are starting from the mid-point of your project and wondering how to communicate using bare GPIOs without really knowing what it is you want to communicate and what you want to do with that data - or at least you haven't made any of that clear to us.
It is unclear what you want to do with the shield from the Pi. Do you want to control the relays on it by sending instructions from the Pi? Do you want the Pi to send and receive data through the XBee? Either way the Arduino is pretty redundant in the system and in fact gets in the way more than is useful.
If it's just relays you want then it would be far simpler to wire cheap relay modules direct to the GPIOs of the Pi - then you don't have to worry about "how to communicate" - you just turn the relays on and off.
If you want to communicate with the XBee there are far simpler shields available that will plug directly into a Pi. Indeed, there are some good shields around for the Pi ("Hats" I think they call them) which give you an Arduino footprint and an XBee socket together.
The Arduino is completely pointless in this system. And anyway, if you wanted to make the two systems communicate there are far easier ways than with bare GPIO pins. Serial, for a start. The simplest ever method is to just plug the Arduino into the Pi's USB. That way it gets power and data all in one go. Just like using it with a computer.
