Measures internal microcontroller temperatures and saves it to a CSV. More...
Variables | |
| string | ME405_Lab0x04_main.fileName = 'Temps.csv' |
| The name of the file we will write to. | |
| ME405_Lab0x04_main.i2c_obj = pyb.I2C(1, I2C.MASTER) | |
| Initializes the I2C object and sets the object to Master mode. | |
| int | ME405_Lab0x04_main.sensAddr = 0x18 |
| Specifies the default sensor address on the bus. | |
| ME405_Lab0x04_main.tempSens = mcp9808(i2c_obj, sensAddr) | |
| Instantiates the temperature sensor. | |
| ME405_Lab0x04_main.t_lastMsr = utime.ticks_ms() | |
| ME405_Lab0x04_main.adc_obj = pyb.ADCAll(12, 0x70000) | |
| Sets the ADC address from which we access the Nucleo core temp measurement. | |
| ME405_Lab0x04_main.adc_TempMsr = adc_obj.read_core_vref() | |
| int | ME405_Lab0x04_main.t_sample = 60000 |
| ME405_Lab0x04_main.crntTemp = tempSens.celsius() | |
Measures internal microcontroller temperatures and saves it to a CSV.
This lab uses I2C communication between a master device (Nucleo) and a slave device (mcp9808 temperature sensor) to determine the ambient temperature of a room. A class constructed in a separate file is instantiated in this file by using the initialized Nucelo as one argument and the sensors address on the I2C bus as the other argument. The final CSV is composed of four columns: the synchronized time per temperature measurement, the sensor ambient temp in Celsius, the sensor ambient temp in Fahrenheit, and the internal Nucleo temp.
Source code (main file): https://bitbucket.org/nicho755/me-305-labs/src/master/ME405_Lab0x04_HotorNot/ME405_Lab0x04_main.py Source code (main file): https://bitbucket.org/nicho755/me-305-labs/src/master/ME405_Lab0x04_HotorNot/mcp9808.py