Hi
I asked someone a while ago on how to connect an arduino and a raspberry pi together, so that a button press on the Arduino would result in a file playback on the RPi.
The answers I got on this matter was that the Uno and the RPi could not directly be connected together because the HIGH signal on a RPi is just 3.3V and the HIGH on the Arduino is 5V.
So that would not work, and I've tried finding voltage levelers in Norway but I could not find any that would suit my purpose, so I am left ordering from China.
Thing is, I really need this to work before I receive this parcel. I tried connecting ARduino to RPi on USB and it worked to some extent, the problem is they are going to be a little farther away so I think wireing would be better.
Now here is my idea:
Could I wire the Uno and the RPi together on 5V supply(connect the Arduino to a regulated 5V supply through the UNO's 5v port. They would then also share ground on this 5V power supply.
THEN, how about I also add a relay which I have lying around (One channel 5V relay for Arduino) to the loop in this manner:
Vcc - To 5V regulated along with Uno and RPi
Gnd - Obviously to GND
Signal - to random Arduino digital pin.
And,
C(common) to Arduino 3.3V port
NO to RPi GPIO pin?
Would this then work the way I want it to? When say D10 pin receives a LOW signal, the Relay will flip, sending power from 3.3V on the Arduino to the RPi's GPIO4 pin?
Or will this for some reason end up frying one or both of my microcontrollers?
If I code the RPi something like this?
import pygame.mixer
from time import sleep
import RPi.GPIO as GPIO
from sys import exit
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.IN)
pygame.mixer.init(48000, -16, 1, 1024)
snd = pygame.mixer.Sound("game.wav")
soundChannelA = pygame.mixer.Channel(1)
while True:
try:
if (GPIO.input(4) == True):
soundChannelA.play(sndA)
The reason I can't just use the RPi as my main console is that there are numerous other things connected to the Arduino, like a LCD display, several buttons that work as a keypad, another relay etc. etc. etc.
What do you think? Is it possible?