ME 405: Mechatronics Portfolio
main_young.py File Reference

Created on Thu Feb 4 09:36:28 2021. More...

Variables

 main_young.adc = pyb.ADCAll(12,0x70000)
 Create an ADC object measuring internal temperature of NUCLEO.
 
 main_young.inTemp = adc.read_core_temp()
 Define a variable to hold the temperature reading from the ADC object.
 
 main_young.i2cObject = pyb.I2C(1)
 Define an object for I2C communication.
 
int main_young.address = 0x18
 Define the I2C bus address of the MCP9808 temperature sensor. More...
 
 main_young.mcp = mcp9808_young.MCP9808(i2cObject,address)
 Create an MCP9808 object using the mcp9808 class, which takes an I2C object and the address of the temp sensor in the constructor.
 
 main_young.exTemp = mcp.celsius()
 Define variable to hold the temperature reading from the MCP9808 temperature sensor.
 
 main_young.startTime = utime.ticks_ms()
 Define variable to hold starting time.
 
 main_young.currTime = utime.ticks_ms()
 Define variable to hold updated current time. More...
 
 main_young.time = utime.ticks_diff(currTime,startTime)
 Define variable to hold time since beginning of data collection.
 
int main_young.interval = 60
 Define interval between temperature readings.
 
int main_young.run = 1
 Define run counter to keep track of temperature collection iterations.
 

Detailed Description

Created on Thu Feb 4 09:36:28 2021.

Author
Miles Young
Date
02/4/2021

Temperature Collection Main Script
This script is used to collect temperature data for using the built-in NUCLEO temperature sensor and an external Adafruit MCP9808 temperature sensor breakout board. I2C communication is used to collect the external temperature data, and temperature readings are taken every minute. The time since the beginning of data collection, internal NUCLEO temp, and external MCP9808 temp are all saved as one line in an external file for every round of data collection.

Variable Documentation

◆ address

int main_young.address = 0x18

Define the I2C bus address of the MCP9808 temperature sensor.

Default address sourced from Adafruit spec sheet.

◆ currTime

main_young.currTime = utime.ticks_ms()

Define variable to hold updated current time.

Define a limit for runs after which to end data collection (only valid for timed data collection) runLimit = 480.