# Pico Explorer Base and Pico Temp sensor problem

**URL:** <https://forums.pimoroni.com/t/pico-explorer-base-and-pico-temp-sensor-problem/17833>\
**Category:** Support\
**Created:** [September 2, 2021, 1:45pm UTC](https://forums.pimoroni.com/t/pico-explorer-base-and-pico-temp-sensor-problem/17833 "2021-09-02T13:45:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chipmonk](https://avatars.discourse-cdn.com/v4/letter/c/54ee81/32.png) [@Chipmonk](https://forums.pimoroni.com/u/Chipmonk)\
**Post date:** [September 2, 2021, 1:45pm UTC](https://forums.pimoroni.com/t/pico-explorer-base-and-pico-temp-sensor-problem/17833/1 "2021-09-02T13:45:05Z")

</div>

Hi,  
I am experimenting with Pico and the explorer base using Pimoroni Micropython in the latest version.  
I have the follwing problem:  
As soon as the picoexplorer.init(buf) command is executed in the program, the internal temp sensor of the Pico returns temperature values of around 89 degrees Celsius.  
If I comment that line out and start the program again, the reading is immediately back to normal.  
But then of course the display does not work.  
So the init() seems to mess up the data from the internal sensor.

Has anyone experienced the same problem and found a solution?  
Regards  
Thomas

---

<div class="post-metadata">

**Author:** ![Shoe](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Shoe](https://forums.pimoroni.com/u/Shoe)\
**Post date:** [September 2, 2021, 6:31pm UTC](https://forums.pimoroni.com/t/pico-explorer-base-and-pico-temp-sensor-problem/17833/2 "2021-09-02T18:31:04Z")

</div>

Not sure I know what is happening here, but could you please provide a bit more information? Which temperature sensor are you using, and what does the code up to that point look like?

You can post code in proper formatting by putting three backticks ( ` ) before and after it.

```auto
It will look like this

```

---

<div class="post-metadata">

**Author:** ![Chipmonk](https://avatars.discourse-cdn.com/v4/letter/c/54ee81/32.png) [@Chipmonk](https://forums.pimoroni.com/u/Chipmonk)\
**Post date:** [September 3, 2021, 9:26am UTC](https://forums.pimoroni.com/t/pico-explorer-base-and-pico-temp-sensor-problem/17833/3 "2021-09-03T09:26:10Z")

</div>

Hi Shoe,  
I am using the internal temperature sensor of the Pico.  
The code is this:

```auto

import utime
import machine
from breakout_bme68x import BreakoutBME68X, STATUS_HEATER_STABLE
from pimoroni_i2c import PimoroniI2C
import picoexplorer
#from adafruit_bitmap_font import bitmap_font

PINS_PICO_EXPLORER = {"sda": 20, "scl": 21}

i2c = PimoroniI2C(**PINS_PICO_EXPLORER)
bme = BreakoutBME68X(i2c)

temp_sensor = machine.ADC(4)
cf=3.3/(65535)

# Initialise Picoexplorer with a bytearray display buffer
buf = bytearray(picoexplorer.get_width() * picoexplorer.get_height() * 2)
picoexplorer.init(buf)

```

But also this minimalistic program has the same result:

```auto
import picoexplorer

temp_sensor = machine.ADC(4)
cf=3.3/(65535)

# Initialise Picoexplorer with a bytearray display buffer
buf = bytearray(picoexplorer.get_width() * picoexplorer.get_height() * 2)

sensor = temp_sensor.read_u16()*cf # Pico internal tempsensor
temp_pico = 27-(sensor-0.706)/0.001721
int_temp = "Int Temp: {:4.1f}C".format(temp_pico)
print(int_temp)

picoexplorer.init(buf)

sensor = temp_sensor.read_u16()*cf # Pico internal tempsensor
temp_pico = 27-(sensor-0.706)/0.001721
int_temp = "Int Temp: {:4.1f}C".format(temp_pico)
print(int_temp)

```

Where the output is

```auto
>>> %Run -c $EDITOR_CONTENT
Int Temp: 32.7C
Int Temp: 89.8C

```

---

<div class="post-metadata">

**Author:** ![hel](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/hel/32/6075_2.png) [@hel](https://forums.pimoroni.com/u/hel)\
**Post date:** [September 3, 2021, 12:42pm UTC](https://forums.pimoroni.com/t/pico-explorer-base-and-pico-temp-sensor-problem/17833/4 "2021-09-03T12:42:49Z")

</div>

Doing the Explorer init before setting up the temp sensor seems to make the readings behave for me?

```auto
import picoexplorer

# Initialise Picoexplorer with a bytearray display buffer
buf = bytearray(picoexplorer.get_width() * picoexplorer.get_height() * 2)
picoexplorer.init(buf)

temp_sensor = machine.ADC(4)
cf=3.3/(65535)

sensor = temp_sensor.read_u16()*cf # Pico internal tempsensor
temp_pico = 27-(sensor-0.706)/0.001721
int_temp = "Int Temp: {:4.1f}C".format(temp_pico)
print(int_temp)

```

---

<div class="post-metadata">

**Author:** ![Chipmonk](https://avatars.discourse-cdn.com/v4/letter/c/54ee81/32.png) [@Chipmonk](https://forums.pimoroni.com/u/Chipmonk)\
**Post date:** [September 7, 2021, 6:20am UTC](https://forums.pimoroni.com/t/pico-explorer-base-and-pico-temp-sensor-problem/17833/5 "2021-09-07T06:20:33Z")

</div>

Hello Hel!  
Thanks, that helped me as well, I now get the correct values!

But why does the initialisation of the explorer library influence the reading of internal values of the Pico unrelated to the explorer base?  
In my opinion that should not happen.

Best Regards  
Thomas

---

<div class="post-metadata">

**Author:** ![hel](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/hel/32/6075_2.png) [@hel](https://forums.pimoroni.com/u/hel)\
**Post date:** [September 7, 2021, 8:25am UTC](https://forums.pimoroni.com/t/pico-explorer-base-and-pico-temp-sensor-problem/17833/6 "2021-09-07T08:25:36Z")

</div>

Glad that helped but not sure why that fixes it I’m afraid, probably a bug? You could [open a Github issue](https://github.com/pimoroni/pimoroni-pico/issues/new) so our software folks can take a look?

---

<div class="post-metadata">

**Author:** ![ahnlak](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/ahnlak/32/5610_2.png) [@ahnlak](https://forums.pimoroni.com/u/ahnlak)\
**Post date:** [September 7, 2021, 10:01am UTC](https://forums.pimoroni.com/t/pico-explorer-base-and-pico-temp-sensor-problem/17833/7 "2021-09-07T10:01:12Z")

</div>

Looks like the explorer init function does some intialisation on _some_ of the ADC channels, and I’m guessing it trips up the temp ADC channel.

On this rare occasion I actually possess the relevant hardware so if you do open a Github issue, I might be able to come up with a PR for it :)
