Skip to content

vladBaciu/ILSF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ILSF Documentation

The src directory contains different applications that were presented at the ILSF (I Love Science Festival).

  • In src\atmel_studio_project an example of Arduino project ported to Atmel Studio can be found. Using Atmel Studio as an IDE offers to the user a higher flexibility and transparence over the code. The script avrdude_program_nano_every.bat is an example on how to program an Arduino Nano Every board directly from the IDE. More informations on how to setup an external programmer in Atmel Studio can be found here.

  • In src\max3010_main_code_arduino there is the Arduino project used to read data from the MAX301x PPG sensor, compute the HR and SpO2 and send it through serial interface. It is the main code for the PPG Dashboard application and for 3D PPG Printing application.

  • In src\ping_pong_tower_code_arduino there is the Arduino project used to control the ping pong tower based on the heart rate value.

  • In src\python_3d_printing can be found the Python application used to acquire and 3D print the PPG signal.

  • In src\python_dashboard and src\python_dashboard_2 can be found the Python dashboard application.

Run the ping pong tower application

  • Firstly, one has to read the documentation of the ping pong tower to get a clear picture how it works, how the height measurement is done, what are the sensor output options (here, the analog ouput is used) and how to calibrate the height sensor. The documentation can be found in doc directory.
  • Go to the Arduino project and analyse the code, try to configure the configuration macros according to your needs. Also do not forget to set the ANALOG_PIN and PWM_CONTROL_PIN according to the design.

image

  • Compile and load the code from src\ping_pong_tower_code_arduino\ping_pong_main_code_arduino to the Arduino.

  • Perform the calibration as described in doc\height sensor calibration. After calibration (do not power off the ping pong tower), disconnect the fan and connect it to the extension board.

  • Connect the PWM pin and the sensor output to the Arduino. The ball should start rising and then it will float in the middle (approximately) of the tube.

  • If the ball is not stable or the height does not correspond to the HR value, you might need to create by yourself the following look-up tables. In this case a voltage divider was used, so the voltage values should be changed if the ping pong tower output is connected directly to the ANALOG_PIN. For different ping pong towers, there should be created different look-up tables since the output analog voltage differs.

image

  • To create the voltage lookup table one can use the src\ping_pong_tower_code_arduino\set_pwm_manually project and which allows to set manually the ball at a specific height (the height can also be changed covering the fan with your hand). Read the sensor analog values and create the hr_lookup_table and voltage_lookup_table according to your needs.

  • To test that the newly created lookup tables, set the SET_MANUAL_BEAT_AVG to TRUE, compile and load the code. Then from a serial terminal send the desired HR value. The ball should be floating at the desired height according to the serial input value.

The fan control is done using a PI loop. An external PID library can be used by setting USE_PID_CONTROLLER to TRUE. The K constants has to be determined and are not the same as in the case of the implemented PI controller.

image

pingpongtower.mp4

Run the 3D printing application

  • Install the requirements list from src\python_3d_printing
cd src\python_3d_printing
pip install -r requirements.txt
  • Install PrusaSclier.
  • Export your configuration bundle from PrusaSlicer and save it to src\python_3d_printing\in. Modify the path in code:

image

  • Compile and load the code from src\max3010_main_code_arduino, where the PRINTING_APP is set to TRUE.
  • Connect the Arduino board. Check the serial COM and modify the file src\python_3d_printing\serial.ini.
  • Create a new API_KEY in OctoPrint (info here and assign to RaspberryPi the address 10.0.0.1. Set the new API_KEY in src\python_3d_printing\python_interface.py

image

  • In Spyder/PyCharm or other Python IDEs run src\python_3d_printing\python_interface.py.

3d_app

  • The src\python_3d_printing\out directory contains the image that was selected, the stl version of the image and the gcode output from PrusaSlicer.

ppg_selection_0

  • The response from the printer can be found in the console/terminal where the application was started. Refer to the HTTP status codes in order to find out what is going on. If the answer is 201 the printer should start printing the PPG capture. While printing, other gcode files can be pushed in the queue but the files have to be manually selected for the printing (in the OctoPrint localhost). A [continous print plugin] (https://github.com/chennes/OctoPrint-Queue) can be further integrated.

  • Output:

Run the PPG dashboard application

  • Install the requirements list from src\python_dashboard
cd src\python_dashboard
pip install -r requirements.txt
  • Compile and load the code from src\max3010_main_code_arduino, where the PRINTING_APP is set to FALSE.
  • Connect the Arduino board. Check the serial COM and modify the file src\python_dashboard\serial.ini.
  • In Spyder/PyCharm or other Python IDEs run src\python_dashboard\project\ppg_dashboard.py and close the console.

image

  • Open the command line and run the command streamlit run ..\src\python_dashboard\project\ppg_dashboard.py.

  • Open the local host URL.

dashboard.mp4
  • If the current console in Spyder/PyCharm was not closed the serial port can not be opened.

image

PSOC 6 APP and GUI

  • In src/max3010_psoc6_hospital the Arduino code for MAX3010 HR and SPO2 readings was ported to PSOC 6. The directory contains the PSOC Creator project.

  • In src/max3010_psoc6_hospital_gui there is another GUI to display the signal (IR channel) from the PSOC6 board. psoc_gui