Pico-Sensor-Kit-B

From Waveshare Wiki
Jump to: navigation, search
Pico-Sensor-Kit-B
Pico-sensor-kit-1.jpg

0.96inch, 160*80
ADC, I2C, GPIO
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

Pico-Sensor-Kit is a PICO entry-level sensor kit, including common sensors such as LED, buttons, and buzzers, which is easy for beginners to get started.
All-in-one design, all the modules are connected with PCB castellated holes, which is not needed to be soldered or wired anymore. Hence, you do not need to worry about the wiring. and it can provide you with an excellent programming experience.

Of course, you can separate these modules, and then connect them with the wires we provided, and these modules are easy to be integrated into your projects.

  • PS: Please pay attention to the sharp cuts and fragments when disassembling the modules.

Parameters

Pico-sensor-kit includes 15 modules in total. For more details, please refer to the following table.

Module Module Connection Port Description
Button Module D0 Detect whether the button is pressed, for human-computer interaction
LED Module D1 Emit light by inputting electrical signal
Buzzer Module D2 Sound by the frequency of the input electrical signal
IR Receiver Module D3 Accept infrared remote control signal and output electrical signal
IR Transmitter Module D4 Emit infrared light at the frequency of the input electrical signal
RGB LED Module D7 Full-color lights controlled by a single bus
6-axis Sensor Module I2C0 (ADDR:0 X 6B) 6-axis attitude sensor
VOC Sensor Module I2C0 (ADDR:0 X 59) VOC (Volatile Organic Compound) sensor
EEPROM Module I2C0 (ADDR:0 X 50) Electrically erasable programmable read-only memory, which can be used to store offline data
Temperature/Humidity Sensor Module I2C0 (ADDR:0 X 70) Low power consumption temperature and humidity sensor
Motor Driver Module I2C0 (ADDR:0 X 40) Can be used to drive four 5V motors
OLED Module I2C1 (ADDR:0 X 3D) 1.5-inch OLED module, 128 × 128 resolution, 16 grayscale display
Photoresistor Module ADC0 For detecting the brightness
Potentiometer Module ADC1 Can be used to simulate voltage changes
Voice Sensor Module ADC2 Can be used to detect ambient sound
  • PS: Onboard 3.3V for DC-DC output, the maximum current is 2A if the motor driver board power supply should pay attention to its current.
  • The motor driver board is recommended to use an external power supply, which can improve system stability.

Interface Description

Pico-Sensor-Kit-B70.jpg

Pico Getting Started

Firmware Download

  • MicroPython Firmware Download

MicroPython Firmware Download.gif

  • C_Blink Firmware Download

C Blink Download.gif

Introduction

Raspberry Pi Pico Basics

MicroPython Series

Install Thonny IDE

In order to facilitate the development of Pico/Pico2 boards using MicroPython on a computer, it is recommended to download the Thonny IDE

  • Download Thonny IDE and follow the steps to install, the installation packages are all Windows versions, please refer to Thonny's official website for other versions
  • After installation, the language and motherboard environment need to be configured for the first use. Since we are using Pico/Pico2, pay attention to selecting the Raspberry Pi option for the motherboard environment

Pico-R3-Tonny1.png

  • Configure MicroPython environment and choose Pico/Pico2 port
    • Connect Pico/Pico2 to your computer first, and in the lower right corner of Thonny left-click on the configuration environment option --> select Configture interpreter
    • In the pop-up window, select MicroPython (Raspberry Pi Pico), and choose the corresponding port

700px-Raspberry-Pi-Pico-Basic-Kit-M-2.png
700px-Raspberry-Pi-Pico-Basic-Kit-M-3.png

Flash Firmware

  • Click OK to return to the Thonny main interface, download the corresponding firmware library and burn it to the device, and then click the Stop button to display the current environment in the Shell window
  • Note: Flashing the Pico2 firmware provided by Micropython may cause the device to be unrecognized, please use the firmware below or in the package
  • How to download the firmware library for Pico/Pico2 in windows: After holding down the BOOT button and connecting to the computer, release the BOOT button, a removable disk will appear on the computer, copy the firmware library into it
  • How to download the firmware library for RP2040/RP2350 in windows: After connecting to the computer, press the BOOT key and the RESET key at the same time, release the RESET key first and then release the BOOT key, a removable disk will appear on the computer, copy the firmware library into it (you can also use the Pico/Pico2 method)

Raspberry-Pi-Pico2-Python.png

MicroPython Series

【MicroPython】 machine.Pin class function details
【MicroPython】machine.PWM class function details
【MicroPython】machine.ADC class function details
【MicroPython】machine.UART class function details
【MicroPython】machine.I2C class function details
【MicroPython】machine.SPI class function details
【MicroPython】rp2.StateMachine class function details

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 boards. No matter if you are a beginner or an experienced professional, this tool can assist you in developing Pico with confidence and ease. Here's how to install and use the extension.

  • Official website tutorial: https://www.raspberrypi.com/news/pico-vscode-extension/
  • This tutorial is suitable for Raspberry Pi Pico, Pico2 and the RP2040 and RP2350 series development boards developed by Waveshare
  • The development environment defaults to Windows. For other environments, please refer to the official tutorial for installation

Install VSCode

  1. First, click to download pico-vscode package, unzip and open the package, double-click to install VSCode
    Pico-vscode-1.JPG
    Note: If vscode is installed, check if the version is v1.87.0 or later
    Pico-vscode-2.JPG
    Pico-vscode-3.JPG

Install Extension

  1. Click Extensions and select Install from VSIX
    Pico-vscode-4.JPG
  2. Select the package with the vsix suffix and click Install
    Pico-vscode-5.JPG
  3. Then vscode will automatically install raspberry-pi-pico and its dependency extensions, you can click Refresh to check the installation progress
    Pico-vscode-6.JPG
  4. The text in the right lower corner shows that the installation is complete. Close VSCode
    Pico-vscode-7.JPG

Configure Extension

  1. Open directory C:\Users\username and copy the entire .pico-sdk to that directory
    Pico-vscode-8.JPG
  2. The Copy is completed
    Pico-vscode-9.JPG
  3. Open vscode and configure the paths for the Raspberry Pi Pico extensions
    Pico-vscode-10.JPG
    The configuration is as follows:
    Cmake Path:
    ${HOME}/.pico-sdk/cmake/v3.28.6/bin/cmake.exe
    
    Git Path:
    ${HOME}/.pico-sdk/git/cmd/git.exe    
    
    Ninja Path:
    ${HOME}/.pico-sdk/ninja/v1.12.1/ninja.exe
    
    Python3 Path:
    ${HOME}/.pico-sdk/python/3.12.1/python.exe             
    

New Project

  1. The configuration is complete, create a new project, enter the project name, select the path, and click Create to create the project
    To test the official example, you can click on the Example next to the project name to select
    Pico-vscode-11.JPG
  2. The project is created successfully
    Pico-vscode-12.JPG
  3. Select the SDK version
    Pico-vscode-13.JPG
  4. Select Yes for advanced configuration
    Pico-vscode-14.JPG
  5. Choose the cross-compilation chain, 13.2.Rel1 is applicable for ARM cores, RISCV.13.3 is applicable for RISCV cores. You can select either based on your requirements
    Pico-vscode-15.JPG
  6. Select default for CMake version (the path configured earlier)
    Pico-vscode-16.JPG
  7. Select default for Ninjaversion
    Pico-vscode-17.JPG
  8. Select the development board
    Pico-vscode-18.JPG
  9. Click Complie to compile
    Pico-vscode-19.JPG
  10. The uf2 format file is successfully compiled
    Pico-vscode-20.JPG

Import Project

  1. The Cmake file of the imported project cannot have Chinese (including comments), otherwise the import may fail
  2. To import your own project, you need to add a line of code to the Cmake file to switch between pico and pico2 normally, otherwise even if pico2 is selected, the compiled firmware will still be suitable for pico
    Pico-vscode-21.JPG set(PICO_BOARD pico CACHE STRING "Board type")

Update Extension

  1. The extension version in the offline package is 0.15.2, and you can also choose to update to the latest version after the installation is complete
    Pico-vscode-22.JPG

Arduino IDE Series

Install Arduino IDE

  1. First, go to Arduino official website to download the installation package of the Arduino IDE.
    600px-Arduino下载2.0版本.jpg
  2. Here, you can select Just Download.
    仅下载不捐赠.png
  3. Once the download is complete, click Install.
    IDE安装水印-1.gif
    Notice: During the installation process, it will prompt you to install the driver, just click Install
    600px

Arduino IDE Interface

  1. After the first installation, when you open the Arduino IDE, it will be in English. You can switch to other languages in File --> Preferences, or continue using the English interface.
    首选项-简体中文.jpg
  2. In the Language field, select the language you want to switch to, and click OK.
    600px-首选项-简体中文ok.jpg

Install Arduino-Pico Core in the Arduino IDE

  1. Open the Arduino IDE, click on the file in the top left corner, and select Preferences
    RoArm-M1 Tutorial04.jpg
  2. Add the following link to the attached board manager URL, and then click OK
    https://github.com/earlephilhower/arduino-pico/releases/download/4.0.2/package_rp2040_index.json

    RoArm-M1 Tutorial II05.jpg
    Note: If you already have an ESP32 board URL, you can use a comma to separate the URLs as follows:

    https://dl.espressif.com/dl/package_esp32_index.json,https://github.com/earlephilhower/arduino-pico/releases/download/4.0.2/package_rp2040_index.json
  3. Click Tools > Development Board > Board Manager > Search pico, as my computer has already been installed, it shows that it is installed
    Pico Get Start 05.png
    Pico Get Start 06.png

Upload Demo at the First Time

  1. 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 after the computer recognizes a removable hard disk (RPI-RP2).
    Pico Get Start.gif
  2. Download the program and open D1-LED.ino under the arduino\PWM\D1-LED path
  3. Click Tools --> Port, remember the existing COM, do not click this COM (the COM displayed is different on different computers, remember the COM on your own computer)
    UGV1 doenload02EN.png
  4. Connect the driver board to the computer using a USB cable. Then, go to Tools > Port. For the first connection, select uf2 Board. After uploading, when you connect again, an additional COM port will appear
    UGV1 doenload03EN.png
  5. Click Tools > Development Board > Raspberry Pi Pico > Raspberry Pi Pico or Raspberry Pi Pico 2
    Pico Get Start02.png
  6. After setting it up, click the right arrow to upload the program
    Pico Get Start03.png
  • If issues arise during this period, and if you need to reinstall or update the Arduino IDE version, it is necessary to uninstall the Arduino IDE completely. After uninstalling the software, you need to manually delete all contents within the C:\Users\[name]\AppData\Local\Arduino15 folder (you need to show hidden files to see this folder). Then, proceed with a fresh installation.

Open Source Demos

MircoPython video demo (github)
MicroPython firmware/Blink demos (C)
Raspberry Pi official C/C++ demo (github)
Raspberry Pi official micropython demo (github)
Arduino official C/C++ demo (github)


C/C++ SDK Demo User Guide

1. GPIO

D0:Key

  • Project file address: /c/1.GPIO/D0-KEY

Demo Effect

  1. When the button is pressed, the LED turns on synchronously.
  2. When the button is released, the LED turns off and the pressed time is output in the serial port.

D1:LED

  • Project file address: /c/1.GPIO/D1-LED

Demo Effect

  1. LED cycle flashes at 1Hz frequency.

2. PWM

D1:LED

  • Project file address: /c/2.PWM/D1-LED

Demo Effect

  1. The LED cycle flashes at a frequency of 2.5KHz, every 10ms as an interval, increasing or decreasing the duty cycle by 1%, to achieve the breathing light effect.

D2:BUZZER

  • Project file address: /c/2.PWM/D2-BUZZER

Demo Effect

  1. The passive buzzer has a duty cycle of 30% and a frequency between 600Hz-1.4KHz to achieve a siren-like sound effect.

3. I2C

I2C1: LED

  • Project file effect: /c/3.I2C/I2C1-OLED

Demo Effect

  1. 1.5-inch OLED displays graphic test interface and keeps 1s.
  2. 1.5-inch OLED displays titles and stripes of different grayscale and keeps them.

I2C0:6-DOF

  • Project file effect: /c/3.I2C/I2C0-6-DOF

Demo Effect

  1. 1.5-inch OLED displays title, accelerometer, and gyroscope readings.
  2. Move or turn the board at this time, you can see the value change.

I2C0:VOC

  • Project file address: /c/3.I2C/I2C0-VOC

Demo Effect

  1. 1.5-inch OLED display title and VOC reading.
  2. Wait for about 3 seconds, the VOC reading will increase slowly and finally stabilize at a stable value, with an average of about 100 and a maximum of 500. The larger the value, the worse the air quality.
  3. At this time, blow a breath to the VOC sensor, and the value will gradually increase, and then gradually decrease.

I2C0:EEPROM

  • Project file address: /c/3.I2C/I2C0-EEPROM

Demo Effect

  1. 1.5-inch OLED display title and reset times.
  2. The reset count is read from the EEPROM and verified by CRC8, each reset or restart will add one to the display value.

I2C0:SHTC3

  • Project file address: /c/3.I2C/I2C0-SHTC3

Demo Effect

  1. 1.5-inch OLED display title, chip ID, and temperature and humidity readings.

I2C0:MOTOR DRIVER

  • Project file address: /c/3.I2C/I2C0-MOTOR-DRIVER

Demo Effect

  1. Drive the motors on the four ports A, B, C, and D to rotate forward for one second in turn, and the duty cycles are 25%, 50%, 75%, and 100% respectively.

4. ADC

ADC0:LDR

  • Project file address: /c/4.ADC/ADC0-ADC0-LDR

Demo Effect

  1. Output the current voltage on the photoresistor via the serial port every second.

ADC1:VOL ADJ

  • Project file address: /c/4.ADC/ADC1-ADC1-VOL-ADJ

Demo Effect

  1. Output the voltage on the current potentiometer by the serial port every second.

ADC2:SOUND

  • Project file address: /c/4.ADC/ADC2-SOUND

Demo Effect

  1. Output the current sound sensor output voltage and DC output value through the serial port every 0.1 seconds.
  • PS: Because sound is a sound wave generated by vibration, the voltage value obtained by the sound sensor is not stable, so the output voltage cannot be directly linked to the volume.

5. PIO

D3:IR RX

  • Project file address: /c/5.PIO/D3-IR-RX

Demo Effect

  1. Waiting for the signal from the infrared remote control.
  2. After receiving the infrared remote control signal, decode and output the data via the serial port.

D4:IR TX

  • Project file address: /c/5.PIO/D4-IR-TX

Demo Effect

  1. Transmit a signal with the address 0 x 00 and the command 0 x 00 conforming to the NEC protocol by the infrared transmitter module every 1 second.

D7:RGB LED

  • Project file address: /c/5.PIO/D7-RGB-LED

Demo Effect

  1. RGB cycle gradient color.

MircoPython

1. GPIO

D0:Key

  • Project file address: /python/GPIO/D0-KEY

Demo Effect

  1. When the key is pressed, the command line output key is pressed.
  2. When the key is released, the command line outputs the pressing time.

D1:LED

  • Project file address: /python/GPIO/D1-LED

Demo Effect

  1. LED cycle flashes at 1Hz frequency.

D2:IR RX

  • Project file address: /python/GPIO/D2-BUZZER

Demo Effect

  1. The passive buzzer has a duty cycle of 30% and a frequency between 600Hz-1.4KHz to achieve a siren-like sound effect.

D3:IR RX

  • Project file address: /python/GPIO/D3-IR-RX.
  • Before running the demo, you need to upload ir_rx in the project folder to pico.

Demo Effect

  1. Waiting for the signal from the infrared remote control.
  2. After receiving the signal from the infrared remote control, decode and output the data through the command line.

D4:IR TX

  • Project file address: /python/GPIO/D4-IR-TX
  • Before running the demo, you need to upload the ir_tx in the project folder to pico.

Demo Effect

  1. Each time the button module is pressed, the infrared transmitter module will emit a signal conforming to the NEC protocol with the address 0 x 01 and the command 0 x 07.

D7:RGB LED

  • Project file address: /python/GPIO/D7-RGB-LED

Demo Effect

  1. RGB cycle gradient color.

2. ADC

ADC0:LDR

  • Project file address: /python/ADC/ADC0-LDR

Demo Effect

  1. Output the current voltage on the photoresistor by the command line every second.

ADC1:VOL ADJ

  • Project file address: /python/ADC/ADC1-VOL-ADJ

Demo Effect

  1. Output the voltage on the current potentiometer every second through the command line.

ADC2:SOUND

  • Project file address: /python/ADC/ADC2-SOUND

Demo Effect

  1. Output the current sound sensor output voltage and DC output value by the command line every 0.3 seconds.
  • PS: Because sound is a sound wave generated by vibration, the voltage value obtained by the sound sensor is not stable, so the output voltage cannot be directly linked to the volume.

3. I2C

I2C1:OLED

  • Project file address: /python/I2C/I2C1-OLED

Demo Effect

  1. 1.5-inch OLED displays titles and stripes of different grayscale and keeps them.

I2C0:6-DOF

  • Project file address: /python/I2C/I2C0-6-DOF

Demo Effect

  1. Output acceleration and gyroscope readings by the command line every 0.5S.
  2. Move or turn the board at this time, you can clearly see the value changes.

I2C0:VOC

  • Project file address: /python/I2C/I2C0-VOC
  • Before running the demo, you need to upload VOC_Algorithm.py in the project folder to pico.

Demo Effect

  1. Output VOC readings with the command line every 0.5s.
  2. Wait for about 3 seconds, the VOC reading will increase slowly and finally stabilize at a stable value, with an average of about 100 and a maximum of 500. The larger the value, the worse the air quality.
  3. At this time, blow a breath to the VOC sensor, and the value will gradually increase, and then gradually decrease.

I2C0:EEPROM

  • Project file address: /python/I2C/I2C0-EEPROM

Demo Effect

  1. Write "hello world!" to EEPROM.
  2. Then read the string from EEPROM and output it with the command line.

I2C0:SHTC3

  • Project file address: /python/I2C/I2C0-SHTC3

Demo Effect

  1. Output the current temperature and humidity readings with the command line every 0.5S.

I2C0:MOTOR DRIVER

  • Project file address: /python/I2C/I2C0-MOTOR-DRIVER

Demo Effect

  1. Drive the motors on the four ports A, B, C, and D to rotate forward for one second in turn, and the duty cycles are 25%, 50%, 75%, and 100% respectively.

Resource

Demo

Schematic

Datasheet

Development Software

FAQ

 Answer:

The problem should be caused by the speed setting in the codes.
You can increase the speed and test again.

{{{5}}}


 Answer:

I have the 4.1.2 version. Try this version if you want.
Thonny-version.png

{{{5}}}


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)