mikroBUS UPM Sensor

Tempurature Sensor

Code to interface Tempurature sensor(MCP9808):

#!/usr/bin/env python

from __future__ import print_function
import time, sys, atexit
from upm import pyupm_mcp9808 as MCP9808

def main():
    # Instantiate the Infrared-Thermopile Sensor on I2C on bus 1
    mySensor = MCP9808.MCP9808(2,0x18)


    while(1):
        print("Temperature : "+str(mySensor.getTemp()))

        time.sleep(.5)

    # Print out temperature value and config-reg in hex every 0.5 seconds

if __name__ == '__main__':
    main()

To run the program, Step 1: save the file as mcp9808.py Step 2: Run the Program in the board's terminal using

Readings of temperature looks like this:

Accelerometer Sensor

Code to interface Accelerometer Sensor (LSM6DSL):

To run the program, Step 1: save the file as lsm6dsl.py Step 2: Run the Program in the board's terminal using

Readings of Accelerometer looks like this:

Humidity Sensor

Code to interface Humidity sensor (BME280):

To run the program, Step 1: save the file as bme280.py Step 2: Run the Program in the board's terminal using

Readings of Humidity, Temputature, Pressure from BME280 sensor looks like this:

Last updated

Was this helpful?