We introduce you to the new range of PiicoDev maker products and how to use them for rapid prototyping or maker education with a Raspberry Pi Pico or BBC micro:bit.
BUILD TIME: a few hours
DIFFICULTY RATING: BEGINNER
The barrier for entry for personal electronics projects can often be daunting for newcomers and discourages many people from exploring this amazing subject. The wide selection of sensors and microcontrollers available is great for experienced makers who need a specific product, however, as they all feature different power, communication, and programming requirements, it can be difficult to get started with.
The good people from Core Electronics are working to resolve this issue, and introduce maker electronics to more people with their new lineup of locally designed and manufactured PiicoDev products.
The PiicoDev family of products includes a collection of sensors and adapter boards which aim to enhance rapid prototyping and advance maker education through the use of an easy unified library and extensive support.
The initial lineup of PiicoDev products includes several sensor boards with a uniform design, connection type, and power requirements. The PiicoDev sensors all share the same 25.4 x 25.4mm square breakout with dual M2.5 mounting holes for easy assembly in your projects.
The sensor boards are daisy-chainable with each featuring two PiicoDev connectors for power (3V3) and I2C communication. They are compatible with Qwiic (SparkFun's I2C prototyping system) and STEMMA QT sensors from other companies.
The PiicoDev family also includes three adapter boards for connecting PiicoDev sensor modules to the Raspberry Pi Pico, BBC micro:bit, and Raspberry Pi. These adapters expose PiicoDev connectors for easy assembly and testing of projects. Core Electronics also offers ‘Pioneer Platforms’ for the Raspberry Pi Pico and BBC micro:bit that provides an easy mounting solution for an adapter, three PiicoDev sensors, and a small breadboard.
The PiicoDev family of products are locally manufactured by Core Electronics in Newcastle. The sensor and adapter boards are assembled by their Neoden K1830 Pick And Place machine before being packaged. The Pioneer Platforms are also made locally from laser cut acrylic sheets and packaged with the necessary mounting accessories.
Core Electronics also develops and maintains the MicroPython Unified PiicoDev Library which allows PiicoDev sensors to be run with the same code on all supported devices. This means the same sensors can easily be moved from a Raspberry Pi Pico, BBC micro:bit, Raspberry Pi or other compatible device and will work with the same code.
The PiicoDev Sensors
We will be looking at the first three PiicoDev sensors released by Core Electronics and how to interface with them on the Raspberry Pi Pico and the BBC micro:bit. These sensors are the Precision Temperature Sensor using the TMP117, the Ambient Light Sensor using the VEML6030, and the Atmospheric Sensor using the BME280. These products all feature common well-supported sensor modules and come with customised libraries which enable easy prototyping.
There are more sensors that Core Electronics have added to their range that we won’t be covering here, but the same principals can be applied.
Temperature Sensor
Temperature Sensor uses the TMP117 digital temperature sensor from Texas Instruments. The sensor features 16-bit resolution and an accuracy of ±0.1°C between -20°C and 50°C without calibration, and a full range of -55°C to 150°C. The board also features a configurable 4-way I2C address selector by soldering the ADRR connections on the rear of the module.
Light Sensor
The PiicoDev Ambient Light Sensor uses the VEML6030 ambient light sensor from Vishay Semiconductors. The sensor features a 16-bit resolution and a detection range of 0lx to 120,000lx with a resolution of 0.0036lx. The board also offers an alternative I2C address by soldering the jumper on the rear of the module.
Atmospheric Sensor
The PiicoDev Atmospheric Sensor uses the BME280 relative humidity, barometric pressure and ambient temperature sensor from Bosch Sensortec. The sensor features an operating range of -40°C to 85°C, 0% - 100% humidity, and 300hPa to 1100hPa. The temperature is reported with an accuracy of ±1°C within 0°C to 65°C. This is less accurate than the dedicated TMP117 but the board also features humidity and pressure sensors. The relative humidity value is accurate to ±3%RH, while the pressure sensor is accurate to ±1hPa. The board's I2C address can be set the same way as the Ambient Light sensor by soldering the jumper on the rear of the module.
These characteristics combined with a low cost and strong documentation make the BME280 a popular choice in weather station builds. The integration of it into the PiicoDev Atmospheric Sensor with a cross-platform library will make it even easier for new makers to get started with environment sensing projects.
Compatible Development Boards
Core have made a range of adaptors suit different development platforms. These include the Raspberry Pi, Raspberry Pi Pico, Arduino Uno and BBC micro:bit. In this project, we’ll show you how to get PiicoDev working with the Raspberry Pi Pico and BBC micro:bit.
If you not familiar with the Pico and micro:bit, here’s a little more about them. If you have worked with these boards before, feel free to skip to the Software Setup.
Raspberry Pi Pico
The Raspberry Pi Pico is the first microcontroller released by the Raspberry Pi Foundation and features the custom dual-core Arm RP2040 processor. The device is comparable to alternatives from Arduino, Teensy, and Espressif featuring several I/O pins and direct programming.
The RP2040 processor found in the Raspberry Pi Pico features dual Arm Cortex-M0+ cores with flexible clock speeds up to 133MHz. The RP2040 comes with 264KB on-chip SRAM while the Pico adds 2MB of onboard flash memory for program storage.
The board features extensive connectivity with I2C and SPI which the PiicoDev platform will take advantage of while also including advanced features like eight programmable state machines for more experienced makers.
The Raspberry Pi Pico measures just 21 x 51mm and includes a micro-USB connector for programming and power. The board exposes 26 of the 30 available pins from the RP2040 which we can use to attach our PiicoDev sensors via an adapter.
The PiicoDev Expansion Board for Pico allows us to easily attach a Raspberry Pi Pico with soldered headers to our PiicoDev sensors via the convenient connector. The board also exposes a power connector for integrating batteries and a second breakout row for breadboard prototyping.
Core Electronics also produce a PiicoDev Pioneers Platform (CE07694), which includes mounting spaces for the adapter, three PiicoDev modules and a small solderless breadboard. We will be using this platform to keep all of our components tidy and fixed in place.
Insert the Raspberry Pi Pico in the Expansion Board and attached the PiicoDev sensors to the onboard connector.
BBC micro:bit
The BBC micro:bit is an open-source ARM-based embedded computer designed to promote computer education. The BBC micro:bit has two revisions with the first being released in 2016 while an upgraded v2 version was released in 2020. The PiicoDev modules and software are compatible with both versions, however, the V2 has more memory so it can hold larger programs.
The two versions both feature a 43mm x 52mm board layout with a 32-bit ARM Cortex microcontroller. The V1 uses the Nordic nRF51822 16MHz ARM Cortex-M0 microcontroller with 256KB flash memory, 16KB static RAM, and 2.4GHz Bluetooth Low Energy. The V2 features an upgraded Nordic nRF52833 64MHz ARM Cortex-M4 microcontroller with 512KB flash memory, 128KB static RAM, and 2.4GHz Bluetooth Low Energy.
The boards both feature an integrated 3-axis accelerometer and magnetometer, a 25 LED 5x5 matrix, and three tactile buttons. The V2 also has an integrated speaker and microphone to incorporate sounds and recording into projects, along with the logo now acting as a capacitive touch button.
The two boards both feature a 25 pin edge connector with five primary ring connectors. These connections allow us to interface with various peripherals by connecting to the pads with banana plugs or using a specialty connector like the PiicoDev Adapter for micro:bit, which allows us to easily connect PiicoDev connector to the device.
Core Electronics also makes a version of the Pioneers Platform for the BBC micro:bit with different adapter mounting hardware. We can assemble the BBC micro:bit by inserting it into the adapter with the LED matrix facing forwards. We can then attach our PiicoDev sensor modules to the exposed connector on the adapter board.
Parts Required: | CORE ELECTRONICS |
---|---|
BBC MICRO:BIT BUILD: | |
1 x micro:bit v2 by BBC | CE07353 |
1 x PiicoDev Adapter for micro:bit | CE07688 |
1 x PiicoDev Platform for micro:bit | CE07843 |
RASPBERRY PI PICO BUILD: | |
1 x Raspberry Pi Pico (with Soldered Headers) | CE07589 |
1 x PiicoDev Expansion Board for Pico | CE07693 |
1 x PiicoDev Platform for Raspberry Pi Pico | CE07694 |
PIICODEV SENSORS: | |
1 x PiicoDev TPM117 Temperature Sensor | CE07502 |
1 x PiicoDev BME280 Atmospheric Sensor | CE07503 |
1 x PiicoDev VEML6030 Ambient Light Sensor | CE07692 |
Software Setup
Thonny IDE
We will be using the Thonny IDE to write and upload our MicroPython code to the Raspberry Pi Pico and BBC micro:bit.
Thonny is an easy to use Python IDE editor for beginners. You can download and install the Thonny IDE from https://thonny.org/.
Note: We will configure Thonny to work with our devices later in this article.
Piicodev library
The Core Electronics Unified PiicoDev Library allows us to run the same program on either device with the same functionality.
You can download the latest version of the Unified PiicoDev Library from: https://github.com/CoreElectronics/CE-PiicoDev-Unified
Open the PiicoDev_Unified.py file in Thonny as this will be needed for all our projects with PiicoDev.
Raspberry Pi Pico Software Setup
To set up the software, we need to install MicroPython on the Raspberry Pi Pico to be able to use the PiicoDev Unified Library. To do this, attach the Pico to a desktop computer or laptop and download the UF2 installation file from the Raspberry Pi website: https://www.raspberrypi.org/documentation/rp2040/getting-started/#getting-started-with-micropython
When connecting the Pico to your computer, hold the onboard BOOTSEL button until the device is recognised. We can then copy the UF2 file we downloaded onto the Raspberry Pi Pico which will then reboot and install MicroPython. Once the Raspberry Pi Pico has rebooted we can proceed to configure Thonny to communicate with it.
To set up the Thonny IDE to correctly recognise and upload code to our Raspberry Pi Pico, we will need to navigate to Tools > Options > Interpreter, and select MicroPython (Raspberry Pi Pico) as the interpreter. Thonny should now attempt to automatically detect the device. If this fails, we will need to manually select the COM port from the menu.
Thonny will now be able to upload PiicoDev programs to the Raspberry Pi Pico.
BBC micro:bit Software Setup
The Thonny IDE configuration for the BBC micro:bit is very similar to the Raspberry Pi Pico. We first need to set the interpreter in Thonny by navigating to Tools > Options > Interpreter, and selecting MicroPython (BBC micro:bit) as the interpreter.
Install MicroPython on the device by selecting Install or update firmware, and selecting install. This will get our device ready for programming.
Precision Temperature Sensor
We will need to download the PiicoDev TMP117 MicroPython Module (PiicoDev_TMP117.py) to interface with the sensor. This module can be downloaded and opened in Thonny along with the Unified PiicoDev Library (PiicoDev_Unified.py) we downloaded earlier. The example main.py code included in the library can also be opened in Thonny. https://github.com/CoreElectronics/CE-PiicoDev-TMP117-MicroPython-Module
We will need to upload the Unified PiicoDev Library and PiicoDev TMP117 MicroPython Module to our Raspberry Pi Pico or BBC micro:bit. To do this, open each file tab in Thonny and select File > Save copy, and choose our device, making sure the files are named correctly. We will only need to upload the Unified PiicoDev Library and each sensor MicroPython module to our device once.
Once the library files have been uploaded to our device, we are ready to run the example script. Navigate to the main.py file from the TMP117 MicroPython Module in Thonny and select Run to start the program on our device. The program will begin to print the detected temperature value in degrees from the sensor to the serial log.
This basic starting code shows how the sensor value can be integrated into a more complex project. We can upload the main.py file to our device the same way as we did for the two PiicoDev libraries which will cause the script to run automatically on startup.
Ambient Light Sensor
The installation process for all PiicoDev sensor MicroPython modules are very similar, we can download and upload the PiicoDev VEML6030 MicroPython Module (PiicoDev_VEML6030.py) to our device using Thonny. https://github.com/CoreElectronics/CE-PiicoDev-VEML6030-MicroPython-Module
Note: You can delete other sensor modules from the device if you have limited space remaining.
The included example script reads the detected luminosity and reports it to the serial log. We can open the main.py file and run it through Thonny. This will override the existing main.py if that was uploaded to the device.
We can easily test the sensor by covering it or shining a torch directly at it to see the change in lux.
Atmospheric Sensor
Download the PiicoDev BME280 MicroPython Module (PiicoDev_BME280.py). This is significantly larger than the previous two modules due to the more complex sensor used. The library only supports the BBC micro:bit V2 and Raspberry Pi Pico as the original BBC micro:bit does not have enough onboard memory to store it. Upload the module to our device and run the included main.py example code. https://github.com/CoreElectronics/CE-PiicoDev-BME280-MicroPython-Module
The example program reads the temperature, pressure and humidity values recovered by the sensor. Temperature is displayed in degrees, pressure in hPa, and humidity as a percentage. These values can be extremely useful for projects where we want to integrate dynamic responses to the environment.
# PiicoDev TMP117 BBC Micro:bit example
from PiicoDev_TMP117 import PiicoDev_TMP117
from time import sleep
from microbit import *
tempSensor = PiicoDev_TMP117()
while True:
# Read temperature
tempC = tempSensor.readTempC() # Celsius
# Convert temperature into a string and
print the data
print(str(round(tempC,1)) + "°C")
display.scroll(round(tempC,1))
sleep(1000) # delay
Test Build: Digital Scrolling Temperature Display with micro:bit
We have created a small example program to demonstrate how you could integrate a PiicoDev sensor into your next project. We decided to take advantage of the LED matrix found on the BBC micro:bit V1/V2 to display the reported temperature from the Precision Temperature TMP117 sensor. The program establishes a connection with the sensor and requests the current temperature which it rounds to one decimal place and sends to the LED matrix to display as scrolling text.
The program requires the PiicoDev Unified Library and the PiicoDev TMP117 Module to be uploaded on the BBC micro:bit. To run the program, simply open the main.py file and upload it to our device. You can find the code for this example project on our website.
Where to from here?
These first introductions to the PiicoDev platform show how we can take advantage of the cross-platform solution to quickly create prototypes on various devices. The BBC micro:bit scrolling temperature display demo shows how the values from these sensors can be integrated into your own projects.
Core Electronics is preparing further PiicoDev modules including a laser distance module, inertial measurement unit sensor, and a capacitive touch sensor with many more to come.