Controlling Brightness of Arduino LED Remotely Using PyQt and WiFi

In this lesson we will use PyQt5, UDP and WiFi to control the brightness of an Arduino LED circuit remotely. The PyQt generates a constantly updating sin wave, which it plots on a PyQt graph, and then transfers the brightness in real time to the arduino project. This lesson teaches many important skills including UDP, WiFi, PyQt5, Python, Arduino and LEDs.

When using the breadvolt, or any battery power supply on a breadboard project, do not turn the power supply on while the Arduino is connected to USB, as you could generate voltage conflicts. It is an either or. If the USB is connected, the power supply should be OFF. The schematic for the arduino circuit is shown below:

Schematic of our Arduino Uno R4 Wifi connected to an RGB LED

In the video, we develop code for the server, on the arduino, and the client, running in Python on the desktop. We present the code below for your convenience.

This is the Server code for the Arduino:

You will need to open a new tab, and save the following code as “secrets.h” with the program above.

On the Python side, this is the Client code: