Kyle Chuang | ME405 Mechatronics Portfolio
mcp9808.py File Reference

Lab0x04: Hot or Not? mcp9808 driver. More...

Classes

class  mcp9808.MCP9808
 A driver object for the mcp9808 temperature sensor. More...
 

Variables

 mcp9808.i2c = I2C(1, I2C.MASTER)
 The pyb.I2C object used to communicate with the MCP9808 sensor. More...
 
 mcp9808.temp_sensor = MCP9808(i2c,0)
 The mcp9808 object connected to the external temperature sensor.
 
 mcp9808.amb_temp = temp_sensor.celcius()
 The ambient temperature read by the MCP9808 sensor in C.
 

Detailed Description

Lab0x04: Hot or Not? mcp9808 driver.

This file creates a driver class for a mcp9808 temperature sensor. It consists of multiple methods developed by my lab partner Enoch for his own personal uses of the mcp9808. For this lab deliverable, please pay particular attention to the following methods:

1. get_temp(): which returns the raw temperature value from the
mcp9808 sensor in Celsius
2. celcius(): which calls upon get_temp() to return the ambient
temperature in Celsius
3. fahrenheit(): which calls upon get_temp() to return the ambient
temperature in Fahrenheit.
4. check(): which checks to see if the manufacturer ID for the
mcp9808 sensor is correct.

These methods will be used to collect ambient temperature data using the mcp9808 sensor. The sensor will return temperature data in a maximum resolution of .0625 degrees Celsius

The source code for this file can be found here: https://bitbucket.org/ewnichol/me405_shared_work/src/master/me405%20Lab%200x04/mcp9808.py

Author
Kyle Chuang
Enoch Nicholson
Date
February 09, 2021

Variable Documentation

◆ i2c

mcp9808.i2c = I2C(1, I2C.MASTER)

The pyb.I2C object used to communicate with the MCP9808 sensor.

The communication channel is opened on bus 1, and the Nucleo is designated as the master.