Raspberry-Pi-Pico-Kit-B
| ||
Raspberry Pico
Raspberry Pi Pico is a low-cost, high-performance microcontroller board with flexible digital interfaces. It incorporates Raspberry Pi's own RP2040 microcontroller chip, with a dual-core Arm Cortex M0+ processor running up to 133 MHz, embedded 264KB of SRAM, and 2MB of onboard Flash memory, as well as 26x multi-function GPIO pins.
For software development, either Raspberry Pi's C/C++ SDK or the MicroPython is available. There are also complete development resources and tutorials to help you get started easily, and integrate it into end products quickly.
Details of the Start Kit
- Raspberry Pi Pico with pre-soldered header x1
- Pico-LCD-1.14 x 1
- Pico-10DOF-IMU x 1
- Breadboard x1
- 1*3PIN yellow pin header x 1
- Pico-Dual-Expander x 1
- USB-A to micro-B cable x 1
- Jumper wires x 1
Features
- RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom
- Dual-core Arm Cortex M0+ processor, the flexible clock running up to 133 MHz
- 264KB of SRAM, and 2MB of onboard Flash memory
- Castellated module allows soldering direct to carrier boards
- USB 1.1 with device and host support
- Low-power sleep and dormant modes
- Drag-and-drop programming using mass storage over USB
- 26 × multi-function GPIO pins
- 2 × SPI, 2 × I2C, 2 × UART, 3 × 12-bit ADC, 16 × controllable PWM channels
- Accurate clock and timer on-chip
- Temperature sensor
- Accelerated floating-point libraries on-chip
- 8 × Programmable I/O (PIO) state machines for custom peripheral support
Pinout
Pico-10DOF-IMU
Feature
- Standard Raspberry Pi Pico header supports Raspberry Pi Pico series.
- Onboard MPU9250 (3-axis gyroscope, 3-axis accelerometer, and 3-axis magnetometer) for detecting motion gesture, orientation, and magnetic field.
- Onboard LPS22HB barometric pressure sensor, for sensing the atmospheric pressure of the environment.
Specifications
- Operating voltage: 5V
- Accelerometer:
- resolution: 16-bit
- measuring range (configurable): ±2, ±4, ±8, ±16g
- operating current: 68.9uA
- Gyroscope:
- resolution: 16-bit
- measuring range (configurable): ±250, ±500, ±1000, ±2000°/sec
- operating current: 1.23mA
- Magnetometer:
- resolution: 14-bit
- measuring range: ±4800µT
- operating current: 280uA
- Baroceptor
- measuring range: 260 ~ 1260hPa
- measuring accuracy (ordinary temperature): ±0.025hPa
- measuring speed: 1Hz - 75Hz
Pinout
Pico LCD 1.14
Features
- 240 × 135 resolution, IPS screen, 65K RGB colors, clear and colorful displaying effect.
- SPI interface, requires minimal IO pins.
- 4 x user buttons for easy interacting.
Specifications
- Operating voltage: 2.6~5.5V
- Resolution: 240 x 135 pixels
- Communication interface: 4-wire SPI
- Display size: 24.91 x 14.86mm
- Display panel: IPS
- Pixel size: 0.1101 x 0.1035mm
- Driver: ST7789
- Dimensions 52.00 x 25.00mm
Pinout
Dimension
LCD and the controller
The ST7789VW is a single-chip controller/driver for 262K-color, graphic type TFT-LCD. It consists of 240
source line and 320 gate line driving circuits. The resolution of this LCD is 135 (H) RGB x 240 (V), it supports horizontal mode and vertical mode, and it doesn't use all the RAM of the controller.
This LCD accepts 8-bits/9-bits/16-bits/18-bits parallel interface, that are RGB444, RGB565, RGB666. The color format used in demo codes is RGB565.
This LCD uses a 4-line SPI interface for reducing GPIO and fast speed.
Working Protocol
Note: Different from the traditional SPI protocol, the data line from the slave to the master is hidden since the device only has a display requirement.
RESX is the reset pin, it should be low when powering the module and be higher at other times;
CSX is slave chip select, when CS is low, the chip is enabled.
D/CX is data/command control pin, when DC = 0, write command, when DC = 1, write data
SDA is the data pin for transmitting RGB data, it works as the MOSI pin of SPI interface;
SCL work s the SCLK pins of SPI interface.
SPI communication has data transfer timing, which is combined by CPHA and CPOL.
CPOL determines the level of the serial synchronous clock at an idle state. When CPOL = 0, the level is Low. However, CPOL has little effect on the transmission.
CPHA determines whether data is collected at the first clock edge or at the second clock edge of the serial synchronous clock; when CPHL = 0, data is collected at the first clock edge.
There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.
Software Setup
Please follow the guides of Raspberry Pi to install and set up Pico for the Pico.
For easy use, we recommend you use the Thonny tool.
- Thonny website
- Please set the Thonny development environment to be RaspberryPi when setting
Hardware Connection
Please take care of the direction when you connect Pico, an USB port is printed to indicate. You can also check the pin of Pico and the LCD board when connecting.
You can connect the display according to the table.
LCD | Pico | Description |
VCC | VSYS | Power Input |
GND | GND | GND |
MPU.INT | GP2 | INT pin of MPU9250 |
LPS.INT | GP3 | INT pin of LPS22HB |
SDA | GP6 | SDA pin of I2C |
SCL | GP7 | SCL pin of I2C |
FSYNC | GP22 | FSYNC pin of MPU9250 |
Connect the expansion board
Download the examples
Open a Raspberry Pi terminal and run the following commands:
sudo apt-get install p7zip-full cd ~ sudo wget https://www.waveshare.com/w/upload/c/c5/Pico-Kit-B-code.7z 7z x Pico-Kit-B-code.7z -o./Pico-Kit-B-code cd ~/Pico-Kit-B-code cd c/build/
How to use
C Example
Go to the directory of C example and build it
cd ~/Pico-Kit-B-code/c/
Create the build folder and enter it. add the SDK:
../../pico-sdk #should be the path of the SDK according to the actual situation.
We have created the build folder in the example, you can just enter it.
cd build export PICO_SDK_PATH=../../pico-sdk (Note: Please check if you set the correct path of SDK, it maybe different for different users)
Run cmake to generate the Makefile
cmake ..
Run make to build the example, it will takes minutes.
make -j9
uf2 is generated after building.
Press and hold the button of the Pico board, and then connect the Pico to your Raspberry Pi or PC by USB cable, then release the button. Then copy the main.uf2 file which is saved in the build folder to the Pico (It should be recognized as a portable drive, which is named RPI-RP2).
Python example
Work with windows PC
- 1. Press and hold the BOOTSET button of Pico, and connect the Pico to your PC by USB cable. Release the button if the Pico is recognized as a portable drive.
- 2.Copy the rp2-pico-20210205-unstable-v1.14-8-g1f800cac3.uf2 from the python directory to the Pico.
- 3.Open Thonny IDE (Note: Please use the newest version).
- 4.Click Tools->Options->Interpreter and choose the Port of Pico (you can check it in the Device Manager).
- 5. Click File->Open..., choose Raspberry-Pi-Pico-Kit-B.py, and run it.
Working with Raspberry Pi
- 1.The steps to download the firmware is the same as Windows PC. Copy the rp2-pico-20210205-unstable-v1.14-8-g1f800cac3.uf2 to Pico.
- 2.Open the Thonny IDE in Raspberry Pi(Menu -> Programming -> Thonny Python IDE , you can check the version information in Help->About Thonny make sure that it is the version which support Pico.
- 3.Click Tools -> Options... -> Interpreter to choose the MicroPython(Raspberry Pi Pico and the ttyACM0 port.
Please update the Thonny IDE if the pre-installed one doesn't support Pico.
sudo apt upgrade thonny
- 3.Click File->Open...->Pico-Kit-B-code/python/Raspberry-Pi-Pico-Kit-B.py and run the codes.
Expected result
- 1. The LCD keeps blank if you didn't run the demo codes;
- 2. After running the codes, the LCD turns on and displays the data which is collected by the Pico-10DOF-IMU.
Resource
Raspberry Pi
- Raspberry Pi Pico Get Started with MicroPython on Raspberry Pi Pico
- Official website of Pico
- Getting started with Pico
- Pico C SDK
- Pico Python SDK
- Pico Pinout
- Pico Datasheet
- RP2040 Datasheet
- RP2040 Hardware design
Examples
- MicroPython firmware/Blink demo (C)
- Raspberry Pi official Pico data link
- MircoPython demo video (github)
- MicroPython firmware/Blink demo(C)
- Raspberry Pi C/C++ demo (github)
- Raspberry Pi micropython demo (github)