Pushup Counter

by coltonajanovec in Circuits > Arduino

30 Views, 0 Favorites, 0 Comments

Pushup Counter

IMG_0093.jpg

I made a push up counter that attaches to my push up board. I made this because I thought it would be challenging and also a cool addition to my workout routine.

Supplies

f9f19959-a72c-48cf-9198-6518354c3f8e.jpg
  1. Spark fun kit

-16x2 LCD display, 26 jumper wires, 330k resistors, tri-color LED, Ultrasonic distance sensor

  1. Arduino blueprint
  2. Pushup board
  3. 3d printer
  4. 2.85mm filament

Make Arduino Blueprint

FN8963QMAB3C2A0.jpg
F9QZ4DYMACISEBJ.jpg

Make wire connections with LCD display and ultrasonic distance sensor along with the Arduino itself with ground wires etc. Also, make sure resistors have correct ohms. This depends on the different screens you use and brands of materials. For me the 330k resistors worked. This design for me, was a modification of somebody with the same idea. In the debugged code and blueprint, there is code for a buzzer and a button on the right which I did not include in mine because I just wanted to modify it and make it more personalized to me. Also, a problem you may run into is that the values won't show up on the LCD display. Don't panic, just add a potentiometer on the breadboard lining up to the LCD display, and twist it until the values show up clearly. To add a potentiometer, place it lined up with the LCD display pins, then add a ground wire and an output wire. Also, in order to make it easy to detach the sensor from the board, I would sauter a four wire connecter in order to do so like shown in the image above.

https://projecthub.arduino.cc/glerumkyle/pushup-counter-helps-with-stay-at-home-training-cec1a3

Make Arduino Enclosure With Holes for Battery and Screen

FQ6UFJRMAB3C28B.jpg

A two level enclosure in order to enclose breadboard, arduino, and has holes for batteries and screen display. This was mostly cut out on the bandsaw and hot glued together. Optionally you can paint the enclosure for aesthetic value. Measurements of enclosure itself include

  1. Enclosure-9x5x3 inches
  2. Hole for battery plug in-1.5x.5 inches

Make Mount for Distance Sensor

IMG_0074.jpg
Screenshot 2025-05-06 171352.png

3d printed mount perfectly measured for Ultrasonic distance sensor. To make this was pretty simple. I measured the dimensions of the sensor and created a fusion design as a slot that it could fit inside. The most crucial measurement would have to be the thickness of the slot in order to correctly fit the sensor. The sensor sits at a flat angle on the mount,

Thickness of Slot-.227"

Length Of Mount-2.3"

Height of Mount-.9"

Debugged Code

PS>Some of the code does not relate my design but it will not effect any of the code that shows values on the screen when you complete a pushup (underlined code is code you do not need). The only thing I had to debug was the ultrasonic distance sensor value by 5cm to pertain to my chest.

/* PUSH UP COUNTER



An ultrasonic sensor measures the distance between you and your head, if the distance is larger than 20 cm a rgb-led will shine red,

if the distance is between 10 and 20 cm, it turns magenta

and if it is less than 10 cm it turns blue, and a point appears on a lcd screen.

Every ten pushups it makes a sound.

You can reset the score with the push of a button.

*/


#include <LiquidCrystal.h> // include LCD library


#define BLUE 12 // define RGB-led pins

#define RED 10


const int trigPin = 8; //set pins for the ultrasonic sensor, button and buzzer

const int echoPin = 9;

const int buttonPin = A0;

const int b = 13;


long duration; // set integers

int distance;

int i;

int buttonState = 0;

int x = 1;

int y = 1;


LiquidCrystal lcd(6, 7, 2, 3, 4, 5); // set lcd pins


void setup() {

Serial.begin(9600); // begin in 9600 baud


pinMode(trigPin, OUTPUT); //set pin modes

pinMode(echoPin, INPUT);

pinMode(buttonPin, INPUT);

pinMode(b, OUTPUT);

pinMode(RED, OUTPUT);

pinMode(BLUE, OUTPUT);


lcd.begin(16, 2); // begin lcd, define scale of lcd (16 places in a row, 2 rows)

lcd.print("Push Ups:");




}


void loop() {

digitalWrite(trigPin, HIGH); // send out an ultra sonic sound for 10 microseconds and measure the time it took for the sound to go from the trigpin to the echo pin

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = duration * 0.034/2; //convert the time the signal took to travel to distance in cm


if (distance >= 20) {digitalWrite(RED, HIGH); //configure RGB-led to burn red, magenta or blue depending on distance

digitalWrite(BLUE, LOW);}

if (distance <= 20) {digitalWrite(BLUE, HIGH);}

if (distance <= 10) {digitalWrite(RED, LOW);}


if (i == (10 * y) && x == (1 * y)) { //this if statement plays a sound every ten pushups

tone(b, 146.8);

delay(50);

noTone(b);

delay(100);

tone(b, 146.8);

delay(50);

noTone(b);

delay(50);

tone(b, 293.7);

delay(100);

noTone(b);

x ++;

y ++;

}

else if (distance <= 10) {delay(350);} //this if else statement makes sure that the time between pushup-readings always stay the same


buttonState = digitalRead(buttonPin); //these lines of code resets every integer and the lcd to the original state by the press of a button

if (buttonState == HIGH) {

i = 0;

x = 1;

y = 1;

lcd.setCursor(0,1);

lcd.print("0 "); }


lcd.setCursor(0, 1); // set cursor on the second row


if (distance <= 10 ) {i ++;} //print a point if a pushup has been done

lcd.print(i,DEC);


while (distance <= 10) { //if the distance stays smaller then ten for a while, this piece of code makes sure that only one point is given for one pushup

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = duration * 0.034/2;

delay(100);}

}

Attach to Push Up Board, Plug In, and Workout

F0KV2PTMB6J28AX.jpg
IMG_0072.jpg

I made a mount for the distance sensor on the push up board, once it is all plugged in, you do your pushups and watch the screen count. The mount is superglued or screwed into the push up board and from there you can plug it into the enclosure. The design considerations are stated above in step 3.

Assembly Report

I made an Arduino screen mount, ultrasonic distance mount, and arduino enclosure. The arduino enclosure needed to be assembled. The pushup board was purchased by me and it is the whole purpose of the parts because the screen shows the pushups counting and the sensor senses how close my chest is to the ground.The biggest challenge was definitely keeping stability and getting the right measurements for the screen and the sensor mounts.To improve fitment and fabrication I made tighter side pieces each time for the sensor mounts so it wouldn’t move. If I were to do it again I would make sure to measure twice before entering the dimensions into the cad model and doing tons of final prints.

Manufacturing Report


I’ve created a mount to sit my arduino sensor on so it doesn’t move and another one for the screen. I have made a little enclosure for the arduino to sit in once the coding and arduino schematic are working properly.I am creating an enclosure for the arduino and all the wires so that it doesn’t look messy.I also sautered connections for the lcd screen and the sensor so they wouldn’t have to be directly connected to the bread board. For the mounts I had to make cad models and do countless prints to make sure they fit perfectly and I would have to change certain thickness and length dimensions. For the enclosure I am just going to manually cut out wood and connect them together to make a good looking enclosure. I learned how to properly use 3d print software, filament, etc. without breaking the machine or messing up my prototypes. I would share the google classroom instructions with another student because they are very helpful. All I used was regular 3d print filament and hot glue to attach to my board. For the enclosure just typical plywood. For the sensor mount I:

1.Used calipers to measure sensor

2. Made a rough cad model

3.See if It fits

4:Repeat with screen

For enclosure

1.Get a general layout of arduino components

2. Measure for an enclosure

3.Cut out wood

4.Connect Parts

5.test

6.repeat

Getting the sizing right and also making the code and arduino schematic to make the screen and the sensor correlate with each other was very difficult.The two mounts had to be fixed and fitted multiple times to be functional. If another person were to do this they could make more careful measurements and study coding beforehand to be more prominent in it.