Raspberry-Pico

2021-10-30

Getting Started

  • As a Raspberry Pi collector at heart, I bought a Pico board and a Raspberry 400
    • The 3B/3B+ I bought earlier are now collectibles; the 4B gets occasional use
    • I didn't know much about the Pico and wanted to take a look
    • I also bought a Raspberry 400 at the same time
  • The Raspberry Pi arrived just the night before last
    • Pico board with pre-soldered headers (34.49 for the board + 6.5 for the case).
    • Raspberry 400(480)

Checklist

  • Hardware list
    • Mac (a PC works too)
    • Pico board (with headers, ¥35)
    • Micro USB cable (must support data transfer)
    • A bunch of jumper wires
    • 12864 OLED screen (¥30)
  • Software list
    • Pico driver: uf2
    • Pico development tool: Thonny

Photos

  • Pico GPIO pinout diagram

  • 12864 display

Setting Up the Raspberry Pico

  • Official tutorial 0. Software setup

    • Download and install Thonny
    • Download the MicroPython UF2 file
    1. Hardware connection setup:
    • Connect the hardware
    • Press the Pico switch
    1. Find the storage device recognized by the system: RPI-RP2
    • Copy the MicroPython UF2 file into RPI-RP2
    • RPI-RP2 will disappear
    • Connect the Pico through Thonny
      • Tools -> Settings -> Interpreter
    1. Write the code: blink the LED
    • Create the file main.py
    • Enter the code:
    import time 
    from machine import Pin
    
    LED = Pin(25, Pin.OUT)
    
    if __name__ == "__main__":
      while True:
          LED.value(0)
          time.sleep(0.1)
          LED.value(1)
          time.sleep(0.1)
    
    1. Click Run to run the current script
    • The LED should now be blinking
    1. Using the 12864 OLED screen
    • Download the dependency file ssd1306.py
    • Save ssd1306.py into the Pico directory:
      • Connect the Pico, use Save As, and select the Pico
    • Wire up the ribbon cable
      • 1286 --> Pico
      • GND --> GND
      • VCC --> VCC
      • SCL --> GPIO 0
      • SDA --> GPIO 1
    1. Write the display code: main.py
      from machine import SoftI2C, Pin
      import time
      from ssd1306 import SSD1306_I2C
      
      i2c = SoftI2C(scl=Pin(0), sda=Pin(1))
      oled = SSD1306_I2C(128, 64, i2c)
      
      i = 0
      oled.text("Hello,I am Pico!",10, 10)
      oled.show()
      while True:
      	oled.fill(0)
      	oled.show()
      	oled.text("{}".format(i),10, 10)
      	oled.show()
      	i += 1
      	time.sleep(1)
      
    7. 点击运行当前脚本
    - 即可看到时间跳动
    
    

Overall Impressions

  1. It's quite convenient to use
  2. Great for middle school students to tinker with for DIY projects