Pico Environment Sensor
| ||
Overview
The Pico-Environment-Sensor gives Raspberry Pi Pico the ability to collect environmental data like temperature & humidity, air pressure, ambient light intensity, VOC, UV rays, etc. It can also be used to build a robot that can detect motion and orientation.
Features
- Standard Raspberry Pi Pico header, supports Raspberry Pi Pico series.
- Onboard TSL25911FN digital ambient light sensor, for measuring IR and visible light.
- Onboard BME280 sensor, for measuring temperature, humidity, and air pressure.
- Onboard ICM20948 motion sensor, accelerometer, gyroscope, and magnetometer.
- Onboard LTR390-UV-1 sensor, for measuring UV rays.
- Onboard SGP40 sensor, for detecting ambient VOC.
- I2C bus allows retrieving data by just using two wires.
Specifications
TSL25911FN DIGITAL AMBIENT LIGHT SENSOR | |
I2C address | 0 x 29 |
Effective range | 0~88000 Lux |
BME280 TEMPERATURE, HUMIDITY, AND AIR PRESSURE SENSOR | |
I2C address | 0 x 76 |
Temperature detection | -40 ~ 85℃ (0.01℃ resolution, ±1℃ accuracy) |
Humidity detection | 0~100%RH (0.008%RH resolution, ±3%RH accuracy, 1s response time, ≤2%RH delay) |
Air presure detection | 300~1100hPa (0.18Pa resolution, ±1hPa accuracy) |
ICM20948 MOTION SENSOR (9-DOF: 3-AXIS ACCELEROMETER, 3-AXIS GYROSCROPE, 3-AXIS MAGNETOMETER) | |
I2C address | 0 x 68 |
Accelerometer resolution | 16-bit |
Accelerometer range (configurable) | 2, ±4, ±8, ±16g |
Gyroscope resolution | 16-bit |
Gyroscope range (configurable) | ±250, ±500, ±1000, ±2000°/sec |
Magnetometer resolution | 16-bit |
Magnetometer range | ±4900µT |
LTR390-UV-1 UV SENSOR | |
I2C address | 0 x 53 |
Response wavelength | 280nm - 430nm |
SGP40 VOC Sensor | |
I2C address | 0 x 59 |
Measuring range | 0 ~ 1,000 ppm ethanol equivalent |
Limit condition | < 0.05 ppm ethanol equivalent OR < 10 % preset concentration point (the larger one should prevail) |
Response time | < 10 s (tau 63 %) |
Start time | < 60 s |
On-chip humidity compensation support |
How to Connect
As shown below: directly connect to the GPIO headers of the Jetson Nano.
Onboard Resource
- digital ambient light sensor, for measuring IR and visible light
2. LTR390-UV-1
- UV sensor
3. SGP40
- VOC sensor
4. ICM20948
- 3-axis accelerometer, 3-axis gyroscrope, 3-axis magnetometer
5. Voltage translator
- 5V to 3.3V/1.8V
6. BME280
- temperature, humidity, and air pressure sensor
7. Logic level translator
- 3.3V ~ 1.8V
8. I2C selection
Sensor
Ambient Light Sensor
The TSL2591 is an optical intensity digitizer based on IIC bus communication. The sensor combines a broadband photodiode (visible and IR light) and an IR-responsive photodiode on a single CMOS integrated circuit capable of providing near-light adaptive response over an effective 16-bit dynamic range (16-bit resolution). Two integral ADCs convert the photodiode current to a digital output representing the irradiance measured on each channel. This digital output can be fed to a microprocessor, which uses an empirical formula to derive an illuminance (ambient light level) in lux to approximate the human eye response.
The sensor address is 0X29.
The following points need to be noted when using this sensor:
- The default is turned on the interrupt, if you do not need to comment out the corresponding code;
- The default range of the demo is limited, if the light suddenly changes a lot, please increase the range;
- There is a difference with the light intensity reader on the market, those are added to the lens.
Temperature, Humidity, and Ari Pressure Sensor
BME280 is for temperature, humidity, and air pressure sensors with the characteristics of low power consumption, high accuracy, and stability. It is suitable for environmental monitoring, weather prediction, altitude monitoring, and Internet of Things application scenarios.
Sensor address: 0 x 76.
Measuring range:
Temperature range: 40~85°C (resolution is 0.01°C, error ±1°C).
Humidity range: 0~100%RH (resolution is 0.008%RH, error ±3% RH)
Pressure range: 300~1100 hPa (resolution is 0.18Pa, error ±1 hPa)
Note:
- The measuring range should not exceed the measuring range, or it may be inaccurate.
- The pressure measured is atmospheric pressure, which normally fluctuates around the standard atmospheric pressure (1.013x 10^5 = 1013hPa).
- The measured temperature may be biased to the temperature above the jetson nano. If possible, fans can be added to avoid this situation during use.
- The higher the air temperature is, the lower the air pressure is. Because the higher the air temperature is, the air near the ground will expand and rise due to heat, resulting in a decrease in air density and air pressure. Instead, the pressure rises.
- Atmospheric pressure decreases with altitude, but there is no proportional relationship. The higher the altitude, the slower the decrease.
- The relationship between atmospheric pressure and altitude is as follows: as altitude increases, atmospheric pressure decreases. Theoretically, within the range of 3000M, atmospheric pressure decreases by 1mmHg, or about 133Pa, for every 12M increase.
9-axis Sensor
MPU9250 is a multi-chip module with 9-axis motion tracking, 3-axis acceleration, 3-axis gyroscope, and 3-axis magnetometer, and a built-in digital motion processing engine to reduce complex fusion algorithm data and reduce the load on the processor.
Sensor address: 0x68
Parameters:
Accelerometer characteristics:
- Resolution: 16-bit
- Measurement range (Optional): ±2, ±4, ±8, ±16g
- Operating current: 450uA
Gyroscope characteristics:
- Resolution: 16 bit
- Measurement range (Optional): ±250, ±500, ±1000, ±2000°/sec
- Operating current: 3.2mA
Magnetometer characteristics:
- Resolution: 16 bit
- Measurement range: ±4900µT
- Operating current: 280uA
Note:
- Acceleration (LSB, convert to g)
- Gyroscope angle velocity (LSB, convert to °/second)
- Magnetic electronic compass angle (°)
UV Sensor
The LTR390-UV-01 is a multifunctional optical measurement module with a focus on measuring ultraviolet light. The sensor supports the measured ambient light intensity.
The sensor address is: 0X53
The use of this sensor requires attention to the following points.
- The principle of operation is actually a pair of diodes, one sensitive to normal light and one sensitive to ultraviolet light, and the result is obtained by the calculation of both.
- The value readout is the original ADC data, if you want to calibrate can refer to the manual formula and combine it with the actual light intensity value, UV for correction.
- The data can be set differently by gain, which needs to be set according to the actual application environment.
- The manual does not specify the detection range, the actual measurement in the sun has a better effect or the best effect with a UV pen in 50cm thought.
VOC Sensor
SGP40 Sensirion's new digital VOC (Volatile Organic Compounds) sensor, easily integrated into air handling devices and air quality monitors, features a temperature-controlled miniature heating plate and a humidity-compensated indoor air quality signal that provides a complete sensor system on a single chip.
The sensor address is: 0X59
The following points need to be noted when using this sensor.
- The default Python demo outputs the VOC-processed algorithm value.
- The sensor work needs to be stabilized within 1 minute, as the internal is slowly heating up.
- Can be fed back to the SGP40 by measuring the current temperature and humidity so that the accuracy of the output will be higher.
- The sensor measurement range of 0 to 1,000 ppm ethanol equivalent.
C
C/C++ Development Environment Installation
- Before using the demos and tutorials, you need to set up the development environment and learn the basic usage of the project:
Windows
- Click here to download the demo, unzip it and enter the folder of Pico-Environment-Sensor-code\c.
- After entering Pico-Environment-Sensor-code\c, you can open the project with vs code.
- Choose the Compiler.
- Start to compile.
- Finish.
- Copy the Pico_Environment_Sensor.uf2 in build to Pico, and then it can automatically run the demo.
In Raspberry Pi
- Open the Raspberry Pi and run:
sudo apt-get install p7zip-full cd ~ sudo wget https://files.waveshare.com/upload/f/f8/Pico-Environment-Sensor-code.7z 7zr x Pico-Environment-Sensor-code.7z -r -o./Pico-Environment-Sensor-code cd ~/Pico-Environment-Sensor-code cd c/build/
Demo Use
- Please operate the following tutorial on Raspberry Pi, due to the multi-platform and portable nature of CMake, it can also be compiled successfully on a PC, but the operation is slightly different and requires your own judgment.
- To perform the compilation, make sure that in the c directory:
cd ~/Pico-Environment-Sensor-code/c/
Create and enter the build directory, and add the SDK: ../../pico-sdk is the directory of your SDK. There is a build in our sample application, just enter it directly.
cd build export PICO_SDK_PATH=../../pico-sdk (Note: Be sure to write the right path to your own SDK)
Execute cmake to automatically generate the Makefile file:
cmake ..
Execute make to generate the executable file, you may wait for a long time as it is the first time to be compiled.
make -j9
After compiling, the uf2 file will be generated. Press the button on the Pico board, Pico can connect to the USB port of the Raspberry Pi via a Micro USB cable, and then release the buttons. After connecting, Raspberry Pi will automatically identify a movable disk (RPI-RP2), and copy main.uf2 in the build file to the recognizable movable disk (RPI-RP2).
cp Pico_Environment_Sensor.uf2 /media/pi/RPI-RP2/
Python
Windows
- Download the demo.
- Press and hold the BOOTSET button on the Pico board, connect the Pico to the USB port of the computer via the Micro USB cable and release the button when the computer recognizes a removable disk (RPI-RP2).
- Copy the pico_micropython_20221125.uf2 file from the UF2 directory to the recognized removable disk (RPI-RP2).
- Open the Thonny IDE (note: use the latest version of Thonny, otherwise there is no support package for Pico, the current latest version for Windows is v3.3.3).
- Click Tools -> Settings -> Interpreter, and select Pico and the corresponding port as shown in the picture.
6. After connecting to Pico, save all the downloaded code to Pico, then run test.py, Thonny will print the sensor data as follows:
(1) Find the path of your downloaded program in the Thonny IDE.
(2) Upload all the Python to Pico.
(3) After uploading, open test.py for module testing.
(4) No save and the output value is normal, then the function is OK.
Raspberry Pi
- Demo download:
sudo apt-get install p7zip-full cd ~ sudo wget https://files.waveshare.com/upload/f/f8/Pico-Environment-Sensor-code.7z 7z x Pico-Environment-Sensor-code.7z -o./Pico-Environment-Sensor-code cd ~/Pico-Environment-Sensor-code
1. The process of flashing the firmware is the same as on Windows, you can choose to copy the pico_micropython_20210121.uf2 file into pico on your PC or Raspberry Pi.
2. Open the Thonny IDE in Raspberry Pi Mountain (click Raspberry logo -> Programming -> Thonny Python IDE), you can check the version information in Help -> About Thonny.
To make sure your version has the Pico support package, also you can click on Tools -> Options... -> Interpreter to select MicroPico. -> Interpreter to select MicroPython (Raspberry Pi Pico and ttyACM0 port).
As shown in the image:
If your current Thonny version has no Pico support package, you should enter the following commands to update Thonny IDE:
sudo apt upgrade thonny
3. Click File -> Open... -> test.py, and run the script.
Resource
Documents
- Schematic
- BME280 Specification
- TSL25911 Specification
- ICM20948 Datasheet
- LTR-390UV Specification
- SGP40 Specification
Demo Codes
Development Software
- Zimo221.7z
- Image2Lcd.7z
- Font Library Tutorial
- Image Extraction Tutorial
- Thonny Python IDE (Windows V3.3.3)
Pico Quick Start
Firmware Download
Text Tutorial
Introduction
MicroPython Series
- 【MicroPython】 machine.Pin Function
- 【MicroPython】 machine.PWM Function
- 【MicroPython】 machine.ADC Function
- 【MicroPython】 machine.UART Function
- 【MicroPython】 machine.I2C Function
- 【MicroPython】 machine.SPI Function
- 【MicroPython】 rp2.StateMachine
C/C++ Series
For C/C++, it is recommended to use Pico VS Code for development. This is a Microsoft Visual Studio Code extension designed to make it easier for you to create, develop, and debug projects for the Raspberry Pi Pico series development board. Whether you are a beginner or an experienced professional, this tool can help you confidently and easily develop Pico. Below we will introduce how to install and use the extension.
- Official website tutorial: https://www.raspberrypi.com/news/pico-vscode-extension/.
- This tutorial is applicable to Raspberry Pi Pico, Pico2, and our company's RP2040 and RP2350 series development boards.
- The development environment defaults to Windows as an example. For other environments, please refer to the official website tutorial for installation.
Arduino IDE Series
Install Arduino IDE
-
Download the Arduino IDE installation package from Arduino website.
-
Just click on "JUST DOWNLOAD".
-
Click to install after downloading.
-
Note: You will be prompted to install the driver during the installation process, we can click Install.
Install Arduino-Pico Core on Arduino IDE
-
Open Arduino IDE, click the File on the left corner and choose "Preferences".
-
Add the following link in "Additional boards manager URLs", then click OK.
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
Note: If you already have the ESP32 board URL, you can separate the URLs with commas like this:https://dl.espressif.com/dl/package_esp32_index.json,https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
-
Click on Tools -> Board -> Board Manager -> Search for pico, it shows installed since my computer has already installed it.
Upload Demo At the First Time
-
Press and hold the BOOTSET button on the Pico board, connect the Pico to the USB port of the computer via the Micro USB cable, and release the button when the computer recognizes a removable hard drive (RPI-RP2).
- Download the demo from #Resource, open the D1-LED.ino under arduino\PWM\D1-LED path.
-
Click Tools -> Port, remember the existing COM, do not need to click this COM (different computers show different COM, remember the existing COM on your computer).
-
Connect the driver board to the computer with a USB cable, then click Tools -> Ports, select uf2 Board for the first connection, and after the upload is complete, connecting again will result in an additional COM port.
-
Click Tools -> Board -> Raspberry Pi Pico/RP2040 -> Raspberry Pi Pico.
-
After setting, click the right arrow to upload.
- If you encounter problems during the period, you need to reinstall or replace the Arduino IDE version, uninstall the Arduino IDE clean, after uninstalling the software you need to manually delete all the contents of the folder C:\Users\[name]\AppData\Local\Arduino15 (you need to show the hidden files in order to see it) and then reinstall.
Open Source Demo
- MicroPython Demo (GitHub)
- MicroPython Firmware/Blink Demo (C)
- Official Raspberry Pi C/C++ Demo
- Official Raspberry Pi MicroPython Demo
- Arduino Official C/C++ Demo
Support
Technical Support
If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)