Tag Archives: PyQt5

Remotely Control a DC Motor Over WiFi With Raspberry Pi Pico W

In this video lesson I will show you how you can control a remote DC motor using your Raspberry Pi Pico W. The Pi Pico is set up as a server, and is connected to a DC motor, and TA6586 Motor Controller. The motor is controlled by a client Python program running on your desktop PC. On the client side we create a Graphical Widget, which will allow you to control both the speed and direction of the motor. the schematic for the Raspberry Pi Pico W side is shown below:

Motor Controller
Schematic for TA6586 and Raspberry Pi Pico DC Motor Control

Then in the video, we developed the following software for the server side on the Pi Pico

Then for the client side, the following program runs on Python on your PC:

 

 

PyQt Generates a HSV Color Wheel on Raspberry Pi Pico Over Wifi Project

 In this video lesson we create an interesting project. We create a PyQt Window which  used 3 Sine Waves offset from each other by (2*Pi/). By offsetting the Sine Waves each by this amount creates 3 waves perfectly spaced across the domain. We then use the values from these sine waves to create the Red, Green and Blue values for the HSV color wheel. The x axis represents angle, in radians. Then the values of the sine wave represent the corresponding Red, Green, and Blue values. The program graphs the three waves on the PyQt widget, then passes the data via UDP over WiFi to the Pi Pico. The Pico then applies the values to the RGB LED.  We save the server side program on the Pi Pico as main.py, and power the project with the Breadboard Power Bank, meaning the Pi operates remote and untethered, and the LED is controlled by the desktop client software. This is a schematic of the Pi Pico circuit for the project.

RGB LED
Circuit Schematic for Connecting the RGB LED

This project has a server running on the Raspberry Pi Pico, and a Client running on your desktop PC. Here is the code for the server side for the Pi Pico.

Remember you must set up your ‘secrets.py’ file for your WiFi name and password. Create this file, put in your WiFi name and password, and then save the file on your Raspberry Pi Pico in the lib folder.

Then the code below is the program we developed for the client side. This will run on your PC.

 

Plotting Live Data in Python Using PyQT

In this video lesson we show how Live Data can be plotted using a PyQt window. Our eventual goal is to bring in live data from the Raspberry Pi Pico W using UDP over WiFi, but to learn the concepts today, we will be generating a live sin wave to show how the plotting works. Here is the code we developed in this lesson: