本帖最后由 无垠的广袤 于 2025-5-1 15:38 编辑
本文介绍了 DFRobot Beetle RP2350 开发板的扩展板设计,包括参数特点、效果展示、原理图、实物验证、工程测试等,为 RP2350 系列产品的开发提供了便捷。
参数为 Beetle RP2350 开发板的快速开发和DIY应用设计提供了极大便利。
原理图
模块化设计,便于外设的连接与快速测试。
3D 效果
Top view外壳
3D 外壳设计不仅增强了美观度,而且提升了扩展板的便携性,并为其提供电气保护。
实物验证
包括 PCB 沉金板打印验证、工程测试等。
PCB 打板
工程测试
这里展示了 DHT11 传感器、OLED 和 ADC 功能的测试效果。
DHT11
测试 DHT11 温湿度传感器,实现环境温湿度数据的 OLED 显示。
代码
- '''
- Name: DHT11 temperature sensor and IIC OLED
- Version: v1.0
- Date: 2025.04
- Author: ljl
- Other: Acquiring temperature and humidity data and showing on OLED screen
- '''
-
- from machine import Pin
- from PicoDHT22 import PicoDHT22
- import utime
- # OLED
- from machine import Pin, SoftI2C
- import ssd1306
-
- # ==== Initialized IIC OLED ====
- i2c = SoftI2C(scl=Pin(5), sda=Pin(4))
- oled_width = 128
- oled_height = 64
- oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
-
- def display_TH(temp,humi):
- oled.fill(0) # 清屏
- oled.text("Temperature:", 0, 0)
- oled.text("{:.1f} C".format(temp), 20, 15)
- oled.text("Humidity:", 0, 35)
- oled.text("{:.1f} %".format(humi), 20, 50)
- oled.show()
-
- dht_sensor=PicoDHT22(Pin(0,Pin.IN,Pin.PULL_UP),dht11=True)
- while True:
- temp,humi = dht_sensor.read()
- if temp is None:
- print(" sensor error")
- else:
- print("Temp: {:.1f}°C Humi: {:.1f}%".format(temp,humi))
- # 显示到OLED
- display_TH(temp,humi)
- #DHT22 not responsive if delay to short
- utime.sleep_ms(500)
复制代码
ADC
测试 ADC 性能,通过 ADC 采集模拟通道信号电压,并转化为芯片温度,实现电压和温度数据的 OLED 显示。
代码
- '''
- Name: ADC voltage, temperature and IIC OLED display
- Version: v1.0
- Date: 2025.04
- Author: ljl
- Other: Acquiring voltage, temperature data by ADC and showing on OLED screen
- '''
-
- # ADC
- import machine
- import time
-
- # OLED
- from machine import Pin, SoftI2C
- import ssd1306
-
- # ==== Initialized IIC OLED ====
- i2c = SoftI2C(scl=Pin(5), sda=Pin(4))
- oled_width = 128
- oled_height = 64
- oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
-
- # ADC voltage and temperature
- sensor_temp = machine.ADC(4)
- conversion_factor = 3.3 / (65535)
- potentiometer = machine.ADC(26)
-
- def display_VT(vol,temp): # voltage and temperature
- oled.fill(0) # 清屏
- oled.text("Analog Voltage: ", 0, 0)
- oled.text("{:.2f} V".format(vol), 0, 15)
- oled.text("Sensor Temperature: ", 0, 35)
- oled.text("{:.2f} C".format(temp), 0, 50)
- oled.show()
-
- while True:
- try:
- vol = potentiometer.read_u16() * conversion_factor # voltage (V)
- reading = sensor_temp.read_u16() * conversion_factor
-
- temp = 27 - (reading - 0.706)/0.001721
- # 打印到串口
- print("Analog Voltage: {:.2f} V , Temperature: {:.2f} °C".format(vol,temp))
-
- # 显示到OLED
- display_VT(vol,temp)
-
- except Exception as e:
- print("Error:", e)
- oled.fill(0)
- oled.text("Error!", 0, 20)
- oled.show()
-
- time.sleep(1) # 每2秒更新一次
复制代码
总结
本文介绍了 DFRobot Beetle RP2350 开发板的扩展板设计,包括参数特点、效果展示、原理图、实物验证、工程测试等,为 RP2350 的开发和应用提供了参考。
|