Microcontroller.py

Microcontroller.py

This file has a class that is used to interact with a microcontroller to extract information about the running circuit. This interacts with serial.

class Microcontroller.Microcontroller(config: Config, logger: Logger)[source]

This is a class that represents the microcontroller connected to the FPGA. It is primarily used to interpret the serial output into values that are useful for the rest of the program. It mostly deals with values for fitness functions.

__init__(config: Config, logger: Logger)[source]

Initializes Microcontroller Object

Parameters:
  • config (Config) – Configuration object that determines what Microcontroller does.

  • logger (Logger) – Logger object where this object stores its logging information.

get_fpga()[source]

Get __fpga string

Returns:

FPGA Identifier

Return type:

str

measure_humidity()[source]

Measures the humidity using a DHT22 sensor conected to the Arduino.

measure_pulses(circuit: CircuitLegacy)[source]

Measures the number of pulses generated by the circuit provided.

Parameters:

circuit (Circuit) – The circuit we are measuring pulses of

measure_signal(data_filepath)[source]

Measures the signal, writing the waveform data to the provided data file

Parameters:

circuit (Circuit) – The circuit we are measuring the signal of

measure_signal_td(data_filepath)[source]

Measures (1) the FPGA waveform directly from FPGA output pin and (2) the “state”/frequency waveform directly from the signal-generating Nano. Writes 1000 sample points’ data to a file.

Parameters:

circuit (Circuit) – The circuit we are measuring the signal of

measure_temp()[source]

Measures the temperature using a DHT22 sensor conected to the Arduino.

simple_measure_pulses(data_filepath)[source]

This measure pulses function will poll the MCU, and just put the raw pulse count recorded into the circuit’s data file

Parameters:

circuit (Circuit) – The circuit we will measure pulses of.

switch_fpga()[source]

If there are multiple FPGAs, switch which FPGA the microcontroller is acting on and reading from.