Motor-Driven Heart Flow Simulator Using a Spinning Pump and Raspberry Pi
by Sujay_C in Circuits > Raspberry Pi
109 Views, 2 Favorites, 0 Comments
Motor-Driven Heart Flow Simulator Using a Spinning Pump and Raspberry Pi
I built a cardiac flow simulator that uses a spinning DC pump to circulate water through a closed loop system. This is useful to see how blood is driven through the heart, making it an effective simulation for medical use. To control this pump, a Raspberry Pi is used to simulate heartbeats, read sensor data in real time, and display a live EKG-style signal along with pressure and timing data.
This project was inspired by how pacemakers and cardiac monitoring systems rely on predictable mechanical motion and electrical signals to detect irregular behavior. By combining rotational motion, fluid flow, sensors, and software, this build demonstrates how spinning mechanisms can be used to model and analyze complex biological systems in a safe and interactive way.
The final DIY setup is fully functional. You can change the “heart rate,” observe how flow and pressure respond, and see how abnormal patterns can be detected by software. While this is a very simplified model, the design highlights the critical role of rotational motion in engineering projects that touch on biological systems.
Supplies
Electronics:
- DC Water Pump - The spinning component that drives fluid flow through the system
- Raspberry Pi (3 or 4) - Acts as the controller and data processor (also connects the display)
- Relay Module (5V) - Allows the Raspberry Pi to safely switch the pump on and off
- MCP3008 Analog-to-Digital Converter - Converts analog sensor signals into digital data the Pi can read
- Pressure Sensor Transducer (1/8” NPT) - Measures pressure inside the flow loop
- Voltage Sensor Module - Used to generate and visualize an EKG-style signal
- Potentiometer (optional) - Used to manually adjust heartbeat timing
- Jumper Wires and Breadboard - Helps connects all of the mentioned components to the RPi
- Small Display (HDMI) - Shows live graphs and system data
Mechanical/Plumbing:
- Flexible Water Tubing - Forms the closed-loop "blood vessel" path
- 3D Printed T-Connector (Custom) - Holds the pressure sensor inline with the tubing
- Zip Ties - Secures tubing connections
- PTFE (Plumber) Tape - Prevents leaks at threaded sensor connections
- Water Container or Tray - Used during filling and leak testing
Fabrication/Software:
- Fusion 360 - Used to design the custom T-connector and mounting parts
- 3D Printer/PLA - Prints custom plumbing and mounts
- Python (Tkinter + Matplotlib) - Handles timing logic, data visualization, and alerts
Understand the Layout
Before building everything, it helps to understand how each part fits together.
This project has four main parts:
- A spinning DC water pump that drives the fluid ("blood") through a loop
- A closed tubing loop that represents blood vessels
- Sensors that measure pressure and signal behavior
- A Raspberry Pi that controls motor timing, read sensor data, and displays the results
The pump’s internal motor spins an impeller, which converts rotational motion into fluid flow. By turning the pump on and off at controlled intervals, the system can simulate a heartbeat.
Build the Closed-Loop Flow Path
Create the physical “circulatory system.”
- Cut flexible tubing to form a smooth loop.
- Insert the DC pump inline so it pushes water around the loop.
- Add the 3D printed T-connector at any straight section of tubing.
- Thread the pressure sensor into the vertical port of the T-connector using PTFE tape.
- Secure all tube connections with clamps or zip ties.
Before powering anything, fill the loop with water and manually rotate or gently shake the tubing to remove air bubbles. Air trapped in the system will cause unstable pressure readings.
At this stage, nothing should leak and water should be able to circulate freely.
Wire the Pump and Sensors
Now connect the electronics.
- Connect the relay module to the Raspberry Pi GPIO pins.
- Wire the pump’s power line through the relay so the Pi can turn it on and off safely.
- Connect the MCP3008 ADC to the Raspberry Pi using SPI.
- Attach the pressure sensor and voltage sensor outputs to the ADC channels.
- You can also connect a potentiometer to adjust heartbeat timing manually.
The relay isolates the Pi from the pump’s current draw, which is critical for protecting the board.
Do a quick test by toggling the relay in software to confirm the pump spins.
Program the Heartbeat Control
Create the simulated heartbeat.
Via the Thonny IDE in RPi
- Define a BPM value.
- Convert BPM into a time period using period = 60 / BPM.
- Pulse the relay on briefly each cycle to spin the pump.
- Leave it off for the remainder of the cycle.
Changing BPM directly changes how often the pump spins, which changes the flow behavior. This is the core mechanical/digital connection in the project.
Test a few BPM values and confirm the pump pulses consistently.
Read Sensors and Display Live Data (Optional)
Turn the system into a monitor.
- Continuously read sensor values from the MCP3008.
- Plot voltage values over time to create an EKG-style waveform.
- Display BPM, pressure, and system status in a simple GUI.
- Update the display in real time while the pump runs.
This step is where the project becomes interactive. You can see how changes in pump timing affect pressure and signal shape almost instantly.
Test, Adjust, and Observe
Run the full system and experiment.
- Try different BPM values
- Observe pressure stability at slow vs fast pulse rates
- Watch how the voltage changes with timing
- Check for leaks and any unnecessary vibration
This step is intentionally open-ended to help encourage you to experiment and observe rather than reach a single “correct” result.