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. We use the following circuit:

This demonstration circuit controls servo position by two push buttons

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

 

Create a Simple Client Server Connection Over WiFi to Connect Arduino to Python on the PC

In this video lesson, we show how to create a simple Client/Server connection over WiFi. We connect the Arduino Uno R4 WiFi to Python running on the PC. The arduino is the server, and the PC Python program is the client. We show how to pass data from the PC to the Arduino, and then how to pass data from the Arduino back to the PC. With this simple framework, we can control Arduino projects from our desktop PC, and we can use the PC to display data being taken from the Arduino.

In this lesson we develop code for Arduino, and the code in Python. For your convenience, we present the code below.

On the Arduino Side, this is the code to create the ‘Server’.

You also need to add a tab to your program using the ‘Add Tab’ feature of the IDE. The program in the tab should be named secrets.h

Your secrets.h file should look like this:

You can run the program above, and it should connect to your WiFi, and should print out the Arduino’s IP address. Make note of the IP address as it will be needed in the Client program below. On the PC side, this is the python code to create the client:

 

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:

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:

 

 

Control DC Motor With Raspberry Pi Pico W and TA6586

In this video lesson we show you how you can control a small DC motor using the Raspberry Pi Pico W and a TA6586 DC Motor Controller. We show you how to control both the speed and direction. The schematic for the circuit we use is here:

Schematic for TA6586 and Raspberry Pi Pico DC Motor Control

In the lesson, we developed the following code for your convenience:

 

Improved PyQt Color Wheel Project

In this video lesson we improve last weeks project by making the PyQt widget more virtual. The PyQt widget generates 3 sine waves, one for the Red color channel, one for the Green color channel, and one for the Blue color channel. The three sine waves are displayed on the widget. You are then given the opportunity in the widget to scale any of the three color channels. This allows you to calibrate your RGB LED in case any color channel is dominating. The widget also features a “Chase” mode where you can introduce phase injection into any of the color channels. This causes one or more of the color channels to “chase” the other ones. In this version, we preserve the phase as we turn the chase mode on or off. We also add buttons at the bottom of the widget to show the composite color being generated, as well as the individual R, G, and B color channels. This is the circuit schematic we are using on the Pi Pico side.

Circuit Schematic for Connecting the RGB LED

This is the code we developed to run on the Pi Pico side. It is the server side.

You need to create this file, and save it as “secrets.py” in the lib folder of your raspberry pi Pico.

And finally, this is the client side program which will run on your PC.

 

Making The World a Better Place One High Tech Project at a Time. Enjoy!

Exit mobile version