Raspberry Controlling Arduino

Hallo there,
I am new here and have a Problem that seems to be not discussed, or I was too stupid to find the Solution.

I created an Octoprint image on a Raspberry Pi 4 (4GB) which control two instances for two printers (like Chris Riley did in his Youtube-Video (https://www.youtube.com/channel/UCqRiv7rQuxge63bqJ2hVNUQ)).

I also build a casing for each printer. Each has a Temperatur- and Humidity Sensor witch sends the values to a Arduino Nano. The Nano works with the Values to control a Fan for each printer, a dehumidifier and a fan heater for each printer. To manage and control the lower and upper limits of the values (and also some programs like "cleaning" -> fans 100% and display some Values) that are triggering the fan, dehumidifier, ... I installed a 16x2 Lcd with menu controlled by a Joystick.

The joystick leads via y-axis thru the menu, the button-function select the actual shown value/option, and the x-axis defines in some points the values.

I would now like to integrate this Menu and its control to Octoprint. I think the easiest way to show the menu in Octoprint would be another Webcam which shows the LCD from the Arduino. To use 2 Webcams (switching between them) I think is already a Plugin available.
But I still need a solution to control the menu, probably a digital alternative to the Joystick would be the best way...
So I would say in the tab "control" I would need another Set of "direction arrows"(see picture to know what I mean // whatever is the correct English naming this is :slight_smile:) like the one for the X/Y axis from the printer right there.
How to look in Octoprint|246x256

I tried some plugins like the "Enclosure Plugin" but that won't work out like I need it (or I am just again too stupid for it). There five "buttons" should den work as a button that gives out a signal as long as its pressed, this signal should than "come out" of one of the GPIO Pins and go to the Arduino. The work in the Arduino IDE to make this signals work as a joystick - digital - alternative is not element of this problem, that I can solve myself.

Soooo... I would be very happy to receive your advice, tips and suggested solutions. And I hope my broken English is good enough to understand :sweat_smile:. And also be gracious to me, I really searched a while and I am not that lazy person.
And for sure some more informations about soft- and hardware:

Printer 1: Anycubic i3 Mega S
Printer 2: Anycubic Chiron
Raspberry: Raspberry Pi 4 (4gb)
OctoPrint Version: 1.4.0.
Webcams: For now not given, because of Corona-prices :sweat_smile:
Arduino: Elegoo Nano (no problems with that)

A Raspberry Pi can talk to an Arduino over a serial connection, for example.

In this case, you might have to disable Bluetooth and "console use of serial"... or just limit the speed of your serial connection to the Arduino to 2400 baud.

BOARD pins 8 (TXD) & 10 (RXD) on the Pi need to be connected to Arduino pins 0 (RX) and 1 (TX) so that the TX on one side goes to the RX on the other end of the wires. Add a ground wire between BOARD pin 6 on the Pi to GND on the Arduino.

But that's just wiring. You would then need to write some code which talks using a serial library. On the Pi side, you'd likely have Python code and on the Arduino side, it's likely C. But it is possible to have a Pi control the Arduino like this for a project.

Alternatively, if the Arduino has a wifi or Bluetooth add-on, this could be a different way of communicating between the two.

Another way would be to put a PiFace hat on the Pi so that a relay on this might be inline with something going on in the Arduino's external circuits.

You could add an OSEPP joystick to your Arduino.

Hi, big thanks for the fast reply!

Yeah i have already thought that the serial connection would be a good way, but I think this would be not that easy... My biggest fear is to code "next to" the OctoPrint system and destroy something, because I never coded a Pi or such in this Python, Raspbian thing .. I liked my idea the most because it sounds simple and archivable...

Have you any link or something to a similar task, like programming a "button"- in the Octoprint interface wich "able/disable" a GPIO? Because the creating of these buttons is a big ? in my head.

The wifi idea sounds good, but how do I manage Octoprint for this?

Why do you mention this specific joystick? I have already one in use, is this something special?

The forum has a search feature which works pretty well if you know what you're searching for.

Adding wifi to the Arduino means that if it connects to your home zone then it has an IP address. So now some Python code on the Pi could talk to the Arduino over TCP/IP. This could be all sorts of connections. And yet, there's now some pair of code (Python/C) which must be written on both ends.

The OSEPP joystick is one of perhaps several that are Arduino-compatible. What's nice about a name-brand joystick is that OSEPP will likely have a tutorial which helps you figure out how to make it work.