Category Archives: MicroPython

Incorporating an Adafruit Ultimate GPS into your Raspberry Pi Pico W Project

In this video lesson we will show you how to connect and begin to get data from your Raspberry Pi Pico W connected to an Adafruit Ultimate GPS. The circuit schematic presented below. Notice Tx on the Pi Pico goes to Rx on the GPS, and Rx on the Pi Pico goes to Tx on the GPS.

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

Then this is our initial code which reads the data from the GPS one byte at a time and prints it. In future lessons we will explain how to get useful information from this data, but for now, this code will allow you to read the data:

 

Storing Mission Critical Data in Flash Memory on the Raspberry Pi Pico W

In this video lesson we show how mission critical data can be saved in Flash Memory on the Raspberry Pi Pico W. There is just 2 MB of flash memory available, and the flash memory is only specified for 100,000 write cycles. This means we must be careful and deliberate in when to use flash memory, and it should not be used as a general purpose data logger. For example, if you wrote a memory location once a second, you could reach cycle limit in a few days. However, storing things like calibration data, user preferences and so forth are excellent uses of the memory.

In order to demonstrate this capability, we will show a program where the position of the servo is saved in a .json file in flash memory. If power is lost, the program goes and reloads the last position of the servo from the .json file, and then proceeds from there.

When using the breadvolt, or any battery power supply on a breadboard project, do not turn the power supply on while the Raspberry Pi Pico 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.

We use the following circuit:

servo control
This demonstration circuit controls servo position by two push buttons

We also include the code developed in this lesson below for your convenience:

 

Control Raspberry Pi Pico PIO State Machines in a Micropython Class

In this video lesson we show how you can control a PIO State Machine on the Raspberry Pi Pico W inside of a micropython class. We demonstrate with the practical example of controlling servos with a servo Class which we create. The objective is to ‘hide’ all the complex code in the class, allowing less adept users to interact with the servo with simple python commands. For your convenience the code developed in this video is included below. Enjoy!

 

Using Multiple Raspberry Pi Pico PIO State Machines at the Same Time

In this video lesson we show how you can work with more than one state machine at the same time in microPython on the Raspberry Pi Pico W. We show this in the context or controlling multiple servos. We show different ways to utilize multiple state machines. For your convenience, we provide the code developed in the video below. Enjoy!

 

Sweeping Servo Position Using the PIO State Machine on the Raspberry Pi Pico PIO State Machine

 

In this video lesson we show how you can use the Raspberry Pi Pico PIO State Machine to sweep a servo through its full range of motion. The video will take you through things step-by-step. For your convenience the code developed in the video is included below. Enjoy!