Motivating device for pull-ups on the horizontal bar
The author of this homemade product is 15 years old, and with it he won the Arduino Day Challenge. This bar motivates you to exercise. When pulling up, music sounds on it, and at the end of the exercise, the athlete receives an award in the form of Tic Tac candy.
By the way, such a device (with minor modifications) can be easily used as an alarm.
Tools and materials: – Arduino Nano; – Servo motor MG90S; – Laser diode 9 mm; – 0.5 W speaker 40 mm; – Power supply 5 V; – DC power connector; – Photoresistor; – Resistor 1 kOhm; – Capacitor 100 uF; -Slide switch 11 mm x 6 mm; -PETG thread;
-Wires;
-2 M4 screws and nuts; -4 M3 screws; -5 M2 screws;
-Tic Tac lollipops; < br> -Acryl;
-Turner in the door opening; -Printing board 6 cm x 4 cm (M2 holes 55 mm x 35 mm); – Screw terminals; -Pin connector; -3D-printer; -Soldering iron;
Step one: the principle of operation
The principle of operation of the device is not complicated. The crossbar is fixed at the top of the doorway. Along the edges of the crossbeams, there is a laser on one side, and a photoresistor on the other side.
As soon as the user places their hands on the bar, the beam is interrupted and the voltage at the ends of the photoresistor drops. The Arduino Nano reads the signal and issues a command to play the song. If, after 30 seconds, after playing the song, the hands are still on the bar, then Arduino gives the command to start the servomotor and dispense one Tick-tock candy.
Step Two: 3D Printing
The master designed all the parts in Fusion 360, then processed in Cura and printed on the Ender 3 V2 3D printer. Filament – PETG, layer height – 0.2 mm. You will need to print:
“Base.stl”
“RotatorDispenser.stl”
“CoverBase.stl”
“LaserClamp.stl”
“LdrClamp.stl”
You can download the files here.
Step three: breadboard
While the details are being printed, the wizard checks the operation of the device on the breadboard .
1. Place the Arduino Nano on the breadboard.
2. Connect 5V to the positive rail (red) and GND to the negative rail (blue).
3. Install a photoresistor and connect one of its pins to 5V and the other to GND through a 1K resistor.
4. Connect the second lead to A0.
5. Install the MG90S servo and connect the brown wire to GND and the red wire to 5V.
6. Connect yellow wire to D5.
7. Install the speaker and connect its red wire (+) to D11 and the black wire (-) to GND.
8. Finally, add the laser module and connect its red (+) wire to 5V and its black (-) wire to GND.
Step four: programming
Let's move on to programming the Arduino Nano. Open Arduino IDE, select your Arduino Nano board, your COM port and click “Upload”. The “LightThreshold” parameter determines the sensitivity of the photoresistor to light.
The code can be downloaded below.
SmartPullUpBar.ino Here you can download the songs that are written in the code.
Step five : testing
Next, you need to test the circuit. The master turns on the power and blocks the beam. If everything is assembled correctly, then music will play and after a while the servo shaft will turn.
At this stage, two common problems can arise, even if everything is done correctly.
When you close the sensor, no music plays. You can easily solve this problem by increasing the “LightThreshold” value, which was mentioned in the previous step.
If the music starts playing, if the beam is not blocked, then on the contrary, you need to decrease the “LightThreshold” value.
The correct threshold value setting will be using a serial monitor and viewing the illumination values generated by the sensor. (Can range from 0 (absolute darkness) to 1023 (absolute light).
Step six: board
After checking the operation of the device, the wizard starts mounting on the circuit board. The only difference between the printed circuit board and the breadboard is that the master installed the power connector and installed a 100 uF capacitor in parallel.
Step Seven: Build
Begins to build. In total, you need to assemble three modules: a photoresistor module, a laser module and a control and dispensing module.
Installs the servo in the case and fixes it with screws.
The laser mounts into the bracket seat.
Install a photoresistor in such a mount.
Soldered red wire to the positive terminal of the DC connector.
Solders the black wire to the negative terminal of the DC connector.
Solders another red wire to the slide switch.
Installs the DC connector into the corresponding hole in the base and secures it with a nut.
To the slider the switch is soldered by the plus (red wire) from the power connector. Installs the switch into the socket of the case.
Connects the red wire to the positive power input of the board and the black wire to the negative power input.
Connects the servo to the screw terminals of the board.
Connects the speaker.
Installs the board in the case and screws it in.
Cuts a rectangle of approximately 75 mm x 17 mm from transparent plastic sheet and places it in the tray.
Step eight : module installation and connection
On one side of the crossbar installs and fixes the photoresistor, on the other side the laser.
The laser and resistor must be located on the same axis.
Turns on the laser module, connects it to a ~ 5 V power supply. Turning the clamps aligns the laser beam and the center of the photoresistor.
Then sticks the control module to the wall.
Next you need connect laser and photoresistor to screw terminals.
Connects the block to the DC jack and turns on the switch.
When the unit is first turned on, the servo will automatically move to the 0 degree position and lock in place. In this position it is necessary to install the “RotatorDispenser” part on the shaft. The oval groove on the part and the hole in the tray must be aligned.
Installs the speaker into the cover and screws it onto the chassis.
The last step is loading candy into the tray.
Everything is ready.
The whole process of making such a motivating device for pull-ups can be watched in the video.