Controlling relays via Raspberry Pi and Arduino Uno

Currently, I have a system of solenoids which I turn off and on to water different sections of my garden. Water is provided from a bore, and the switching is controlled by a Raspberry Pi which sends its messages to a controller provided by Ocean Controls. The Raspberry Pi is in the bore house itself and it received its instruction by wifi from my PC located in my office. A beautiful automated system.

I have found the controller from Ocean Controls expensive and easy to “break” (usually my error). I have considered, and actually started using the Raspberry Pi (via a Python program) and relays attached by a bridge (not sure of the terminology) which sits upon the Pi and drives four relays. All this equipment is available from Core Electronics. Unfortunately I need 8 (at present) relays.

Enter perhaps the Arduino Uno. I should be able to replace the controller from Ocean Controls with one of these units. My question can now be put. given that I have written the Python program that runs on the Pi, can I send data via the Pi serial port to the Arduino Uno to switch the various relays I would attach to the Arduino?

Interesting that you ask this question when I am considering a similar connection.

If the Pi and Arduino are close to each other, I would look at the following.
Using I2C in my opinion is a more elegant solution and leaves the serial ports free.
I would also definitely use a level converter between the Pi 3V3 pins and Arduino 5V pins.

This is what I plan to do to connect the Pi and Arduino. (still in planning phase)

Serial would work too, but it seems a bit more messy when debugging software.
I found web links where someone had a Pi running the Arduino IDE to program the Arduino.


PS suggest looking at a number of sites, some information can be contradictory.

1 Like

Hi Harry,

You can absolutely control an Arduino for the Pi over serial! This is a very desirable setup, as its generally easier to drive things like relays from the Uno operating at 5V.