Heart Beat Computer Game

Designed and built for one of my 1st year PhD projects, titled CRUFTFEST.

 From Urban Dictionary: Cruft
1. The dust that gathers underneath a bed, 2. Shoddily constructed or made, 3. Bad code, 4. Accumulated physical or virtual junk.

A decommissioned physiological monitor from a local hospital
An unwanted computer monitor from an IT lab
A partly broken exercise bike from ebay
A stem and front fork from an old Raleigh racing bicycle

The NOT SO cruft:
An Arduino development board
A laptop computer

The idea behind this project was to create a computer game featuring an element of the gameplay controlled by the heart rate of the user. The intention was to develop something that would be both entertaining and potentially informative as an experiment on the effect computer games can have on a person’s physiology.

The game was developed in Processing. I wanted to create something that would be relatively simple in concept but elegant in its functionality. The gameplay is inspired by the cyclic and rhythmic nature of the heart, with each heart beat expressed as a small blob which emerges from the centre of the screen. The blobs progress towards the edge of the screen at fixed angles in a cyclic manner. The aim of the game is for the user to ‘catch’ the blobs in a wheel of circles which they can control by pedalling the exercise bike. The design is such that the speed at which the player has to pedal is directly proportional to their heart rate.Therefore the faster the person’s heart beats, the faster they will have to pedal, making their heart rate rise, meaning they have to pedal faster, meaning their heart rate will rise…..

This positive feedback element within the game was something which I hoped would raise questions on aspects of balance, biofeedback and self-control.  With an interest in the effects stress can have on heart rate I also added a ‘baddies’ level to the game which does not require the user to pedal at all, but which requires them to shoot at an object which is spiralling towards their circle of balls. At the same time the music within the game becomes more tense.

Throughout the game the user’s heart rate is plotted in a circle around the outside of the gameplay area. When the user is playing on the ‘baddies’ level their heart rate is plotted as a red line so that those stages can be distinguished from their heart rate during normal gameplay.

The three inputs to the game are heart rate, pedalling speed, and the reading from a force sensitive resistor mounted on the handlebars. Heart rate is measured using three electrodes attached to the monitor. These would typically be attached on a patient’s chest in a hospital, however I avoided some of this inconvenience by attaching one electrode to some tin foil wrapped around the left handle of the exercise bike, and another electrode attached directly to the metal of the handlebars. The third electrode can be attached to the skin on the users left arm or waist. The heart monitor creates an audible tone on every detected beat, so all I did was wire an optocoupler, diode, and resistor in parallel with the speaker. When wired to the Arduino this creates a digital output of 1 whenever a beat is detected.

To detect the spin of the wheel I used a reed switch taped to the frame of the bike in close proximity to the rim of the wheel, on which I positioned 6 equally spaced magnets. I did some initial testing and found that 6 was the maximum resolution which I could achieve based upon the switching speed of the reed switch. Again, this gives a digital output of 1 whenever the wheel turns through 60 degrees.

The force sensitive resistor gives a variable voltage on the Arduino analogue pin when a force is applied to it. By setting an activation threshold I used this much like a normal push switch.

To mount the monitor on the bike I sawed the ends off my bike forks and attached the shortened forks upside down to the handlebars using an old stem. I then drilled four holes in a square of wood and used the mounting holes on the monitor to clamp the monitor against the forks.

The game is run from a laptop connected to the Arduino board and the mounted LCD screen.