Mechatronics Portfolio - Nick Greco
ME405_Lab0x03_BackEnd.py File Reference

Interprets a "go" signal, and collects ADC data from a charging capacitor. More...

Variables

 ME405_Lab0x03_BackEnd.pinADC = pyb.Pin (pyb.Pin.cpu.A0)
 Setting pin A0 (non-Arduino pin) as the pin to collect ADC data.
 
 ME405_Lab0x03_BackEnd.tim6 = pyb.Timer(6, freq = 50000)
 Creates a timer object at Timer 6 that triggers at 40 kHz. More...
 
 ME405_Lab0x03_BackEnd.adc = ADC(pinADC)
 Sets the pin to ADC mode and stores the values in the variable "adc".
 
 ME405_Lab0x03_BackEnd.myuart = UART(2)
 Sets up the UART port through which the serial comms occur.
 
int ME405_Lab0x03_BackEnd.time = 0
 The time variable, which will be incremented using the period.
 
int ME405_Lab0x03_BackEnd.period = 20
 The period of the data collection operation. More...
 
 ME405_Lab0x03_BackEnd.buffy = array('H', (0 for index in range (5000)))
 The array in which the ADC values will be stored. More...
 
 ME405_Lab0x03_BackEnd.goButton = myuart.readchar()
 Sets the data collection start variable. More...
 

Detailed Description

Interprets a "go" signal, and collects ADC data from a charging capacitor.

The Back End enables a pin (A0) to interpret the charging of a capacitor using ADC functionality. This pin is jumpered to pinC13 so that a button press can initiate the data collection. The data is collected in bits, which can be converted into voltages.

source code: https://bitbucket.org/nicho755/me-305-labs/src/master/ME405_Lab0x03_PushingTheRightButtons/ME405_Lab0x03_BackEnd.py

Date
5/06/2021

Variable Documentation

◆ buffy

ME405_Lab0x03_BackEnd.buffy = array('H', (0 for index in range (5000)))

The array in which the ADC values will be stored.

This array is termed a buffer because it will store 50 times as many values as we theoretically need to collect. This buffer is necessary because it is not likely for our data collection period to perfectly align with the values we desire to capture.

◆ goButton

ME405_Lab0x03_BackEnd.goButton = myuart.readchar()

Sets the data collection start variable.

The start variable is set to whatever the user passes in from the front end code.

◆ period

int ME405_Lab0x03_BackEnd.period = 20

The period of the data collection operation.

This value is determined by dividing the total window that data collection will occur in (4*tau = 2ms) and dividing this by the number of data points (100) to be collected in that time span.

◆ tim6

ME405_Lab0x03_BackEnd.tim6 = pyb.Timer(6, freq = 50000)

Creates a timer object at Timer 6 that triggers at 40 kHz.

The timer needs to run quick enough to cpature all 4095 points we desire in the span of 1 button push