Rasperry Pico 2 Exploration
Raspberry released a new Pico last August: the Pico 2. Faster, with RiscV capabilities and the debug pins are at a better place on the board. But there is no wifi version yet, which makes it a bit useless for ESPHome at the moment. As the original Pico before it is pretty cheap, so I bought one to experiment with it.
The MicroPython part for the ARM core should work as before for the Pico. So I was more interested in MicroPython for the RiscV part of the board. I downloaded the Firmware for RiscV MicroPython for the Pico2 (at the bottom of the page). After copying the UF2 file on the Pico 2, it immediately reboots - as expected.
To connect on the shell I use rshell as in previous posts.
In the repl
I get this:
MicroPython v1.24.0 on 2024-10-25; Raspberry Pi Pico2 with RP2350-RISCV Type "help()" for more information. >>>
Which is quite cool. The same code I used to blink the LED a post for the Pico in February works without modification:
from machine import Pin, Timer led = Pin(25, Pin.OUT) timer = Timer() timer.init(freq=1, mode=Timer.PERIODIC, callback=lambda timer: led.toggle())
The onboard LED is blinking.
Now to the internal temperature sensor. I described the usage in another previous post for the Pico. The code is:
import machine adc_voltage = machine.ADC(4).read_u16() * (3.3 / (65536)) temp = 27 - (adc_voltage - 0.706) / 0.001721 print(f"Temperature: {temp:2.1f} °C")
And for me it displays Temperature: 24.7 °C
, which is a bit more than room temperature.
The code for the BME280 worked the same as described in the same blog post.
I copied the bme280_float.py
from https://github.com/robert-hh/BME280 to the Pico 2 with cp bme280_float.py /pyboard
and used it the same way as with the original Pico:
import machine import bme280_float as bme280 i2c = machine.I2C(0, sda=machine.Pin(20), scl=machine.Pin(21)) bme = bme280.BME280(i2c=i2c) print(bme.read_compensated_data()[0])
The temperature shown is a bit more realistic with 22.7 °C
.
As mentioned in the pull-request that added support for the Pico 2 to Micropython: both CPUs are fully supported.
I have nothing more I could try with the Pico 2 that would not work on the original Pico too. So I stop here and wait for the wifi version.