Category Archives: Tutorial

Getting Latitude and Longitude from the Adafruit Ultimate GPS with Raspberry Pi Pico W

 

In this video lesson I show how to get usable Latitude and Longitude from the Adafruit Ultimate GPS version 3 using the Raspberry Pi Pico W. We read the NMEA sentences from the GPS, we parse them into individual strings for each sentence, and then we create arrays of data from the strings. Then we begin to parse the arrays, and convert the confusing numbers into useful Decimal Degree values for Latitude and Longitude.

This schematic shows how to connect the Adafruit Ultimate GPS to the Raspberry Pi Pico W

For your convenience, this is the code we developed in todays lesson:

 

PyQt5 Project to Control Arduino RGB LED Over WiFi

In this video lesson we add slider bars to our PyQt Widget allowing us to control the color of an RGB LED over WiFi. 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. Or if you are going to connect the USB, first turn off the power supply. The schematic for the project circuit is shown below:

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

The server side code developed in the video is presented below:

Remember to add the secrets.h file by adding a tab to the project, as explained in the video.

And then on the client side, we have the following code:

 

Powering Your Raspberry Pi Pico W from Battery for Portable Operation

In this video lesson we discuss powering your Raspberry Pi Pico W projects from a battery, allowing portable operation of the project. Most all of our earlier lessons can be powered by battery, allowing the project to operate without being connected to the USB cable. In this lesson I discuss the important issues that must be considered when powering your project from battery, and particularly issues associated with powering your project from battery, but then needing to download the code. I want to explicitly explain how to do this in this lesson, so in future lessons when you see me with the battery connected to the project, you will know what I am doing.

To get started, I will demonstrate with this simple circuit, so go ahead and build this circuit:

Simple circuit to demonstrate a LED toggle

Then, we will be using this simple code:

In the video, we will explain the ins and outs of now powering a project like the one above using a battery supply. Note for now though, that the wire from pin 36 to the bottom power rail establishes that rail as a 3.3 volt rail, defined by the Pi Pico.

Now, if we want to power the project remotely, that is, remove the USB cable and power from the battery, we will need to supply a suitable voltage both to the nonblinking LED (The Blue One) and the Pi Pico itself.

You can power the Pi Pico by applying a voltage to the VSYS pin, which is physical pin 39. The voltage should be between 1.8 and 5.5 volts. So, we can  power the LED and the Pi Pico by connecting a suitable power supply. For our examples, I use the Sunfounder Breadvolt (AVAILABLE HERE).

However, when we connect the breadvolt to the breadboard, and we we intend to power the project by the Breadvolt, we need to adjust the wiring where instead of pin 36, we should connect pin 39 to the power rail. This is because in using the breadvolt as the power supply, it will define the voltage of the power rail, not the Pi Pico. The Pi Pico will be a USER of the rail, not the one who supplies voltage to it. So, to power the Pico, we need to connect pin 39 to the power rail instead of 36. So, in using the Breadvolt to power the project, we should use this circuit:

Notice that we now are connecting pin 39 to the Pi Pico

Now with this schematic, we can disconnect the USB, turn the breadvolt on, and  power the project (Pi Pico and the Blue LED) from the breadvolt.

Now the question arises, how would we now download code to the project? The bottom line is, it is never a good idea to have two different voltages supplies connected to the rail, or for that matter connected together. So, the simple solution is, turn the breadvolt OFF, before reconnecting the USB cable. Then download the code. Then disconnect the USB cable, and then turn the breadvolt back on.

What you will see, when the breadvolt is turned off, and the USB cable is reconnected to the project, VSYS will act as an output pin, powering the blue LED. Vsys pin is connected to the USB supply by a diode. There is a small voltage drop across the diode, so the voltage at the VSYS will be around 4.8 volts.

Please watch the video as we will be giving more specific examples of how to make this work.

Raspberry Pi LESSON 37: Raspberry Pi Security System


 

In this lesson we add an audible alarm to our security system. I am connecting to a Bluetooth speaker, and then using the pygame library to play an alarm sound. The pygame library will play any .mp3 file, so search the internet and find a suitable alarm sound for your system. I amusing an air raid siren, and really like it! Below for your convenience is the code we develop in this video:

 

Improved Gesture Recognition in Python and MediaPipe

In this video lesson we show you how you can improve the accuracy of your gesture recognition program developed in the last lesson. We do this by normalizing the hand landmarks distance matrix to a standard size. By doing this, you get accurate results independent of the distance your hand is from the camera. For your convenience, I include the code below which we develop in this lesson. Enjoy!

 

s lesson. Enjoy!