diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..0f5fd65 --- /dev/null +++ b/README.md @@ -0,0 +1,48 @@ +# Read Resistances + +## Required & Dependencies +### Required +- Python 3 (but below 3.10). And the following packages using `pip`. + Alternatively, you can just run `pip install -r requirements.txt` to have all packages installed automatically + - matplotlib + - pyserial + - wxPython +- PlatformIO IDE, which could be downloaded as an extension in vs code +### Recommended +- Code Runner (for VSCode only) +- wxFormBuilder +- Arduino IDE + +## How to use +### Direct use + First download the `.ino` file from `ReadRaw` folder using Arduino IDE. 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 +Then you can just run `python toplevel.py` and start from the UI. Enter the relevant information and start collect and measuring data. +### 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 `toplevel.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.pyw` read raw data from Arduino board and convert it to the correct resistance, which could be plotted out +using `serial_plot.pyw`. Note that all .pyw are still Python files and should be correctly opened using any IDE/text edtiors +as .py file does, except not going to pop up a black terminal when running directly. `test.py` is the old main and may not +currently running properly + +## Issues +- Currently can only use 5V as input voltage. May need to change the algorithm in `read_arduino.py` +- Should call `writerandomvalues.py` to simulate Arduino data when nothing is connected but user still want to run. Currently just pop up error +- "plot" button is completely disabled, should be enabled whenever is not plotting but is reading data + +## Todos & specs: +- [ ] Fix Issues +- [ ] display sensor value in either the UI or on the plot +- [ ] Reopen plot window from the UI when closed +- [x] Need to continue writing to file when graphing window is closed +- [ ] Make it so the time stamp is the actual time +- [x] 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 diff --git a/SeeDatResistance.iml b/SeeDatResistance.iml index ad3c0a3..597619a 100644 --- a/SeeDatResistance.iml +++ b/SeeDatResistance.iml @@ -6,4 +6,7 @@ + + \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2f2cc08 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +numpy +requests +future +matplotlib +wxPython +pyserial \ No newline at end of file diff --git a/toplevel.py b/toplevel.py index b8bab8f..949bc50 100644 --- a/toplevel.py +++ b/toplevel.py @@ -18,7 +18,7 @@ def main(): #################### USER INPUTS ########################### # TODO: if there is already a setting.json exist, loads all inputs from there as 'default' # 9840 - resistors = [int(text3.get()), int(text4.get()), 0, 0] # resisters for each An port, where n is an integer from 0-3. Use 0 if none. in Ohms + resistors = [int(text3.get()), int(text4.get()), 0, 0, 0] # resisters for each An port, where n is an integer from 0-3. Use 0 if none. in Ohms input_voltage = 5 adjusted_volt = 5 port = get_devices()[0]