Loading...
Searching...
No Matches
Power and temperature

The USB-C supply (VBUS), USB Power Delivery and the RP2040's temperature. More...

Classes

class  STUSB4500
 Driver for the on-board STUSB4500 USB-PD sink controller (U6). More...

Functions

 vbus_volts ()
 Reads the USB input voltage supply voltage (VBUS, also on the header's VIN pin).
 cpu_temperature ()
 Gets the RP2040's internal temperature.
 usb_pd ()
 The board's STUSB4500, set up on first use.

Detailed Description

The USB-C supply (VBUS), USB Power Delivery and the RP2040's temperature.

A USB-PD charger can be asked for 9-20 V with usb_pd(). VBUS also feeds the header's VIN pin, so VIN follows the contract.

Function Documentation

◆ vbus_volts()

vbus_volts ( )

Reads the USB input voltage supply voltage (VBUS, also on the header's VIN pin).

The USB voltage is measured by the MAX11635 (channel 3) through a 100 kOhm / 10.2 kOhm divider. The USB voltage can range between 5V to 20V depending on the power profile negotiated by the USB power delivery controller (STUSB4500). The default voltage is 5V unless another voltage is negotiated.

Returns
Voltage in V (a float).
Exceptions
OSErrorThe external ADC did not respond.

◆ cpu_temperature()

cpu_temperature ( )

Gets the RP2040's internal temperature.

The RP2040 has its own temperature sensor, which runs warmer than the room (about 10 C above it in testing). Single readings jump by a few degrees; average several for a steady value.

Returns
Temperature in degrees Celsius (roughly +/-2 C).

◆ usb_pd()

usb_pd ( )

The board's STUSB4500, set up on first use.

Returns
The STUSB4500 object (the same one every call).
Exceptions
OSErrorThe chip did not respond.