Arduino code for a prototype CPR training manikin that simulates dampening on recoil to make compressions feel more realistic. Uses a solenoid coil wrapped around the manikin spring (shown in picture below) to adjust the spring force throughout the recoil. A motor driver controls the voltage (using PWM) through the coil to adjust magnetic force. See here for a video demo. You can see the chest recoil looks more like a nerf ball reinflating than a spring shooting back up.
Uses an accelerometer at the base of the chest plate (shown below) along with a series of kalman filters (for smoothing) to estimate depth.
- MoldingManikin.ino - The main arduino code file. Contains setup() and loop() functions. Handles setup and manages other .ino files below. Also accepts and handles input for these settings:
- Damping magnitude (Recoil Time) - Set inside CPRDummy android app set to "Damping Test" mode.
- Molding (residual damping) - Set using a potentiometer (optional)
- bluetooth_connection.ino - Sends depth and ventilation data over bluetooth to CPRDummy android app.
- magnet_control.ino - Sets direction and magnitude of magnet force
- accelerometer.ino - Handles accelerometer input and converting to usable depth (z) data for calculations. Uses a stack of 2 kalman filters for smoothing.
- ventilations.ino - Reads ventilation velocity sensor. Uses a kalman filter to smooth raw data.
- KalmanSmooth - My library for handling real-time smoothing of sensor data using a kalman filter.