Run Micropython with rt-thread on RasPi pico

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
mazhiyuan
Posts: 1
Joined: Fri Aug 20, 2021 9:23 am

Run Micropython with rt-thread on RasPi pico

Post by mazhiyuan » Fri Aug 20, 2021 9:49 am

Description
This project use raspi PICO and ESP8266 as hardware and use [RT-Thread MicroPython - Visual Studio Marketplace](https://marketplace.visualstudio.com/it ... icropython) to develop the software to get weather by http request.

Embedded Software Configuration

Use RT-Thread Studio
  • install the SDK of RP2040-RASPBERRYPI-PICO
  • Create RT-Thread Project,select based on Development board--->RP2040-RASPBERRYPI-PICO
  • Open RT-Thread Settings on your project,and add micropython, AT-Device packages
  • Configure micropython
    Enable usocket and ujson, and turn up Heap size appropriately
  • Configure AT_Device
    Enable ESP8266,and enable samples,input your SSID and password,then set the device name as "uart1"
    Enable components--->network--->AT commands
    Enable components--->Device Driver--->Using WiFi Framework
  • Connect esp8266 to uart1 of Raspi pico
    build the project and download it to the Raspi
Use RT-Thread ENV
clone rt-thread code Enter the bsp directory
  • cd rt-thread/bsp/raspberry-pico
Open menuconfig,and configure RT-Thread, Please reference the last chapter [Use RT-Thread Studio]
  • scons --menuconfig
update the software packages
  • pkgs --update
compile
  • scons
Demo
  • Create RT-Thread MicroPython Project
  • define request: def request(uri, method, para=None):
    • decode the uri to domain, port and path.
    • create the socket connection using usocket
    • send http request.
    • receive response
    • parse the response to class HttpResponse and return it.
  • Call `request()` to get the weather.
source code
https://github.com/cndabai/raspipicodemo

Post Reply