PICO-Cam-A
| ||
Overview
PICO-Cam-A is a high-performance microcontroller development board designed by Waveshare, which has 1.14inch LCD, Cam camera, buttons and other peripherals on board in a small board size, and is equipped with some GPIO and Debug interfaces, which is convenient for users to develop and embed the application into products.
Features
- RP2040 microcontroller chip designed by Raspberry Pi
- Dual-core ARM Cortex M0+ processor, flexible clock running up to 133 MHz
- 264KB of SRAM, and 16MB of onboard Flash memory
- Type-C connector, keeps it up to date, easier to use
- On-board HM01B0 grayscale camera
- Onboard 1.14inch 240×135 pixels 65K colorful IPS LCD for clear color pictures
- USB 1.1 with device and host support
- Support low-power sleep and hibernation modes
- Can be recognized as a large-capacity memory via USB for drag-and-drop download program
- 13 GPIO pins via 1.27mm pitch female header
- 2 × SPI, 2 × I2C, 2 × UART, 4 × 12-bit ADC, 13 × controllable PWM channel
- 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
Parameters
LCD Specifications | |||
Controller | ST7789V | Resolution | 135(H)RGB x 240(V) |
Communication Interface | SPI | Display Dimensions | 14.864(H)x 24.912(V)mm |
Display Panel | IPS | Pixel Size | 0.1101(H)x 0.1035(V)mm |
Pinout
Dimensions
Get Started with Pico
Introduction
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 the RP2040 and RP2350 series development boards developed by our company
- The default development environment is Windows. For other environments, please refer to the official website tutorial for installation
Install VSCode
-
Firstly, click to download pico-vscode package, unzip and open the package, double-click to install VSCode
Note: If vscode is already installed, check if the version is v1.87.0 or higher
Install extension
-
Click on EXTENSIONS, select Install from VSIX
-
Select the package with vsix suffix, click Install
-
Then vscode will automatically install Raspberry Pi Pico and its dependent extensions. You can click Refresh to view the installation progress
-
The bottom right corner shows installation completed, close vscode
Configure extension
-
Open the directory C:\Users\username and copy the entire .pico-sdk to that directory
-
The copy is completed
-
Open VSCode and configure various paths in the Raspberry Pi Pico extension
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
-
Configuration is completed, then create a new project. First enter the project name, select the path, and click Create to create the project
To test the official example, you can click Example next to the project name to select
-
The project was created successfully
-
Select SDK version
-
Select Yes for advanced configuration
-
Select the cross-compilation chain, 13.2.Rel1 is for ARM cores, RISCV.13.3 is for RISCV cores, and you can choose one of them according to your needs
-
Selects Default (the path configured earlier) for CMake version
-
Select Default for Ninja version
-
Select development board
-
Click Complie to compile
-
The uf2 format file is successfully compiled
Import project
- The Cmake file for importing the project cannot have Chinese (including comments), otherwise it may cause import failure
-
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
set(PICO_BOARD pico CACHE STRING "Board type")
Update extension
-
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
Open-source Demo
Sample Demo
C Demo
Burn Firmware
Way 1: Hold down the BOOT key and connect to the computer, release the BOOT key, a removable disk will appear on the computer, copy the firmware library with suffix .uf2 into it.
Way 2: After connecting the computer, press the BOOT key and RESET key at the same time, release the RESET key and then release the BOOT key, the computer will appear a removable disk, copy the firmware library with the suffix .uf2 into it.
Code Analysis
Example Explanation
This example primarily involves capturing images through the camera and displaying them on a 1.14-inch LCD. The demo utilizes multi-core processing, with Core 1 responsible for acquiring image data and image processing, while Core 0 handles the image display.
Core 1 Code Explanation
- Data Pushing
multicore_fifo_push_blocking() is a function provided by Pico SDK for pushing data to the FIFO (First In, First Out) queue of the multi-core system. Here, Core 1 will push the FLAG_VALUE to FIFO, and Core 0 will block to wait for the FLAG_VALUE data from Core 1 in the flow of execution.
multicore_fifo_push_blocking(FLAG_VALUE);
- Wait for Data
Core 1 blocks and waits for the data from Core 0.
uint32_t ack = multicore_fifo_pop_blocking();
- LCD Initialization
Call DEV_Module_Init() to initialize the pins and buttons related to the LCD, and call LCD_1IN14_V2_Init() to initialize the LCD.
DEV_Module_Init(); LCD_1IN14_V2_Init(HORIZONTAL); LCD_1IN14_V2_Clear(BLACK); UDOUBLE Imagesize = LCD_1IN14_V2_HEIGHT * LCD_1IN14_V2_WIDTH * 2; UWORD *BlackImage; if ((BlackImage = (UWORD *)malloc(Imagesize)) == NULL) { printf("Failed to apply for black memory...\r\n"); exit(0); }
- Display Image
Call Paint_DrawImage() to draw images, and call LCD_1IN14_V2_Display() to display the images on the LCD.
Paint_NewImage((UBYTE *)BlackImage, LCD_1IN14_V2.WIDTH, LCD_1IN14_V2.HEIGHT, 0, WHITE); Paint_SetScale(65); Paint_SetRotate(ROTATE_0); Paint_DrawImage(gImage_waveshare, 0, 0, 240, 135); LCD_1IN14_V2_Display(BlackImage); DEV_Delay_ms(500);
- Camera Initialization
This code segment calls cam_config_struct() to initialize the camera configuration structure "config" and then proceeds to initialize the camera by calling cam_init().
struct cam_config config; cam_config_struct(&config); cam_init(&config);
- Image Processing
This code segment is a loop where the camera captures a frame in each iteration, processes the image, and ultimately stores the processed image data in "displayBuf". The "imageReady" flag is then set to 1, indicating that the image is ready for display.
while (true) { cam_capture_frame(&config); uint16_t index = 0; for (int y = 134; y > 0; y--) { for (int x = 0; x < 240; x++) { uint16_t c = image_buf[(y)*324+(x)]; uint16_t imageRGB = (((c & 0xF8) << 8) | ((c & 0xFC) << 3) | ((c & 0xF8) >> 3)); displayBuf[index++] = (uint16_t)(imageRGB >> 8) & 0xFF; displayBuf[index++] = (uint16_t)(imageRGB) & 0xFF; } } imageReady = 1; }
Core 0 Code Explanation
- Boot Core1
multicore_launch_core1 is the function provided by Pico SDK for booting Core 1 on the Raspberry Pi Pico. This code start Core 1 to execute the specified function through calling multicore_launch_core1().
multicore_launch_core1(core1_entry);
- Wait for data
Core 0 blocks and waits for data from Core 1, if data FLAG_VALUE is successfully received then send data to Core 1.
uint32_t ack = multicore_fifo_pop_blocking(); if (ack != FLAG_VALUE) printf("Error: Core 0 failed to receive acknowledgment from core 1!\n"); else { multicore_fifo_push_blocking(FLAG_VALUE); printf("Success: Core 0 Received acknowledgment from core 1!\n"); }
- Main Loop
Continuously checks the "imageReady" flag in the main loop. Once the flag is detected as 1, indicating that the image is ready for display, it calls LCD_1IN14_V2_Display() to show the image. After the display, it resets the "imageReady" flag to 0.
while (1) { if (imageReady == 1) { LCD_1IN14_V2_Display((uint16_t*)displayBuf); // Reset the imageReady flag after displaying the image imageReady = 0; } DEV_Delay_ms(1); }
Run the Demo
- Burn the firmware, and the PICO-Cam-A will display the boot interface after powering on, and then display the footage captured by the camera in real time.
Resource
Demo
Document
Drawing
Official Resources
Raspberry Pi Official Datasheet
- Raspberry Pi Related Books Download
- Get Started With Pico Manual
- Pico C SDK User Manual
- Raspberry Pi Pico Schematic
- Pico Pinout
- Pico Datasheet
- Rp2040 Datasheet
- Hardware Design Manual
Raspberry Pi Open-source Demo
Development Software
- Zimo221.7z
- Image2Lcd.7z
- Font Library Tutorial
- Image Extraction Tutorial
- Thonny Python IDE (Windows V3.3.3)
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)