Control System of Morphing Structure Soft Robot
This control system manages the actuators for a novel morphing structure soft robot, providing a flexible interface for operating multiple functions, including thermal sensing, temperature control, and various movement modes. The system is divided into two main parts:

Arduino Code - located in the Arduino_main folder.
Raspberry Pi Code - located in the Raspi folder.
System Components
Raspberry Pi Control Logic:

Main Control Logic Platform (Rasp_main.py): The primary script to initialize and control system functions.
Thermal Image Extraction (Thermal_image.py): A non-contact multi-target temperature extraction sensor system.
PID Temperature Controller (Controller.py): A controller for regulating temperature based on desired setpoints.
Arduino Interface:

The Arduino_main code should be uploaded to an Arduino Mega 2560 (recommended for optimal performance). The Arduino interfaces with the Raspberry Pi via USB.
Hardware Requirements
Raspberry Pi: Raspberry Pi 3 or newer is required.
Arduino: Arduino Mega 2560 is strongly recommended, as older models may have issues with memory and connectivity.
Temperature Sensor: Original mlx90640 infrared temperature detection array, configured with the I2C communication protocol for the Raspberry Pi.
Connections: USB connection between Arduino and Raspberry Pi.
Software Requirements
To install the necessary Python libraries on Raspberry Pi (preferably in a virtual environment), use the following command to install the dependencies:
pip install pandas numpy opencv-python-headless scikit-learn serial matplotlib cvxpy

Usage
Initial Setup
Upload the Arduino_main code to the Arduino Mega 2560.
Transfer the Rasp_main.py, Thermal_image.py, and Controller.py scripts to the Raspberry Pi.
Run Rasp_main.py on the Raspberry Pi to start the main control logic.
Movement Modes
In the Rasp_main.py file:

Enter Mode selection codes:
1 for Small Stepping
2 for Large Stepping
3 for Forming (sets the structure)
4 for Recovery
p for Preheat (for specific SMA springs)
Arduino Interface Ports
Ports are designated as follows:
Ports 3-5: Control for SMA spring #1-3.
Port 6: Cooling system for SMP.
Ports 7-10: Heating group for SMP.
Commands are formatted as port1:pwm1:duration1, port2:pwm2:duration2, ..., port8:pwm8:duration8. Example configurations can be found in Rasp_main.py.

Direction Commands
1 for spring #1
2 for spring #2
3 for spring #3
4 for springs #1 and #2
5 for springs #1 and #3
6 for springs #2 and #3
7 for all springs (1, 2, and 3)
Pre-Experiment Adjustments
Before running experiments, adjust the following parameters in Rasp_main.py:
PID Parameters
Sensing Frequency
Data Saving Options (Temp csv)
K-Value for KMeans extraction
No additional modifications are needed for the other files.

Author
Created by Ruochen Wu, TUDelft. For questions or further information, please contact R.Wu-10@student.tudelft.nl.

