Tag Archives: Python

PyQt Essentials for Absolute Beginners

In this Video Lesson we show you how to create a Graphical User Interface to allow you to interact with your python program and hardware projects. The GUI can have buttons, slider bars, radio buttons, drop down menus, and many more widgets. In this lesson we show you how to install the package, and step-by-step instructions on how to use it. For your convenience, here is the code we developed in the lesson.

 

Sending Data Over WiFi Between Raspberry Pi Pico W and Your PC

In this video lesson we show how we can send and receive data between the Raspberry Pi Pico W, and your PC. We will be running python on the PC, and we will exchange data using the UDP protocol. UDP is simple, and a very reliable way to send data packets back and forth. In this example, we will be demonstrating a simple Client Server relationship between the Pi Pico and PC using UDP over WiFi.

In this lesson, we will just be showing simple exchange of data, but in preparation for future lessons, go ahead and build this circuit.

Schematic for Circuit to Demonstrate a Client Server Example on Pi Pico

For your convenience, this is the “Server” software you will run on the Pi Pico.

Notice that the above code wants to load a “secrets” file that contain your WiFi name, and password

You should edit the code below with your WiFi username and your password, and then save the file in the Pi Pico lib folder, with the name secrets.py (don’t forget the .py)

Now, on the PC side, you will run your client, which will be run in Python. Here is the client software:

 

Library for Reading a 16 Button Keypad on the Raspberry Pi

In this lesson we show you how to create a Python Class and Library that allows you to easily get user input on a Raspberry Pi from a 16 button keypad. This will allow very easy interaction with the keypad.

The Library Code which we develop in the video is presented below for your convenience:

To use this code as a library, save it in the same folder as your python programs, and save it as KPLIB.py

 

This is a simple demo program that calls the library above, to receive input from the keypad.

 

Using an Arduino with Python LESSON 14: Model a Moving Marble in a Room Using Parameters


In this lesson we show how to model a moving marble in vPython. We show how to create an animation where the marble bounces off the left and righty walls of our virtual room. For your convenience, we include the code below:

 

Using an Arduino with Python LESSON 8: Live Thermometer 3D Visual Using DHT11

In this video lesson we connect the Arduino to a DHT11 temperature and humidity sensor. We show how to wire the device up, and then how to code the Arduino. The data is passed from the Arduino to python. We then create a live 3D thermometer model that updates as the temperature changes.

On the arduino side, this is the code which we use:

Then on the python side, we use the following code: