Table of Contents
Program OverviewOn the final product given to the customer, the software will be set up to be easily run from the desktop.
The program is located within the code section (see Software Subsystem) of the EDGE site. In the folder called 'Full Build' there is a collection of files required for operation. The main executable file is called 'ui_main.py'. It was written for Python 3 but may work with different Python versions. It requires pandas, numpy, matplotlib, and Raspberry Pi GPIO and SPI packages.
Steps for OperationIn the current way the software was given to the customer, the following steps are taken to start the code.
- The Raspberry Pi is plugged in and launches to the desktop.
- In the folder called "Full Build" a file called ui_main.py is double-clicked.
- This opens Thonny. In Thonny, the green play button is pressed to start the software.
The software is now running. The remaining steps are related to the software itself and not the file system setup.
- In the startup page, the configuration options are checked and modified if desired (i.e., active probes, sampling rate, etc.).
- The directory for save files may be changed (if this was previously on a different drive, like a USB drive, and that drive was disconnected, this step is required or the software will likely not start or run properly).
- After adjusting the configuration options, the start button is pressed.
- Pressing the start button begins the data logging operation of the software.
- In the logging operation different tasks may be performed, such as scaling the y-axis of the data being displayed, or turning off the display of different probes (the data is still logged, this is just a visual aid to the user).
- After a test run finishes, or the user wishes to end the logging of data, the save/close button is clicked, closing the software and saving the data to the chosen directory.
- In the case of an incorrect close, the save file may be corrupted. In this case, there is a backup provided that only gets cleaned up during proper termination of the program. This is to prevent against data loss when the system encounters problems.
The data is now saved in a predetermined folder (chosen by the user during the startup/configuration page). The data is in the format described below. It may be read with different software and is a text file containing the data in a comma-separated-value format (csv). Each column represents a different data set (either time or one of the probe channels).
Startup/Configuration PageThe startup page (code: ui_startup.py) is the first page encountered when running the software. This allows the user to control different aspects of the software, such as active probes and data collection rate. It has a few button and text fields that act as named as well as boxes for each probe. These boxes have a circle that, when clicked, toggle between empty and green. The green probes are the active probes that will be used in data logging. Additionally, each probe has a text box that is used to name the probe for both display during the operation of the software and also in the save file.
Data Logging PageOn the data logging page the data from each enabled probe is displayed in a graph. The most recent values are also displayed to the right. Additionally, the display of a probe can be turned off by clicking on the respective probe's information box. There is also a slider bar to control the width of the plotted data, for easier visualization. Setting this slider to zero will show all data. Lastly, there is a save and quit button, which saves the program, deletes the temporary file (which is there in case the system crashes), and exits safely.
Saved DataThe data is expored as a .csv file, with the data in labelled columns. The first column, labelled time, is time, in seconds. The remaining columns are labelled by the name given in the startup/config page and are in °C. As the reference temperature is just a guess, it may not give the most accurate results, but the data can be adjusted afterwards to assume a different reference temperature.
Voltage CalibrationThis has been performed already and the result is included as 'calibration.csv'. This is automatically used by the main program.
There is also a file called 'calibration.py' that is used to generate the calibration curves for the 14 physically designed thermocouple channels. This code is run and it asks for the number of voltage levels to be analyzed as well as the reference voltage (which can be measured from the Raspberry Pi's 3.3V). Then for each level the inputs should be connected to the same voltage and measured with a multimeter to tell the program the actual voltage levels. This will generate a 'calibration.csv' file that is used by the main software to adjust the read voltage levels.
Configuration FileThe config.json file controls many of the software's specifications. Some of it is changed when using the startup/configuration page in software. The rest has been designed to meet requirements but may be changed as deemed necessary. The meanings of each configuration parameter is listed below.
- active_probes - Lists the active probes†
- calibration_path - Path of calibration file (see above).
- disabled_probes - Probes that are disabled (can't turn on with startup page). These are by default the probes that are physically disabled on the two daughter boards. Default is [0, 8].
- num_probes - The total number of probes considered by startup page. This is used to generate the configuration boxes for each probe. Default is 16.
- num_samples - The number of samples averaged over every time data is logged. Default is 100.
- probe_names - Names of the probes, in order.†
- Tref - Reference temperature.†
- S0 - Raspberry Pi GPIO pin for select 0. Default is 22. This is dictated by hardware.
- S1 - Raspberry Pi GPIO pin for select 1. Default is 27. This is dictated by hardware.
- S2 - Raspberry Pi GPIO pin for select 2. Default is 17. This is dictated by hardware.
- save_path - Location where data is saved to.†
- spi_max_speed_hz - SPI setting for communicating with ADC. Default is 1000000.
- update_rate - The rate in ms that samples are taken at.†
- V_ref - The reference voltage used in calculating the voltages from the ADC. It is the 3.3V channel on the Raspberry Pi. Default is 3.299.
†Controlled by startup page.
OverviewIncluded are two daughter boards and a main board. The main board is attached the the Raspberry Pi and the daughter boards are connected to the main board. The daughter board with the thermocouple connectors (and larger resistors) is denoted as the first daughter board and corresponds to probes 1-7 while the other (without the thermocouple connectors and with smaller resistors) corresponds to probes 9-15.
TroubleshootingIn the case that the system does not start, the main board can be removed from the Raspberry Pi and then powered on, and then re-attached. If this does not work, a different power supply (5V USB) can be used.
If the probes are not connected they should be grounded. If they are floating this will interfere with the data for the rest of the probes, rendering it invalid. Thus, if a probe is not being used its terminals should be shorted to achieve this.
Reference TemperatureA digital temperature sensor is included within the system but is not used by the software as it is not calibrated. Instead the system assumes a reference temperature of 20°C (or whatever is specified during startup). For information on this sensor and how to use it see https://www.adafruit.com/product/374 and https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/software. It is connected to the Raspberry Pi's pin 4, and works in the same manner as described in the aforementioned article.