Skip to content

Internal temperature sensor

def internalTemp():
    ''' Read from ADC, convert raw values to Ceclcius via voltage. 
    '''
    sensor = ADC(4)
    adc_value = sensor.read_u16()
    adc_voltage = (3.3/65535) * adc_value 
    temperature = 27 - (adc_voltage - 0.706) / 0.001721
    return f"{round(temperature, 1)}C"

BME280

import BME280

i2c_bme = I2C(0, sda=Pin(4), scl=Pin(5), freq=100000) # BME tilkobling på pico bme = BME280.BME280(i2c=i2c_bme)

Calibrating the sensors

Altitude calculations