Keep It Up!

by avaaubry in Circuits > Arduino

21 Views, 0 Favorites, 0 Comments

Keep It Up!

applause machine.png
step by step 2.jpg

Are you tired of losing focus while working or studying? Do distractions keep stealing your productivity away? Well, worry no more! Introducing the revolutionary Keep it Up!™ The gadget that rewards your dedication and mocks your procrastination!

Simply sit in front of the small box featuring an ultrasonic sensor and stay in the focus zone. If you manage to focus for the set amount of time, the Keep it up!™ will inform you of your good work by celebrating alongside you! Don't procrastinate though! Leave your desk for too long and Keep it up!™ will deliver a slow, sarcastic clap, letting you and everyone everyone around you aware of your failures!

Supplies

IMG_9430.JPG
IMG_9431.JPG
IMG_9426.JPG
IMG_9428.JPG
IMG_9427.JPG
  1. Arduino Uno
  2. ULN2003 Stepper Motor Driver Board
  3. 28BYJ-48 Stepper Motor
  4. HC-SR04 Ultrasonic Sensor
  5. Jumper Wires x 15
  6. 9V Battery + Barrel Jack
  7. Mechanical Arm/Clapper Attachment
  8. Box (plywood or cardboard)
  9. Hands (plywood or cardboard)
  10. Rubber Bands
  11. dowels x2

Hardware Assembly

Step 1: Connect the Motor to the Driver

  1. Plug the stepper motor’s 5-wire connector into the ULN2003 driver board.
  2. All 5 wired should connect to the driver board
  3. The LEDs should blink when powered


Step 2: Connect Driver to Arduino

Connect control wires:

  1. IN1 into Arduino pin 8
  2. IN2 into Arduino pin 10
  3. IN3 into Arduino pin 9
  4. IN4 into Arduino pin 11
  5. The positive 5-12v into Arduino 5v
  6. The negative 5-12v into Arduino ground


Step 3: Connect the Ultrasonic Sensor

  1. VCC into Arduino Vin
  2. GND into Arduino GND
  3. Trig into Arduino pin 2
  4. Echo into Arduino pin 3
  5. This should detect the distance of the user


Step 4: Power

  1. Plug 9V battery into Arduino barrel jack.
  2. ULN2003 gets power from Arduino (or external supply if needed).
  3. The Vin pin gets power from the external 9v battery pack


Coding

Step 1: Motor library

  1. Import the motor library into the code


Step 2 : Assign variables

  1. Declare names, types and values to every variable


Step 3: Setup function

  1. Set sensor pins as input/output.
  2. Set default motor speed.


Step 4: Get Distance Function

  1. Send a pulse from trig.
  2. Measure echo time.
  3. Convert time to distance.
  4. Return the distance.


Step 5: Main loop

  1. Measure distance.
  2. Sets the baseline distance
  3. Compares current distance to baseline.
  4. If user stays within tolerance:
  5. Start timer.
  6. If timer reaches 60 seconds, run win function.
  7. If user leaves:
  8. Start leave timer.
  9. If gone too long , run slow clap.


Step 6: Make a win function

  1. Increase motor speed.
  2. Move forward.
  3. Move backward.
  4. Repeat a few times.
  5. This will make the physical hands clap in a genuine way


Step 8 — Make a lose function

  1. Lower motor speed.
  2. Smaller movement.
  3. This will make the physical hands clap in a slow, sarcastic way

Box & Hands

step by step.jpg