Control Arduino with a GUI on a Raspberry Pi 4

I am trying to access my new Arduino Uno R3 through a GUI on my Raspberry but couldn't find a tutorial or something.

Has anyone ever done something like that?

Thanks for the answers!

Welcome to the forum

What do you mean by "access " ?
Do you want to write to it, read from it or something else ?

Well maybe access was the wrong word to use. I meant, that I could tap on one of the buttoms shown on the GUI on the Raspberry Pi and the Arduino does something.

Is this explanation better?

That's clearer. What sort of thing would the Arduino do ?

There are a number of possible hardware interfaces available between the Pi and the Arduino such as serial, I2C and SPI. With a suitable add on board for the Uno you could also consider using Ethernet or WiFi or even running a webserver on the Uno itself thus removing the need for the Pi

How are you at coding Python, HTML and C/C++ ?

Well the Arduino is currently conncted to the Raspberry with the USB cable which is delivered with the Arduino. I think that connection works but i dont really know if and how the GUI works with it.

And about what im planning to do. Well the final project will be controlling multiple engines but first just some LEDs.

It sounds like your first challenge will be to write the GUI for the Pi, but that is something that I know little or nothing about but others here will probably be able to provide help

1 Like

Okay thanks for your help!

Have a good day!

you should be able to plug the arduino into a USB port on the pi and it will appear as a serial port under devices - then try running a terminal emulator on the pi - you should be able to communicate with your program running on the Arduino in a similar way to the serial monior

if that works you can then implement a program (I would use Java but C++, Python, etc are similar) to open the port, communicate with the program running on the Arduino and present information on the GUI

Take a look at the Firmata project and see if that is helpful.

here is a screen dump of a terminal emulator implemented in Java jSwing using the jSerialComm library

the USB cable of a NodeMCU ESP8266 device is plugged into the pi and appears as device comPort[0] - it is running a webserver which when connected displays a slider the output of which can be seen

Or just run the Arduino IDE and use the Serial monitor

updated Java GUI code to display BME-280 sensor data from a ESP32

the left hand TextBox displays the serial data from the ESP32 which is parsed to set the TextFields on the right
as well as displaying the BME-280 data there is a button which when clicked switchs a LED on the ESP32 ON/OFF
Edit: the advantage of using Java is the same program run on Windows PC, looks exactly the same and without modification

the ESP32 is also running a webServer to display the BME-280 data

Node-Red

Thanks for all the answers!

In the Arduino IDE the Port where the Arduino is connected is: "/dev/ttyACM0 (Arduino)" and "/dev/ttyAMA0"

Which one is the one i should use?

The one that works :grinning:

1 Like

when I plug in a Arduino into a RPi USB I see /dev/ttyUSB0

root@hotspotpi:~# ls /dev/ttyUSB*
/dev/ttyUSB0

my Java program scans for COM port then gives me list which I can select using a menu

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.