Skip to content

Developments in C for the Raspberry Pico µ-controller to integrate environnemental sensors

License

Notifications You must be signed in to change notification settings

armel-31/pico-station

Repository files navigation

Pico-Station

The aim of this project is to propose open code in C for the Raspberry Pi Pico, to integrate several environnemental sensors into your embedded systems (Pimoroni breakouts).

Purpose of this open source code sensors

As world climate is changing fastly, environnement is becoming more and more un-predictable. Integrating these sensors into low consumption and connected embedded systems is an opportunity to measure and evaluate what's happening in real time in your environnement, for better decision taking.

Therefore, don't hesitate to bring your contribution to these project and broadcast widely this open-source code.

Why using the Raspberry Pico ?

The Raspberry Pico micro-controller is cheap, widely available, energy low comsumption and powerful (Dual Core ARM0+ clock at 133MHz - 2MB Flash Memory). It integrates several interfaces (UART, I2C, SPI) to match all needs for for I/O and sensors.

Moreover, a wide community is behind this MCU as you can find API documentation and examples.

Why developping in C/C++ ?

C progamming is a very well optimized and robust langage for embedded systems : low consumption, compiled, many low level libraries, widely used...

List of developped devices for the station

Sensors Devices

Sensor Name Description  Dev Progress Calibration
BME680 Air Quality, Temperature, Pressure, Humidity Sensor OK ToDo
VL53L1X Time of Flight (ToF) Sensor Breakout OK ToDo
SGP30 Air Quality Sensor Breakout OK ToDo 
MAX30105 Heart Rate, Oximeter, Smoke Sensor IN PROGRESS ToDo
PMW3901 Optical Flow Sensor ToDo ToDo

IoT Devices

Device Name Description  Dev Progress
Pico Wireless Pico Wireless module based on ESP32 and SD Card ToDo
SIM7020E NB-IoT SIM7020E NB-IoT Module In Progress

HMI Devices

Device Name Description  Dev Progress Calibration
ST7789 Pico Explorer Base Display (ST7789) OK OK

Project Architecture

The rig used for testing is the Pico Explorer Base from Pimoroni. The ST7789 display will be used to check values of sensors and buttons to select configurations of the project.

A 'Debug' compilation can be used to read sensors values from serial port (USB) on Pico.

Compilation of the project

The code include a bash script (pico_tool.sh) to build the exe file (ELF) and load it to the Pico using OpenOCD and SWD port (using a Raspberry Pi for example). How to use the bash tool :

Display the help on the tool :

./pico_tool.sh -h

Clean-up the compilation folder (build) :

./pico_tool.sh -a clean

Generate the makefile using CMake. You need to deploy and set your Raspberry Pico SDK :

./pico_tool.sh -a cmake

build or rebuild the binary ELF executable (pico-station.elf)

./pico_tool.sh -a (re)build

Build the project then load the binary on RP2040 chip (see next topic for explanations) :

./pico_tool.sh -a build_load

Deployment after compilation

Once the binary exe file is compiled, you can upload it using the SWD port available on the Raspberry Pico, from a GPIO module (Raspberry Pi Zero for example).

From a Linux environnement including GPIO interface, you need to install OpenOCD following this tutorial. You have to link SWCLK/GND/SWDIO interface from Pico to a Raspberry Pi.

Releases

No releases published

Packages

No packages published

Languages