Raspberry Pi Pico

News

Contact:

Send email to ted_rossin  at  yahoo

Note: When downloading files, click the circled icon at the top of the new page to retrieve the file.

Basics

raspberrypi.com/products/raspberry-pi-pico

Libraries

Projects

Web Server (on-the-fly) in C++ using Pico W

Pico W Projects:  WebDemos.zip (V1.0 7-01-2023 to 7-03-2023) also need Lib.zip

Documentation: PicoWebserver.pdf (V1.1 7-20-2023) 

Schematic: None.  Works with bare board.

This is a collection of six example projects that go from simple (boring text[WebSimple]) to more complex (real-time  graphs of the processor temperature [WebAjax2]) that serve up web pages using the Pico W.  The projects are in C++ and use a WebServer class that is found in the Lib.zip package.  The WebServer class uses LwIP to move data between the client (web browser) and the server (Pico W) in a way that allows web pages to be created on the fly using real-time data.

Seeed Studio OpenGL on OLED display

Pico Project:  OLEDrnf2.zip (V1.2 5-17-2022 to 8-23-2022) also need Lib.zip

Schematic: PicoSeeedOLED.pdf (V1.0 9-03-2022).

This is the same code as OLEDrnf2 except it and the I2C library have been modified to work with the tiny Seeed Studio board.  Makefile.txt has a line that needs to be uncommented that has SEEED_PICO=1 in it at the end of the file.

SD Card File System

Pico Project:  SdFileSystem.zip (V1.0 8-17-2022)  also need Lib.zip .

Schematic: PicoTFTwithSD.pdf (V1.0 8-09-2022)

This project demonstrates a file system by implementing a tiny UNIX like shell using a serial port and SD card plugged into a TFT display socket.  Commands implemented are:

   ls, cd, pwd, cat, new, cp, rm, mkdir, date, setdate, df, unmount, mount

TFT Digital Picture Frame

Pico Project:  TftPicFrame.zip (V1.0 8-11-2022)  also need Lib.zip 

Tools:  

Schematic: PicoTFTwithSD.pdf (V1.0 8-09-2022)

This project implements a small digital picture frame using a TFT display.  Note that the pictures above are from the finished product made with a PIC processor but the the Pico project behaves the same.

TFT GUI (Widgets and OpenGL in a window)

Pico Projects:  also need Lib.zip

Tools:  

Schematic: PicoTFT.pdf (V1.1 2-29-2022)

These projects demonstrate how to use the visual GUI creator tool to make basic (a few buttons) to complex projects (multi-window OpenGL animations).  Check out the video above to get an idea of what is possible.

Note that for non-3D GUI code no extra definitions are required in the CMakeLists.txt file.  For wireframe OpenGL GUI code the following is needed to set some #define values:

target_compile_definitions(${PROJECT_NAME}  PRIVATE

    VEE_PAYLOAD_SIZE=4 # Can be 4,3,2 or 1 byte per word or not included

    VEE_VALID_BUFFER_MARKER=0x1861 # can be any 16 bit number or not included

    TFT_OGL_WINDOWED=1 # required for 3D graphics in a window

    PICO_MALLOC_PANIC=0 # Allow malloc to return NULL instead of killing program

)

The VEE_* lines are optional.  By default, the virtual EEPROM code uses a payload size of 4 bytes but the calibration code works with a size of 1,2,3 or 4 bytes so this can be set to any size the is good for the application if it will store other values.  If no other values will be saved, leave it at 4 as that is the most efficient size.  The VEE_VALID_BUFFER_MARKER should be different for each application so that values from a previous project loaded into the Pico are not misinterpreted.

VEEPROM (Virtual EEPROM)

Pico Projects:  Veeprom.zip (V1.0 6-07-2022) also need Lib.zip

Schematic: Just software

This project uses the library files Veeprom.c and Veeprom.h to exercise a virtual EEPROM implemented in flash memory.  The algorithm used is based a Microchip application note AN1095.  The goal is to increase the endurance over that of flash memory and to use much less flash memory than one sector per word to be stored.  The project includes a terminal based interface to test the code by writing random data to random addresses and then reading it back to check the results.  I've had no problems writing 100,000 32-bit values to multiple Picos and using just two sectors of flash.

Compile time constants that can be changed are listed below.  If these values are not overridden in the CMakelist.txt (target_compile_definitions [see the CMakelist.txt of the project for an example]), default values are defined in the library file Veeprom.c.

VEE_PAYLOAD_SIZE

Size in bytes of the word to be stored.  Must be 1 to 4

VEE_VALID_BUFFER_MARKER

Random 1 to 4 byte value (set by VEE_VALID_BUFFER_MARKER_SIZE) to mark a valid buffer.  This value should be different for different applications so that stale data from an old app loaded into a Pico is not used in a new one.

VEE_ERASED_BUFFER_MARKER

0xff, 0xffff, 0xffffff or 0xffffffff depending on VEE_VALID_BUFFER_MARKER_SIZE

VEE_VALID_BUFFER_MARKER_SIZE

Size in bytes of VEE_VALID_BUFFER_MARKER

VEE_NUM_SECTORS_PER_BUFFER

Number of sectors to use per buffer (which there are two) to store the data.  The default size is 1.  This should only need to increase if planning on doing millions of writes or hacking the code to create a payload size way greater than 4.

TFT Display Fun

Pico Projects:  also need Lib.zip

Schematic: PicoTFT.pdf (V1.1 2-29-2022)

These projects are similar to the OLED projects except using a larger color display.  The display is a 320x240 Elegoo 2.8 inch TFT display. Tft3d1 is the same as OLED3d2 except more points on the ring.  Tftrnf2 is identical to OLEDrnf2 except it uses the OglTft instead of OglOLED library of functions.  The animations and models in Tftrnf2 are the same files as OLEDrnf2 which were produced with Create3D.

Currently, only using one core of the Pico since there is not enough RAM to implement double buffering.  The performance is similar to the OLED code.

3D Graphics from Create3D using OpenGL on OLED Display

Pico Project:  OLEDrnf2.zip (V1.1 5-17-2022 to 7-08-2022) also need Lib.zip

Schematic: PicoOLED.pdf (V1.0 2-21-2022)

This project builds on top of the OpenGL on OLED Display code to play animations of models produced by Create3D.  This is a free tool I wrote using HP UNIX graphics workstations [HP-UX] back in the early 1990s.  I ported it to Windows in the late 1990s and added a few features here and there.  Years ago I was a 3D graphics hardware designer at HP and liked to make demos to show off our hardware.

3D Graphics using OpenGL on OLED Display

Pico Project:  OLED3d2.zip (V1.1 4-24-2022 to 5-26-2022) also need Lib.zip

Schematic: PicoOLED.pdf (V1.0 2-21-2022)

This project implements a subset of OpenGL and GLUT to drive a tiny 128x64 pixel I2C Organic Light Emitting Diode display.  The main core handles the application, 3D transforms, 3D clipping, perspective divide and line drawing while the 2nd core handles updating the display and clearing the frame buffer for the next image.

The same application code that is running on the Pico compiles and runs the same on Windows (using Visual Studio 2022 and freeglut from sourceforge.net).

OLED Display

Pico Project:  OLEDDisplay.zip (V1.1 1-21-2022 to 3-28-2022) also need Lib.zip

Schematic: PicoOLED.pdf (V1.0 2-21-2022)

This project displays animated text and graphics on the display.  This uses the OLED128x64 file in the library Lib.zip which can be found above.

Servo Control

Animation/Control Editor

Pico Project:  Servo2.zip (V1.0 1-21-2022) also need Lib.zip

Schematic: PicoServoController.pdf (V1.0 2-22-2022)

Windows Code: ServoCnt.zip

This project controls up to 16 servos with spline curve control to allow smooth transitions between key positions.  This code is used with Windows based software to control a robot arm like 3D graphics animation using key frames.  This uses the Serial file in the library Lib.zip which can be found above.

The video above was done using the PIC18F1330 version (see the PIC page) of the servo controller but the PICO version behaves the same.  I just have not made a new video.