Beetle RP2350 Microcontroller Wiki - DFRobot

Introduction

The Beetle RP2350 is a high-performance, mini-sized development board designed based on the RP2350 chip. This development board is only the size of a coin (25*20.5mm) and is specifically designed for space-constrained embedded applications.

High-Performance Raspberry Pi RP2350 Chip

The RP2350 is a high-performance, secure microcontroller newly launched by Raspberry Pi. This microcontroller boasts a unique dual-core, dual-architecture design, allowing the choice between an Arm Cortex-M33 or a Hazard3 RISC-V kernel. The RP2350 features a 150MHz frequency, 520KB RAM, and 2MB Flash, capable of handling a large amount of high-speed data.

Highly Integrated, Ultra-Small Size

The Beetle RP2350 brings out numerous interfaces including 11 IO, BAT, 3.3V, etc. on a coin-sized volume, providing ample IO and convenient power connections for project creation. The Beetle RP2350 has a sleep power consumption of only uA, allowing for long-term operation with a battery. At the same time, the Beetle RP2350 also integrates lithium battery charging and battery voltage monitoring functions. It can charge and monitor the power of lithium batteries, taking measures when the power is insufficient to ensure the continuous operation of the device.

Easy to Program, Easy to Integrate

The Beetle RP2350 supports C/C++, MicroPython programming, enabling more efficient development processes by choosing familiar programming languages. All the devices of the Beetle RP2350 are on one side and adopt a semi-hole design, making it suitable for SMT designs and facilitating large-scale integration.

Features

Application

Specifications

Function Pin Diagram

Function Indication

No. Function Name Function Description
Type-C USB Interface Download program and power supply interface, supports 4.75V~5.5V
RST Button Click the reset button to reset the program
Lithium Battery Interface Supports 3.7V~4.2V
On-board LED LED controlled by IO25 pin
Charging Indicator Light Green LED that indicates charging status. It indicates the charging status in three ways: 1. Off when fully charged or not connected to power; 2. On when charging; 3. High-frequency flashing when USB powered and no lithium battery connected
User Button This button is controlled by the QSPI_SS pin
RP2350 Chip Chip model is RP2350A_QFN60

Pin Indication

Pin Overview

Pin Number Digital Port Analog Port UART I2C SPI Other
0 D0 TX1
1 D1 RX1
4 D4 SDA
5 D5 SCL
8 D8 TX2
9 D9 RX2
16 D16 SPI0/MISO
18 D18 SPI0/SCK
19 D19 SPI0/MOSI
26 D26 A0
27 D27 A1
BAT Lithium battery input interface, IO29 is the battery voltage detection pin
GND Ground pin
VCC This pin is connected to the USB power pin. When used as an output, the voltage is the USB voltage, usually 5V
3V3 3.3V regulated power output

Dimension Diagram

Arduino Tutorial

Preparations

Download Arduino IDE

Click to visit the Arduino official website to download Arduino IDE Choose the suitable IDE package according to your computer system.

Download and Install SDK

Click the "File" menu, then click "Preferences" to enter the Preferences window.

In the Preferences window, click the icon indicated by the arrow in the image.

In the pop-up window, add the JSON link on a new line:

https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

Download SDK

Follow the steps shown in the image to click the drop-down menu and enter the "Board Management" window.

In the search box, type "RP2350" to find and install the SDK named "Raspberry Pi Pico/RP2040/RP2350" as shown by the arrow in the image.

Select Development Board

Click the Tools menu and select the "Generic RP2350" development board as shown in the image.

At this point, the Beetle RP2350 SDK installation is complete and ready to use.

In this section, we will start using the Beetle RP2350 mainboard by lighting up an LED.

Hardware Preparation:

Function Description:

There is an LED on the lower right corner of the Beetle RP2350's main chip, next to which is a silk screen marked "L/25". This LED is used to quickly verify the main control board and code. As shown in the figure:

Example Program:

Program Function: The on-board LED flashes at an interval of one second.

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);//Set the pin to output mode
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH); //Output high level, light up the LED
  delay(1000);                    // Delay for one second
  digitalWrite(LED_BUILTIN, LOW);  //Output low level, turn off the LED 
  delay(1000);                   //Delay for one second    
}

Program Execution Result:

When the program is uploaded successfully, the on-board LED flashes repeatedly at 1-second intervals.

GPIO

Digital Pins

Write Digital Pins

Hardware Preparation:

Hardware Connection:

Example Program:

Program Function: Digital pin outputs high level, lighting up the LED.

int ledPin = 4; //  Define LED pin
void setup(){
   pinMode(ledPin, OUTPUT); 
   digitalWrite(ledPin, HIGH);
}

void loop(){
}

Program Execution Result:

After the program is uploaded, you can see the blue LED light up.

Read Digital Pins

Hardware Preparation:

Hardware Connection:

Example Program:

Program Function: When the button is pressed, the on-board LED lights up. When the button is released, the LED goes out.

int buttonPin = 4;   //  Define button pin
int ledPin = 25;     //Define LED pin
int buttonState = 0;  //Variable for reading button state

void setup(){
   pinMode(buttonPin, INPUT); 
   pinMode(ledPin, OUTPUT);
}

void loop(){
   buttonState = digitalRead(buttonPin); //Read the value of the button

   if(buttonState == HIGH){    //Check if the button is pressed
     digitalWrite(ledPin,HIGH);
   } else{
     digitalWrite(ledPin,LOW);
   }
}

Program Execution Result:

After the program is uploaded, press the button connected to D7, the on-board LED will light up, and when the button is released, the LED will go out.

Analog Pins

Read Analog Pins

Hardware Preparation:

Function Description:

ADC (Analog-to-Digital Converter, also known as A/D converter), is a way to convert analog signals into digital signals. Real-world analog signals, such as temperature, pressure, sound or images, etc., need to be converted into a more easily stored, processed and transmitted digital form. The ADC of Beetle RP2350 is 10-bit, with a maximum output value of 1023.

Hardware Connection:

Example Program:

The following program will read the sensor module connected to the IO27/A1 pin, and then print the value of the analog angle sensor in the serial monitor in real time.

const int analogInPin = A0;  
int sensorValue = 0;        

void setup() {
  Serial.begin(9600);
}

void loop() {
  sensorValue = analogRead(analogInPin);
  Serial.println("sensor = ");
  Serial.println(sensorValue);
  delay(200);
}

Program Execution Result:

Open the serial monitor, you can see the window prints the current value of the angle sensor. Rotate the angle sensor, and the printed value changes accordingly.

PWM Output (Analog Write)

PWM (Pulse Width Modulation) is a very effective technique that uses the digital interface of the MCU to control the analog circuit by pulse width modulation. It is widely used in many fields such as light control, motor speed control, measurement, communication to power control and conversion.

All 11 GPIOs of Beetle RP2350 support PWM output. In the Arduino development environment, PWM output is defined as analog output, and the analogWrite() function is used for control. The range of PWM values is 0~255 .

The following example will demonstrate using PWM to drive the on-board LED to show a breathing light status. This example does not require external hardware connection.

void setup(){
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop(){

byte value;

  for (value=0; value<255; value++)
  { 
    analogWrite(LED_BUILTIN, value);
    delay(10);
  } 

  for (value=255; value>0; value--)
  { 
    analogWrite(LED_BUILTIN, value);
    delay(10);
  }  
}

Program Execution Result:

After the program is downloaded, the intensity of the blue LED on the board shows a gradually brightening and then gradually dimming breathing state.

UART Communication

In the Arduino development environment, the Beetle RP2350 defaults to 2 sets of UART communication interfaces: UART1, UART2

The following is the definition of the UART interface in the RP2350:

#define PIN_SERIAL1_TX (0u)
#define PIN_SERIAL1_RX (1u)

#define PIN_SERIAL2_TX (8u)
#define PIN_SERIAL2_RX (9u)

The following example will demonstrate using UART1 to read the value of the UART interface sensor. And print it out in the serial monitor of Arduino IDE. In this case, the GR10-30 gesture recognition sensor (SEN0543) is used. This sensor supports UART and I2C two communication methods and can detect 12 kinds of gestures.

Hardware Preparation:

Hardware Connection:

Software Preparation:

Example Program:

Code functionality: Read the type of 12 gestures and print it on the serial port

#include "DFRobot_GR10_30.h"

DFRobot_GR10_30 gr10_30(GR10_30_DEVICE_ADDR, &Serial2);

void setup() {
  Serial2.begin(9600);
  Serial.begin(115200);

  while(gr10_30.begin() != 0){
    Serial.println(" Sensor initialize failed!!");
    delay(1000);
  }

  Serial.println(" Sensor  initialize success!!");
  gr10_30.enGestures(GESTURE_UP|GESTURE_DOWN|GESTURE_LEFT|GESTURE_RIGHT|GESTURE_FORWARD|GESTURE_BACKWARD|GESTURE_CLOCKWISE|GESTURE_COUNTERCLOCKWISE|GESTURE_CLOCKWISE_C|GESTURE_COUNTERCLOCKWISE_C);
}

void loop() {
  if(gr10_30.getDataReady()){
    uint16_t  gestures = gr10_30.getGesturesState();
    if(gestures&GESTURE_UP){
      Serial.println("Up");
    }
    if(gestures&GESTURE_DOWN){
      Serial.println("Down");
    }
    if(gestures&GESTURE_LEFT){
      Serial.println("Left");
    }
    if(gestures&GESTURE_RIGHT){
      Serial.println("Right");
    }
    if(gestures&GESTURE_FORWARD){
      Serial.println("Forward");
    }
    if(gestures&GESTURE_BACKWARD){
      Serial.println("Backward");
    }
    if(gestures&GESTURE_CLOCKWISE){
      Serial.println("Clockwise");
    }
    if(gestures&GESTURE_COUNTERCLOCKWISE){
      Serial.println("Contrarotate");
    }
    if(gestures&GESTURE_CLOCKWISE_C){
      Serial.println("Continuous clockwise");
    }
    if(gestures&GESTURE_COUNTERCLOCKWISE_C){
      Serial.println("Continuous counterclockwise");
    }
  }
  delay(1);
}

Program Execution Result:

Open the Arduino IDE serial monitor, the monitor window correctly printed out the sensor data.

I2C Communication

The I2C bus is a simple, two-way, two-wire synchronous bus developed by Philips. It only requires two wires to transmit information between devices connected to the bus.

Beetle RP2350 provides 1 set of I2C communication interface: I2C0. The pin distribution is as follows:

Pin Number I2C Function
4 I2C0/SDA
5 I2C0/SCL

In Arduino, I2C0 is used as the default I2C interface, the following example will demonstrate using the I2C interface to read 12 gestures of the GR10-30 Gesture Recognition Sensor (SEN0543). This sensor supports 3.3V~5V power supply, UART and I2C two communication methods, and has Arduino library for direct use. Other I2C devices are used in a similar way.

Hardware Preparation:

Hardware Connection:

Software Preparation:

Example Program:

Code functionality: Read the type of 12 gestures and print it on the serial port

#include "DFRobot_GR10_30.h"

DFRobot_GR10_30 gr10_30(GR10_30_DEVICE_ADDR, &Wire);

void setup() {
  Wire.begin();
  Serial.begin(115200);

  while(gr10_30.begin() != 0){
    Serial.println(" Sensor initialize failed!!");
    delay(1000);
  }

  Serial.println(" Sensor  initialize success!!");
  gr10_30.enGestures(GESTURE_UP|GESTURE_DOWN|GESTURE_LEFT|GESTURE_RIGHT|GESTURE_FORWARD|GESTURE_BACKWARD|GESTURE_CLOCKWISE|GESTURE_COUNTERCLOCKWISE|GESTURE_CLOCKWISE_C|GESTURE_COUNTERCLOCKWISE_C);
}

void loop() {
  if(gr10_30.getDataReady()){
    uint16_t  gestures = gr10_30.getGesturesState();
    if(gestures&GESTURE_UP){
      Serial.println("Up");
    }
    if(gestures&GESTURE_DOWN){
      Serial.println("Down");
    }
    if(gestures&GESTURE_LEFT){
      Serial.println("Left");
    }
    if(gestures&GESTURE_RIGHT){
      Serial.println("Right");
    }
    if(gestures&GESTURE_FORWARD){
      Serial.println("Forward");
    }
    if(gestures&GESTURE_BACKWARD){
      Serial.println("Backward");
    }
    if(gestures&GESTURE_CLOCKWISE){
      Serial.println("Clockwise");
    }
    if(gestures&GESTURE_COUNTERCLOCKWISE){
      Serial.println("Contrarotate");
    }
    if(gestures&GESTURE_CLOCKWISE_C){
      Serial.println("Continuous clockwise");
    }
    if(gestures&GESTURE_COUNTERCLOCKWISE_C){
      Serial.println("Continuous counterclockwise");
    }
  }
  delay(1);
}

Program Execution Result:

Open the Arduino IDE serial monitor, the monitor window correctly printed out the sensor data.

SPI Communication

The SPI interface, full name Serial Peripheral Interface, is a simple, two-way serial interface developed by Motorola. It can enable the microcontroller to communicate with various peripheral devices in a serial manner to exchange information. Peripheral devices include Flash, RAM, LCD displays, A/D converters, and MCUs, etc.

The SPI communication interface pin distribution of Beetle RP2350 is as follows:

Pin Number SPI Function
16 SPI0/MISO
18 SPI0/SCK
19 SPI0/MOSI

The following example will demonstrate how to use SPI to drive an LCD display to display patterns. In this case, a 2.0" 320x240 IPS wide-angle TFT display (DFR0664) is used.

Hardware Preparation:

Hardware Connection:

Beetle RP2350: GND (connects to) Display: GND

Beetle RP2350: 3V3 (connects to) Display: VCC

Beetle RP2350: 4 (connects to) Display: DC

Beetle RP2350: 5 (connects to) Display: CS

Beetle RP2350: 8 (connects to) Display: RST

Beetle RP2350: 16 (connects to) Display: MISO

Beetle RP2350: 18 (connects to) Display: SCK

Beetle RP2350: 19 (connects to) Display: MOSI

Software Preparation:

Example Program:

Code functionality: Display the text "DFRobot" on the LCD display connected to the SPI interface of RP2350.

#define PIN_SPI0_MISO  (16u)
#define PIN_SPI0_MOSI  (19u)
#define PIN_SPI0_SCK   (18u)
Code:
#include "DFRobot_GDL.h"

#define TFT_DC  4
#define TFT_CS  5
#define TFT_RST 8

DFRobot_ST7789_240x320_HW_SPI screen(/*dc=*/TFT_DC,/*cs=*/TFT_CS,/*rst=*/TFT_RST);

void setup() {
  screen.begin();
  screen.setTextSize(1);
  screen.fillScreen(COLOR_RGB565_BLACK);
  screen.setFont(&FreeMono12pt7b);
  screen.setCursor(/*x=*/32,/*y=*/64);
  screen.setTextColor(COLOR_RGB565_LGRAY);
     screen.setTextWrap(true);
  screen.print("DFRobot");
}

void loop() {

}

Execution Result

The screen displays the character "DFRobot".

More Resources for Download

Frequently Asked Questions (FAQ)

There are no customer questions for this product yet, feel free to contact us via QQ or forum!

For more questions and interesting applications, you can visit the forum for reference or posting.

DFshopping_car1.png [DFRobot store purchase link](