Introduction: MAKER PI PICO Workout and Data Logging

About: Retired teacher of computing - started 1967 with FORTRAN IV. I now play with development boards such as Raspberry Pi, Pico, Arduino, micro:bit and Adafruit CircuitPython boards like the Insybitsy M4 and Circui…

After my previous Pi Pico Instructables Cytron.io offered to send me an example of their new board for review.

This component packed board from Malaysia has a Raspberry Pi Pico embedded at its centre, soldered on via the castellated connections. The board arrived wrapped in an anti-static bag inside a neat blue carboard box with a very useful double sided pinout card with the Maker Pi Pico board on one side and the Pi Pico on the other.

The wealth of add-ons included on the board are:

  • RUN button to GND, missing from the bare Pico
  • Clear labels on all the pins - much better than on a bare Pico - very useful
  • Power indicator LED - green
  • Blue LEDs on all the I/O pins
  • Vertical male connector pins on all I/O pins
  • 6 Grove Ports on pins GP0 to GP9 and ADC on pins GP27 and GP28
  • A single Neopixel (WS2812B) RGB LED on pin GP28
  • Momentary buttons on pins GP20, GP21 and GP22
  • Piezo buzzer (with ON/OFF switch) on GP 18
  • Audio output to headphone socket on pins GP18 and GP19
  • Micro SD card reader on pins GP10 to GP15
  • Port for connection of an ESP-01 WiFi module on GP 16 & GP17
  • The DEBUG pins are brought out to male headers
  • 3V3, GND and RUN are brought out to male headers
  • The corners of the board are drilled for easy attachment to other things

They are selling this board, with the Pico included, for $9.90 (£11.50 in UK from The Pi Hut)

You can find a local international distributor on the manufacture's website: cytron.io

This board provides makers with easy to use pick up points for 3V3 (2) and GND (9) in addition to each of the Grove ports (6). The back of the board shows a Pico pinout with pin connections for the SD card. There is also a track cut point with solder pads if you want to disable/enable the blue LEDs. With the Pico already soldered in place, the easy-to-use connections and the pre-wired components included; this board will appeal to many makers and especially those who are not confident with a soldering iron.

Supplies

MAKER PI PICO

Mu editor (https://codewith.mu)

SSD1306 OLED display

10K Ohm potentiometer

BME680 sensor

Grove connectors

Dupont jumper wires

SD card

Step 1: Getting to Know the Board

I used a USB cable to connect the Pico to my PC. The LEDs started flashing and quite loud, clear tones came out of the buzzer. Pressing the left button turned the LEDs on and off and buzzed the speaker. The middle button made a different sound and displayed colours on the Neopixel.

I next started file explorer and found that a CircuitPython UF2 had been installed and a code.py file was present. The lib folder contained modules for framebuffer and SSD1306. Also present were files called font5x8, font5x8.bin.license and a WAV file called ‘L-R’.

I copied these files to a separate folder on my PC. (They will be useful if you have to ‘nuke’ your Pico’s storage at some stage.) I also noticed that the UF2 was:

Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; Raspberry Pi Pico with rp2040

The WAV file spoke the words LEFT and RIGHT. (The sound did not come out clearly from the WAV file in the demo program. There is still work being done on some of the modules to make them work correctly on the Pico.) I had already got the font file and have been using it for some time with an SSD1306 and other displays.

I noticed that the version of CircuitPython was out of date so I downloaded and installed the latest version from CircuitPython.org. I went to the Cytron website and located the correct page for documentation:

Maker Pi Pico: Simplifying Raspberry Pi Pico for Beginners (cytron.io)

There was plenty of useful information provided.

Step 2: Further Exploration

There I found example programs in both MicroPython and MicroPython. Since CP was already up-dated I continued with it.

On examining the code.py program in detail, I found that it expects an SSD1306 (128x64 pixel) display on pins 6 & 7 (Grove Port4) and an SD card (FAT32) in the SD card reader. I connected an SSD1306, inserted a memory card and ran the demo program again. With the display connected the program carries out a full test and demonstration of the board with reports appearing on the display screen. Pressing the three buttons in turn takes you to different sections. Using the buttons from left to right checks the blue LEDs, the buzzer, Neopixel and lastly the SD card reader. It then plays a tune!

A very impressive start and time to write my own code.

Step 3: Potentiometer, SSD1306 Display and Neopixel

Since the SSD1306 was already working I decided to add a 10 K Ohm potentiometer to an ADC pin, draw a bar graph and change the colour of the Neopixel as I turned the potentiometer. I like to halt programs properly so I used one of the buttons to stop execution and tidy up properly.

Here is the first section of code. It sets up the components, provides an alignment routine and displays the instructions on the screen.

Step 4: More Code

Here is the main loop and tidy-up routine. I've included code to 'improve' the accuracy of the Pico ADC port at the top and bottom ends.

Step 5: See How It Works

The video shows the program running:

  • Instructions
  • Bar Graph moving
  • Colour of the Neopixel changing
  • Relative colour values being updated
  • STOP button being pressed
  • Tidy-up sequence

The code can be downloaded here:

Step 6: Datalogging Project With the SD Card Reader

In the bottom left hand corner of the board is an SD card reader. I thought I would try my hand at datalogging.

Adafruit provide a suitable module to drive it - sdcardio.

I own a BME680 with operating ranges quoted as: -40 ‒ +85 °C, 0 ‒ 100% r.H., 300 ‒ 1100 hPa on the data sheet. If I put it in the freezer to cool right down, I can log the temperature and humidity as it warms up. (I doubt the SSD1306 would like being in the freezer so I will just plug the cold sensor into the circuit and then start it running.) I will take and record readings for temperature and humidity every few seconds. I will display all the sensor values on the SSD1306 so that I can see when the sensor has returned to room temperature.

The Adafruit guide suggests that you may need an offset to correct the temperature. I calibrated my BME680 against a certified mercury thermometer previously used for colour photo chemical processing. I found mine to be accurate at 22 Celsius and set the offset to zero

The program utilises the colour LED to show what is happening. It displays BLUE during setup, RED while processing and saving data to the SD card file, GREEN while waiting for the next reading to be taken and MAGENTA during closedown. The left button, on pin GP20 is used to stop recording. It should be pressed only while the LED shows GREEN, to prevent corruption of the data file. Output of sensor data also goes to the Serial Monitor and the SSD1306 display.

Here is the first part of my data logging code:

Step 7: Code Part 1

This part carries out all the setting up.

Step 8: Code Part 2

This shows the main loop and tidy-up sequence. You can also download the code.

You might note that each record in the file in a single string with fields separated by a comma character and terminated with carriage return, new line.

If you run the program again it will overwrite your log file. As soon as I had finished a logging run I renamed the log file to protect it.

Step 9: Reading the The Log File

Here we have to read each line (a record), split it at the commas into fields and then convert the field strings back to numeric values.

Step 10: Looking at the Log File

This is a view of an earlier log file. It shows the intervals at the top and 'Rogue' values, to stop the program, at the bottom.

Step 11: Producing a Graph

The Mu editor provides an graph plotting window as well as the serial monitor. The picture shows the temperature and humidity plots from one run of the logger program. The temperature slowly rises while the humidity at first rises, as water vapour condenses on the cold sensor, and then drops away as the water evaporates.

Step 12: Final Thoughts

I've enjoyed getting to grips with this new board. It appears to be very competitively priced, includes a ready soldered Pi Pico, easy access to the pins via male headers and Grove ports and plenty of connected components.

You can program it easily with CircuitPython (best for sensors) and MicroPython (use both cores, PIO and interrupts). Harder to use are C/C++ and even the Arduino IDE, which allows you to make use of the ESP-01 socket for wi-fi connections. (You will need to visit earlephilhower's github page for the necessary files and installation instructions.)

Then search for: Maker Pi Pico and ESP01 with Blynk IoT App using Arduino IDE (cytron.io)

This inexpensive, well made and feature packed board will appeal to many users:

  • novice users: easy access to LEDS, switches, Grove ports and clearly labelled male pins - without soldering
  • more advanced users for the many included add-ons - buzzer/speaker, Neopixel, SD card reader

If you do buy one I recommend that you also get an SSD1306 (128x64 pixels display) as it will greatly increase the versatility of your setup at little extra cost.

Keep an eye out for software updates - improvements from Adafruit are happening all the time.

If you already have a Pico there is another version of the board (cheaper but just a versatile with all the extras) with a socket to accept your PICO.