sensor kit for Raspberry Pi Pico support MicroPython and RP2040

1-Now, you can buy your Pico sensor kit at Yahboom online store! Link: https://category.yahboom.net/products/pico-sensor-kit

What is MicroPython?

MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments.

MicroPython is packed full of advanced features such as an interactive prompt, arbitrary precision integers, closures, list comprehension, generators, exception handling and more. Yet it is compact enough to fit and run within just 256k of code space and 16k of RAM.

MicroPython aims to be as compatible with normal Python as possible to allow you to transfer code with ease from the desktop to a microcontroller or embedded system.

What is Raspberry Pi Pico?

Raspberry Pi Pico has been designed to be a low cost yet flexible development platform for RP2040, with the following key features:

  • RP2040 microcontroller chip designed by Raspberry Pi in the UK
  • Dual-core ARM Cortex M0+ processor, flexible clock running frequency up to 133Mhz
  • 264KB of SRAM and 2MB of on-board flash memory
  • Castellated module allows soldering direct to carrier boards
  • USB 1.1 with device and host support
  • Low-power sleep and dormant mode
  • Drag-and-drop programming using mass storage over USB
  • 26 x multi-function GPIO pins
  • 2 x SPI, 2 x I2C, 2 x UART, 3 x 12-bit ADC, 16 x controllable PWM channels
  • Accurate clock and timer on-chip
  • Temperature sensor
  • Accelerated floating-point libraries on-chip
  • 8 x Programmable I/O (PIO) state machines for custom peripheral support

For full details of the RP2040 microcontroller please see the RP2040 Datasheet

Yahboom sensor kit for Raspberry Pi Pico

◆ Part 1 -- Packing list

21 kinds of sensor moudle, 1 Raspberry Pi Pico sensor board, 40pcs Female-to male DuPont line, 40pcs Female-to female DuPont line, Micro USB cable, Raspberry Pi Pico board.

↑ Figure 1. sensor kit for Raspberry Pi Pico packing list

◆ Part 2 -- Experimental video show

◆ Part 3 -- Documents

http://www.yahboom.net/study/Pico-Sensor-Kit

◆ Part 4 -- Example of experiments (Distance and temperature-humidity detector)

Preparation

Raspberry Pi Pico board *1, Pico sensor board *1, PC *1, USB data cable *1, Ultrasonic module *1, OLED module *1, Temperature-humidity module *1, Male-to-male DuPont line *7

About wiring 

Code

import utime
from ultrasonic import ultrasonic
from dht11 import DHT11
from machine import Pin, I2C
i2c=I2C(0, scl=Pin(21),sda=Pin(20), freq=100000)
 
from ssd1306 import SSD1306_I2C
oled = SSD1306_I2C(128, 32, i2c)
 
#Initialize temperature and humidity pins
pin = Pin(22, Pin.OUT)
#Initialize the temperature and humidity library
dht11 = DHT11(pin)
 
#Initialize ultrasonic
Echo = Pin(13, Pin.IN)
Trig = Pin(14, Pin.OUT)
ultrasonic = ultrasonic(Trig, Echo)

while True:
    distance = ultrasonic.Distance_accurate() # Update the data detected by ultrasonic
    temperature = dht11.temperature # Update temperature value
    humdity = dht11.humidity        # Update humidity value
 
    #Print data
    print("distance=%dcm, temperature=%dC, humdity=%d%%"%(distance, temperature, humdity))
 
    #Format data into string format
    str_distance = "dis=%dcm"%(distance)
    str_temperature = "tem=%dC"%(temperature)
    str_humdity = "hum=%d%%"%(humdity)
 
    #oled display data
    oled.fill(0x0)
    oled.text(str_distance, 0, 0)
    oled.text(str_temperature, 0, 10)
    oled.text(str_humdity, 0, 20)
    oled.show()
 
    utime.sleep(.5)

Experimental phenomena

 

MicropythonProgrammingRaspberry pi picoRp2040Sensor kitSensor moduleStem

Leave a comment