Go to file
Eric Yu 3d8b3f119b
Update README.md
2023-02-15 15:25:55 -08:00
.idea cleanup 2023-02-06 22:57:05 -08:00
ADS1115_driver Update main.c 2023-01-08 13:59:43 -08:00
CP210x_Universal_Windows_Driver Co-authored-by: AD776 <AD776@users.noreply.github.com> 2022-11-05 19:34:31 -07:00
OldFirmware cleanup 2023-02-06 22:57:05 -08:00
nano_c_mk1 Update nano_c_mk1.ino 2023-02-02 12:54:10 -08:00
ESP32Driver.py update firmware + cleanup a bit 2023-02-01 01:54:27 -08:00
ESP32Driver_Script.sh Co-authored-by: AD776 <AD776@users.noreply.github.com> 2022-11-05 19:34:31 -07:00
README.md Update README.md 2023-02-15 15:25:55 -08:00
Read-Sensor-Resistances.iml cleanup 2023-02-06 22:57:05 -08:00
build.spec cleanup 2023-02-06 22:57:05 -08:00
gitignore Co-authored-by: AD776 <AD776@users.noreply.github.com> 2022-11-05 19:34:31 -07:00
read_arduino.py cleanup 2023-02-06 22:57:05 -08:00
requirements.txt cleanup 2023-02-06 22:57:05 -08:00
sealammonia.fbp cleanup 2023-02-06 22:57:05 -08:00
serial_plotter.py Add headers to recorded data 2022-12-15 15:22:33 -08:00
splash.png cleanup 2023-02-06 22:57:05 -08:00
test.py cleanup 2023-02-06 22:57:05 -08:00
ui.py cleanup 2023-02-06 22:57:05 -08:00

README.md

Read Resistances

Read the resistance of a voltage divider using Arduino boards

Required & Dependencies

Required

  • Python 3 (but below 3.10). And the following packages using pip.
    Alternatively, you can just switch the file source of the Command line Prompt by using 'cd <Project_File_Directory>' and after that, run pip install -r requirements.txt in to have all packages installed automatically
    • matplotlib
    • pyserial
    • wxPython
  • PlatformIO extension, if you use VSCode for embedded programmings
  • An Arduino-based microcontroller
  • ADS1115 16-bit ADC chip
  • Code Runner (for VSCode only)
  • wxFormBuilder
  • Arduino IDE

How to use

To get a general idea of this project as well as hardware setup, please refer to this video demo

Direct use

First open the .ino file from nano_c_mk1 directory using Arduino IDE and download it onto an Arduino board. Or if you are using Arduino Mega 2560 you can use the code in ReadAnalog folder by open the folder in VSCode and run with PlatformIO, or just run flash.py in a terminal (Arduino Mega and Uno boards are no longer supported. Please use this link to use on Arduino IDE or PlatformIO for VSCode) (There's a hardware upgrade so that the firmware has been re-written for the new hardware. Therefore the old hardware are no longer in use. You may still find them in OldFirmware directory for reference but we are not using them anymore) For Windows you can just download the released executable from the release section to use. Make sure to disable any virus-scanning software when download as Microsoft incorrectly recognized PyInstaller as virus. For non-Windows systems you can just run python test.py and start from the UI. Enter the relevant information and start collect and measuring data. If you do not have a board avaliable, leave the dropdown menu in the UI as "no device" and it will run a simulation.

develop & build

Beside the c-based code for the Arduino board to read raw data from the board, everything has now been done in the python files. The main program is test.py, which calls UI.py to prompt for input. It is NOT recommended modifying the ui.py as it is generated from wxFormBuilder from sealammonia.fbp, which could be modified if any frontend feature need to change. the main program will generate settings.json which saves all required parameters needed to calculate and graph and save the sensor's values. It also creates a .csv file under RecordedData directory to save all recorded+calculated data.
read_arduino.py read raw data from Arduino board and convert it to the correct resistance, which could be plotted out using serial_plotter.py. To make your own executable, use PyInstaller using this command in your python environment: pyinstaller build.spec. ATTENTION MAC USER: currently the software cannot correctly functional on mac (especially arm-based ones). You might need to consider to use it on a windows VM or using parallel desktop

Issues

  • Newer hardware will require 3.3V. Currently can only use 5V as input voltage. May need to change the algorithm in read_arduino.py.
  • axis window size is not correct
  • on PyInstaller, windows misdetected our executable as a virus (seems resolved)
  • change the scale on Y-axis so that graph looks smoother
  • Errors thrown when >1 reference resistances entered

Todos:

  • Fix Issues
  • Add different shapes to different lines one the graph in addition to differen colors
  • Automatically setup the driver for ESP32
  • programically to stablize the graph (change the y-scale of the graph to make the less dramatic)
  • (not urgent) make it runnable on Mac
  • display sensor value in either the UI or on the plot
  • Reopen plot window from the UI when closed
  • Need to continue writing to file when graphing window is closed
  • Make it so the time stamp is the actual time
  • No blank line in between lines of csv file (new line may be added when file is closed)
  • Make it so we have the option to run multiple graphs at the same time, setting window size in UI
  • Inputting value of 0 for window size should have an infinite window size
  • Accept any inputs (such as resistor values, plot window size, base voltage etc.) as either command line argument or as input at beginning of program
  • Write random values to simulate a sensor if no sensor available (this feature might be removed in the future)
  • Advanced option menu in the UI to allow user to make more adjustments
  • Add resolution option in the UI to allow interchange between arduino (10bit) and esp32 (12 bits) (Not Applicable in new hardware)
  • Possibly adding new module to support ESP32
  • Support for non-Windows platforms (and maybe mobile)
  • Make it into one executable
  • Possibly adding new module to support Arduino MEGA and older firmwares (Need testing)
  • (optional for now) make the hardware connection to the interface wireless