Smart Pull-Up Bar

6,653

56

27

Introduction: Smart Pull-Up Bar

About: My name is Nikolas and I am 15 years old. I love making things with electronics and 3D printing in order to solve problems, to improve our lives but also to satisfy my imagination and curiosity! If you like my…

Hello friends! My name is Nikolas and I am 15 years old. Today in this Instructable I'll show you how to make a Smart Pull-Up Bar which, when you start doing Pull-Ups or Chin-Ups starts playing music in order to keep you motivated and after exercising for a certain period, a reward, a Tic Tac, in my instance gets dispensed! Make sure to watch the YouTube video above to see the Smart Pull-Up Bar in action and to follow the instructions from there if you prefer!

I originally thought of making this to motivate me to work out more, but it turns out I just wanted an excuse to eat more candy!

Supplies

These are the components you'll need:

If you decide to build a PCB as I did you'll also need:

You will also need:

(These links are Amazon Affiliate links which means that if you purchase the products using them I'll get a small commission of the sale at no extra cost for you! This way you can help me make more and cooler projects and I really appreciate it! Thank you!)

Step 1: Understand How It Works

Basically I've made a Laser beam sensor by attaching a cheap Laser Diode and an LDR on the Pull-Up Bar. They are perfectly aligned which means that a lot of light reaches the LDR and thus the sensor outputs a high analog value. However once I place my hands on the bar to start working out I block the light beam, the value gets significantly lower and the sensor sends a signal to the Arduino Nano, which is mounted on the wall in an enclosure and then a song starts playing using a small speaker (In my case it was Take on me by A-ha). After around 30 seconds, when the song ends, if I still have my hands on the bar, a reward, a Tic Tac gets dispensed using a 3D printed mechanism that's rotated by a servo!

Now that you get how it works let's start making it!

Step 2: 3D Printing

I designed all the parts in Fusion 360, sliced them in Cura and printed them with my Ender 3 V2 in PETG at 0.2mm layer height. You will need to print:

  • The "Base.stl"
  • The "RotatorDispenser.stl"
  • The "CoverBase.stl"
  • The "LaserClamp.stl"
  • And the "LdrClamp.stl"

You can find all the files Here

Step 3: Circuit Part 1

It's time to connect the electronics!!

1. Place the Arduino Nano on the breadboard

2. Connect 5V to Positive Rail (red) and GND to Negative Rail (blue)

Step 4: Circuit Part 2

3. Add the LDR and connect one of its leads to 5V and the other one to GND with the 1kΩ resistor (the order doesn't matter)

4.Connect the second lead to A0 as well

5.Add the MG90S Servo and connect its Brown Wire to GND and its Red Wire to 5V

Step 5: Circuit Part 3

6. Connect the YellowWire to D5

7. Add the small speaker and connect its Red Wire (+) to D11 and its Black Wire (-) to GND

8. Finally add the Laser Module and connect its Red Wire (+) to 5V and its Black Wire (-) to GND

Step 6: Programming

Time to program the Arduino Nano! I have attached my code below for you to download if you want. Open Arduino IDE select the Arduino Nano Board, your COM Port, click Upload and you're done! The LightThreshold defines how sensitive the LDR is to light, keep this in mind as I'll go into it deeper in the next step.

Take a look at adithyalokesh17's work as well! He has turned a lot of popular songs (Like "Take on me" which I used) into light Arduino code which is easy to use with buzzers and speakers without needing any complicated SD card readers etc.

Step 7: Test/Troubleshooting

When the code gets uploaded nothing happens. Then I cover the LDR with my finger so that I block the light from reaching it. Pretty much a simulation of what will happen during the workout when my hands will block the laser beam. In both cases the If statement gets triggered, music starts playing and then the servo rotates and dispenses a Tic Tac.

There are two common problems that can ocure here even if you did everything properly.

  1. The music doesn't start playing when you cover the sensor. You can easily solve this by increasing the "LightThreshold" value we talked in the previous step thus making it more sensitive.
  2. The music starts playing without even covering the sensor. You can solve this be decreasing the "LightThreshold" value thus making it less sensitive.

Tips:

  • A good tip to adjust the Threshold value just right would be to use the serial monitor and see the light values your sensor produces. (The can range anywhere between 0 (Absolute Darkness) to 1023 (Absolute Light)
  • To get accurate measurements I would suggest aiming the laser diode to the LDR and working with those values instead of the ones of the ambient light of your room.

Step 8: Circuit Board

Since everything works it's time to make a pcb to fit all the components in a more compact enclosure. The only difference the PCB has from the breadboard circuit we made earlier is that I've included a Power Input terminal which connects (+) to 5V and (-) to GND and I have added a 100μF capacitor (optional) in parallel to smooth out the current.

Step 9: Attaching the Servo

  • Screw the servo to the Base using 1 or 2 M2 screws.

Step 10: Pushing the Laser Into the Clamp

  • Push the Laser Diode into the LaserClamp.

Step 11: Attaching the LDR to the Clamp

  • Insert the LDR into the LdrClamp. (There are two small holes To pass the wires through)

(You should first solder some longer wires to both the LDR and the Laser)

Step 12: Soldering

  • Solder a preferably red wire to the positive lead of the DC Jack.
  • Solder a black wire to the negative lead of the DC Jack.
  • Solder a new red wire to the slide switch.

Step 13: Attaching the DC Jack

  • Insert the DC Jack into its hole in the base. Secure it in place using the nut.

Step 14: Soldering the Switch

  • Solder the red wire of the DC Jack to the other lead of the switch.

Step 15: Attaching the Switch

  • Push the switch into place.

Step 16: Connecting Power to PCB

  • Connect the red wire to the positive power input of the pcb.
  • And the black wire to the negative power input.

Step 17: Connecting Servo to PCB

  • Connect the servo to the male headers.

Step 18: Connecting Speaker to PCB

  • Connect the speaker

Step 19: Attaching PCB to Base

  • Fit the PCB into the Base
  • Secure it in place with 2-4 M2 screws

Step 20: Cutting & Installing the Plastic Sheet

  • Cut the transparent plastic sheet into a rectangle of around 75mm x 17mm and trim its sides until it fits tightly into the base.

Step 21: Installing the Laser to the Bar

  • Attach the LaserClamp to one side of the Pull-Up Bar and tighten the clamp using an M4 screw and nut

Step 22: Installing the LDR to the Bar

  • Attach the LdrClamp to the other side of the Bar and tighten it again using an M4 screw and nut

Step 23: Aligning the Laser and the LDR

  • Turn on the Laser Module by connecting it to a ~5V power source (Arduino 5V pin, 3 x AA batteries, 1S Lipo, 18650 battery or whatever you prefer)
  • Rotate the Clamps until the Laser Beam hits the center of the LDR

Step 24: Glueing the Enclosure to the Wall

  • Take the Hot Glue Gun, possibly all of the makers' most favorite tool, and glue the Base to your wall.

Step 25: Connecting the Laser and the LDR to the PCB

  • Wrap the cables of the Laser and the LDR around your door
  • Connect the two red wires to the central section of the triple screw terminal
  • Connect the black wire of the LDR to the upper section
  • And the black wire of the Laser to the other section

(Of course all these connections will differ based on how and if you make the PCB and mine can just be used as a concept refernce)

Step 26: Installing the Dispenser

  • Connect the Power Supply to the DC Jack and turn the switch on

When the Arduino first gets powered on, the servo automatically goes to its 0 degree position and locks in place. When that happens, attach the RotatorDispenser to it. Make sure that the two holes for the Tic Tacs align properly.

Step 27: Adding Cover

  • Fit the speaker into the Cover
  • Screw the cover to the Base using 2 - 4 x M3 screws

Step 28: Adding Tic Tacs!

Lastly add some Tic Tacs…

Step 29: Congratulations the Project Is Now Complete!

And the Smart Pull-Up Bar is finally complete!!

I hope you enjoyed this Instructable as much as I did making it! If you have any questions or suggestions let me know! Also consider subscribing to myYouTube Channel for more tutorials and cool builds and to support me throughout this journey. Have a great day!

Automation Contest

Runner Up in the
Automation Contest

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge
    • Unusual Uses Contest

      Unusual Uses Contest

    27 Comments

    0
    Gangsta Gaming
    Gangsta Gaming

    Question 4 months ago

    Hi, sorry if I am asking way too many questions, and hopefully this is the last, but I finally got all the parts required for this project, and I don't completely understand how to build the PCB. Is there any way you could provide a circuit diagram of the PCB, as I can't really see how everything is connected in the picture provided? (mostly the wires on the bottom) Thank you very much!

    0
    Nikolaos Babetas
    Nikolaos Babetas

    Answer 4 months ago

    Does a combination of these two pictures work for you? (The PCB is pretty much what you have on you breadboard with a few screw terminals to help with the connections.) If not let me know and I'll gladly make a circuit diagram for you!

    FKHB3CKKMULQ95S.pngFTMNK0BKMKLM0EQ.png
    0
    Gangsta Gaming
    Gangsta Gaming

    Reply 4 months ago

    Ok, I got all the connections on the top of the PCB correct, but I still don't understand the connections on the bottom. It would be great if you could make a circuit diagram! (or maybe just a sketch of the wire connections on the bottom of the board, as the picture for that is a bit unclear)

    0
    Nikolaos Babetas
    Nikolaos Babetas

    Reply 4 months ago

    It's far from perfect but hopefully it will help you with the connections! Keep me updated!

    Schematic_SmartPB_2021-06-06_20-38-44.png
    0
    Gangsta Gaming
    Gangsta Gaming

    Reply 4 months ago

    Oh, I thought you meant you were going to create a Fritzing style diagram or something. To be honest, I actually don't really know how to read this type of diagram. Is there any way you could make a Fritzing style diagram of just the bottom of the PCB, showing a breadboard, maybe? Thanks and sorry for any trouble!

    0
    Nikolaos Babetas
    Nikolaos Babetas

    Reply 4 months ago

    Hello! Did you figure it out?

    0
    Nikolaos Babetas
    Nikolaos Babetas

    Reply 4 months ago

    Isn't what you're asking exactly what I sent you a few hours ago and also what's on step 3? I am sorry but I am not quite sure what you are asking for.

    0
    Gangsta Gaming
    Gangsta Gaming

    Question 4 months ago

    I built the test board, and everything was working fine, but I came back a day later, and now, for whatever reason, my servo isn't moving at the end of the song anymore. Can you please help me with this? I tried using a different servo, thinking the previous one was faulty, but that didn't solve the problem.

    0
    Nikolaos Babetas
    Nikolaos Babetas

    Answer 4 months ago

    I would first try running the simple servo code you can find in the "examples" section and see if the servo is running. Also are you sure you've connected the servo properly?

    0
    Gangsta Gaming
    Gangsta Gaming

    Reply 4 months ago

    Okay, turns out I actually have 2 faulty servos. I used a different servo and it's working fine now!

    0
    Gangsta Gaming
    Gangsta Gaming

    Question 4 months ago on Step 5

    Hi, I built the test board, and when I cover the LDR, the music plays and the servo rotates, However, that only works once. It wont happen again unless I reset the board. How do I fix this?

    0
    Nikolaos Babetas
    Nikolaos Babetas

    Answer 4 months ago

    This is because I've added a couple minutes delay at the end of the code to prevent the reward mechanism to take place twice while working out but most importantly to prevent myself from exploiting it completely and eating a LOT of Tic Tacs. Simply deleting the delay function at the end of the code will resolve this issue!

    Screenshot_10.png
    0
    Gangsta Gaming
    Gangsta Gaming

    Reply 4 months ago

    Ohhh ok. I will just decrease the time in order to test it then! Thank you!

    0
    Nikolaos Babetas
    Nikolaos Babetas

    Reply 4 months ago

    You're welcome! Let me know how it goes!

    0
    Gangsta Gaming
    Gangsta Gaming

    Question 4 months ago

    Hi, are the PCB, terminals, and headers optional if I am building the circuit on a solderless breadboard?

    0
    Nikolaos Babetas
    Nikolaos Babetas

    Answer 4 months ago

    Yes they are! Good luck with your build!

    0
    Gangsta Gaming
    Gangsta Gaming

    Reply 4 months ago

    Thank you!

    0
    abrothman
    abrothman

    6 months ago

    Neat project! One thing: your circuit board isn't a "PCB" - that's a PRINTED circuit board.