From e5cdda9ee5c993efd5b39f5c82b81458e98534cd Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Wed, 12 Aug 2026 00:22:52 +1200 Subject: [PATCH] [adc] Fix RP2350B internal temperature reading wrong ADC channel (#18270) --- esphome/components/adc/adc_sensor_rp2.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/esphome/components/adc/adc_sensor_rp2.cpp b/esphome/components/adc/adc_sensor_rp2.cpp index 6cb9ef113f..2732f5328b 100644 --- a/esphome/components/adc/adc_sensor_rp2.cpp +++ b/esphome/components/adc/adc_sensor_rp2.cpp @@ -52,7 +52,11 @@ float ADCSensor::sample() { if (this->is_temperature_) { adc_set_temp_sensor_enabled(true); delay(1); - adc_select_input(4); + // The on-die temperature sensor sits on the last ADC channel, and which one + // that is depends on the chip: input 4 on RP2040 and RP2350A, but input 8 on + // RP2350B, which has eight external channels instead of four. The SDK + // resolves it for the target being built, so do not hardcode it. + adc_select_input(ADC_TEMPERATURE_CHANNEL_NUM); for (uint8_t sample = 0; sample < this->sample_count_; sample++) { raw = adc_read();