All posts by admin

Measure Distance Using the HC-SR04 Ultrasonic Sensor on the Raspberry Pi Pico

In this Video Lesson I will teach you how to use echolocation to measure distances. We will use the HC-SR04 Ultrasonic Sensor, and will use the Raspberry Pi Pico W. We will explain how echolocation works, and show you how the sensor works. We will do the math, and then create the code for making measurements.

 

Using the SSD1306 OLED With an Arduino

In this Video Tutorial we show you how to incorporate the SSD1306 OLED into your Arduino project. This is a versatile, low power display that makes it easy for you to incorporate a nice display into your Arduino projects. For this project, we connect the OLED via I2C. The schematic for our project is presented below:

SSD1306 OLED

Our physical build looked like this:

I2C SSD1306 OLED

The video above shows in depth description of the code development, but for your convenience, we include the code below.

 

Controlling NeoPixel Array on PIO State Machine on Raspberry Pi Pico

In this video lesson we show how neopixels work at a fundamental level, and show how you can use the Raspberry Pi Pico State Machines to control the neoixels. Neopixels are an excellent example for showing the importance of the pico state machine. The neopixels demand precise timing and sequence of bits to operate properly, and that precision can not be achieved in python. The video explains how the State Machines can be programmed to control the neopixels.

For your convenience, the code is included below.

 

Raspberry Pi Pico PIO State Machine IRQ Interrupts and Handlers

In this video lesson we learn how to use and handle multiple IRQ interrupts using the Raspberry Pi Pico PIO state machines. We demonstrate this by using 3 LEDs, controlled by three separate buttons. We show how to set, clear, and wait on IRQ interrupts. We show how to use blocking and no blocking interrupts. In this video lesson, we use the following circuit.

Circuit Schematic for Button Control LED Interrupts

For your convenience, the code we develop in the video is presented below.

 

Raspberry Pi Pico PIO State Machine IRQ Interrupts

 In the video lesson above, we show how to incorporate IRQ interrupts on the Pi Pico PIO State Machines. The state machines will monitor the buttons, watching for button presses. When a button is pressed, an interrupt is set. That interrupt can then be used by that same state machine, a different state machine on the same PIO, or in the main micropython program. Our first example will be to toggle the LED in the main python program, based on the interrupt from the state machine. In the second example, one state machine monitors the button, and the second state machine controls the LED. This is a schematic for the circuit we will be using.

Circuit Schematic for Button Control LED Interrupts

This first code controls the LED from the main python program.

This next program uses only the state machines. Interrupts and LED control are both done in the state machines.