Simple Arduino Sit-up Judge
by onetrueandrew in Circuits > Arduino
1493 Views, 3 Favorites, 0 Comments
Simple Arduino Sit-up Judge
This simple Arduino setup and sketch will judge just how UP a sit-up needs to be to count. It will play one tone when you recline enough, and another when you sit up enough for a full crunch to count!
Ever get into an unnecessarily heated debate about someone else's crunches not counting? Me neither. But this gadget runs off a 9V battery and is light enough to hold to your chest or be placed in a chest pocket, and do the sit-up judging for you.
Supplies
- Arduino Uno
- Tilt sensor (aka inclinometer)
- Piezzo buzzer (passive buzzer)
- 9V battery & barrel connector
- M-F jumper wire
Step 1: Wiring Up
The Arduino Uno can be powered by a 9V battery using a barrel power connector. Stick a cheap tilt sensor in the GND and Pin13 terminals, and wire the piezzo buzzer to the other GND and Pin6. The buzzer will only work if the negative (-ve) side is grounded.
Step 2: Code
In the Arduino IDE, load this code and upload it to the Uno:
int inPin = 13;
int reading;
const int SpeakerPin = 6;
int lastsensorValue;
void setup() {
pinMode (inPin, INPUT);
}
void loop () {
delay(100);
reading = digitalRead(inPin);
if (reading == 1 && lastsensorValue == 0) {
tone(SpeakerPin, 1500, 300);
delay(500);
lastsensorValue = 1;
}
if (reading == 0 && lastsensorValue == 1) {
tone(SpeakerPin, 200, 300);
delay(500);
lastsensorValue = 0;
}
else {
delay(1);
}
}
Step 3: Test & Enjoy
The buzzer will play one tone when you recline enough, and another tone when you sit up enough for a full crunch to count. Connecting the tilt sensor directly into the Uno headers leaves little room for the sensor to tilt away from the Uno board.