A web-based control system for managing peristaltic pumps in cell culture experiments using Arduino-controlled hardware and a Flask backend, running on a Raspberry Pi 4 with touchscreen display.
This project explores automated cell culture techniques. Check out the video below for a demonstration:
![]()
This project provides a web interface to control and monitor peristaltic pumps for cell culture experiments. It consists of:
- A Flask backend API for handling web requests
- Arduino-controlled peristaltic pumps
- Serial communication between the backend and Arduino
- Raspberry Pi 4 with Elecrow touchscreen display for local control
- Raspberry Pi 4 Model B
- Elecrow 5" Touchscreen Display
- Arduino Mega 2560 (or compatible)
- Peristaltic pumps for liquid handling
- USB cables for Arduino connection
- Install Raspberry Pi OS (64-bit)
- Connect the Elecrow touchscreen display
- Configure display settings:
- Set correct DPI in
/boot/config.txt - Enable touchscreen driver
- Set correct DPI in
- Create and activate a Python virtual environment:
python -m venv backend/venv
source backend/venv/bin/activate # On Windows: backend\venv\Scripts\activate- Install required Python packages:
pip install flask flask-cors pyserial- Configure Arduino port:
- Edit
backend/app.pyand set the correctarduino_port - For Windows: use COM port (e.g., "COM3")
- For Linux: use ttyACM port (e.g., "/dev/ttyACM0")
- Edit
-
Open Arduino IDE
-
Install required libraries:
LiquidCrystal_I2C
-
Upload the Arduino code from
Arduino/pump_control1.ino
cd backend
python app.pyThe Flask server will start on http://localhost:5000
The system will automatically attempt to connect to the Arduino. You should see connection messages in the terminal.
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Check server status |
/control |
POST | Send control commands to Arduino |
/status |
GET | Get current system status |
-
Arduino Connection Issues:
- Ensure Arduino is properly connected
- Check the port configuration in
app.py - Verify Arduino is uploading code correctly
-
Serial Communication Errors:
- Check baud rate settings (9600)
- Ensure no other programs are using the serial port
- Try restarting both the Arduino and the Flask server
-
Touchscreen Issues:
- Verify display is properly connected
- Check touchscreen calibration
- Ensure correct display resolution is set
- Always ensure proper sterilization procedures are followed
- Regularly check system connections and hardware
- Implement emergency stop procedures for safety
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License - feel free to use this code for your cell culture projects!
OneDrive with Resources: Link 1
OneDrive with PSD:Link 1(https://imperiallondon-my.sharepoint.com/:w:/g/personal/da1322_ic_ac_uk/EXKUht7OnVdJsqrV60ub2PAB3-0p0oUdjwzsyK82-7Xsmw?e=OTsWRL )