Pages

Wednesday, April 24, 2013

Project Overview

Abstact:

     The goal of the project is to make a "treadmill" that adjusts speed based on optimal heart rate. The basis of this is to help lose weight more efficiently and promote healthiness.
     In order to achieve our goal, we will program a code using C++ that speeds up or slows down the "treadmill", which will be represented by a hamster wheel.  The code will ask for your gender and age and then plugs them into the appropriate equation for you in order to determine your optimal heart rate. Then every five seconds a random heart rate is ran through the code to show how the "treadmill" will react. If it is lower than the optimal heart rate the speed will increase, if it is higher the speed will decrease. In order to show that our code works, we will use a motor-bee with an electric motor. We will run the code through a computer connected to a Motor-bee that will be able to send different voltages through our electric motor. The electric motor will be glued to a block of wood and has a gear attached to the end of it that fits into the  wheel and spins it.

[Figure 1: Block Diagram of Technical Process of Program]

The main technical activity was writing the code that simulates a heartbeat, comparing it to a calculated ideal heart rate range, and adjusted treadmill speed accordingly. First the program must declare all variables and constants in addition to initializing the MotorBee board/loading the bee’s dynamic link library (DLL).
The program contains two sub functions: the first when run, adds a random number between -1 and 2 to the current heartbeat (this favors increasing as one’s heart rate tends to do over time when exercising), the second function when run, increases the heartbeat if the treadmill is set to fast, and decreases the treadmill if set to slow (the amount it increases is dependent on how far the treadmill speed is from the median up to a maximum of five).
First the program asks the user to enter their gender and age; from these it can calculate the ideal maximum and minimum heart rate for exercising. After stating those two rates, it starts the treadmill. If the heart rate is below optimal it speeds up and if it is above optimal, the program slows it down. The program constantly checks the heart rate every second so it can set the speed of the treadmill accordingly. If the heart rate is neither above the maximum nor below the minimum, it will keep a constant speed. If at any time the individual heart rate exceeds 200 the machine shuts down and calls 911.

The machine also contains some special features: one of which is the spring feature. It sets the treadmill to maximum speed and keeps it there until the user’s heart rate reaches unsafe levels at which point it shuts off. The treadmill will stay at the lowest speed setting so the user can have a slow peaceful walk. 

No comments:

Post a Comment