Slapstick
The project conducted as part of the Computational Design and Digital Fabrication seminar in the ITECH masters program. https://icd.uni-stuttgart.de
Dilara Karadamir, Eleftheria Konstantina Petropoulou
The Idea
Exam period is coming. And you already feel sleepless and hopeless. You want to study, but you’ve lost your motivation. And it’s crucial that you study hard. But the weather outside is perfect, it’s sunny. All you want to do is stroll around. BUT no. You will study. And we will help you do that. We present to you the Slapstick. Slapstick is going to be your exam buddy. You just put it in your desk, in front of your book. And whenever you feel like sleeping…. Slapstick takes control. You don’t want to make it aggressive. So just study hard!
If you get closer than 6cm, be ready for an aggressive friend!
#PLEASE USE MINDFULLY!
The Materials:
For the Arduino:
- Arduino
- Wires
- Micro Server
- Ultrasonic Sensor
- Arduino USB Cable
- Arduino Expansion Board
- Small Breadboard
- 9V Battery & Cable
For the Mechanism:
- MDF 2mm
- Foam Cup
- Plastic Straws
- Glue
- Cutter
- White Acrylic
- Tape
Setting Up the Arduino
Plug the cables, the servo motor & the ultrasonic sensor according to the diagram :
Start with the combining expansion board to Arduino Uno. Have the breadboard and attach the ultrasonic sensor on it. Plug the 5V from Arduino to a pin on the breadboard and do the same for the 'ground'. Now you have the charge on the breadboard, that you can plug your accessories. From ultrasonic sensor, plug the vcc to the same line with 5v pin and grd to 'ground' pin line. According to the code, plug the 'trig' and 'echo' to the Arduino pins and you are done with the ultrasonic sensor.
For the servo motor, much simpler;
- brown cable to the same line with ground
- red cable to the same line with 5V
- orange cable to the pin you had introduced in the code
Be careful that no cable is not on the sight of the sensor. Otherwise, it will detect the cable and will not respond according to your movement.
In order to have your first Arduino set: https://www.amazon.de/gp/product/B01L0ZL8N6/ref=ox_sc_act_title_1?smid=AV5KLZDJ9GHAI&psc=1
Putting the Code Into Arduino
Connect your Arduino to your computer and upload the #Slapstick file :
Just put the code into your Arduino Uno with the USB cable, and once you have put it, it is good to go. You don't have to put it every time you start the object.
You can learn more about codes and get the servo library
( which is a must to run the code from here: https://www.arduino.cc/en/reference/servo, https://github.com/arduino-libraries/Servo)
#include < Servo.h >
//________________________________________________________Ultrasonic variables______________________________________________________ // defines pins numbers const int trigPin = 10; // to have the ultrasonic sensor const int echoPin = 8; // defines variables long duration; // float duration, distance; OUR CHOICE int distance; int desiredDistance = 6; //_________________________________________________________Time variables___________________________________________________________ //int period = 1000; // is a function that returns the amount of milliseconds //unsigned long time_now = 0; unsigned long startTime; unsigned long currentTime; unsigned long sensorTime; //_________________________________________________________Servo variables___________________________________________________________ Servo myservo; // create servo object to control a servo int pos = 0; // variable to store the servo position bool slapped = false; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin, INPUT); // Sets the echoPin as an Input myservo.attach(9); // attaches the servo on pin 9 to the servo object //startTime = millis(); // start counting time //sensorTime = millis(); //unsigned long CurrentTime = millis(); // time variables? //unsigned long ElapsedTime = CurrentTime - StartTime; } //___________________________________________________________________________________________________________________LOOP___________________ void loop() { currentTime = millis(); digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); pinMode(echoPin, INPUT); // DISTANCE CALCULATION duration = pulseIn(echoPin, HIGH); distance = (duration*.0343)/2; Serial.print("Distance: "); Serial.println(distance); delay(100); // SLAP slapped = false; if (distance <= desiredDistance){ if(slapped == false){ // slapping happens (servo code) for (pos = 0; pos <= 180; pos += 5) { // goes from 0 degrees to 180 degrees in steps of 1 degree myservo.write(pos); // tell servo to go to position in variable 'pos' delay(20); // waits 15ms for the servo to reach the position slapped = true; } } } }
Making the Box
Cut the pdf:
Cut a box with the following dimensions (cm): 11-11 (x2), 11-6 (x2), 11-6,4.
So in total you would have the 6 pieces. But for the base, we need it to be removable, so we could change the battery later on. So have two pieces ; you can make a basis for your box by cutting a 11-6,4 and a 10,6-4 slab and sticking them together. It is better to use this component as a cap.
Uncover the Eyes
Wake it up:
Now, we need to make the holes so we could have the ultrasonic sensor eyes there and also a small hole for the hand too, so it will have space to go in when it needs to slap :)
So cut a small opening at the 11-6,4 & 11-11 components as seen in the pictures.
Give It a Character
Paint it & Doodle it:
For this step, we preferred to paint it simple white with a some wooden texture behind. But you can color it and draw on it as you want. Then let it dry for a while, that we can make the hand.
Cut a Nice Hand Out of Foam Cup
Creating the slapper:
For this we used foam and we cut a simple hand, but again this step is where you can go more creative and create any shape you want. But be careful that, you wouldn't want it to be too heavy, because the servo motor we are using a simple one, that it needs a light material in order to slap firmly and vastly :)
Connect the Hand
Giving life to the hand:
Take the plastic straw and put some glue on the top. Then stick it in the foam cup hand. Let it dry. Take the two-way plastic servo head and attach (tape) it at the end of the straw. This is the place where we later on connect the hand to the servo.
Be careful that you don't cover the middle hole to connect to the motor and you attach it hard that it won't come off as it keeps slapping. Also be careful about the sides of the head component, make sure you are putting it in the right side, so later on you won't have trouble slide it into servo.
At this stage, actually you have everything to go, so make yourself a trial setup and see if everything works properly. Later on we continue with putting it in a nice package.
Really Creating the Box
Put the parts together:
Take the 11-11 box component and glue it with the two 6-11 components. Then glue the 11-6,4 one at the top, with the hole on the right side, as seen in the picture. Leave the 11-11 with the hole last, so that you can put the mechanism inside the box easily.
Also you will put the base in the end, after you have completed all the setup, so it just slides in as a closing piece.
Put the Mechanism Inside
Almost ready to go:
First attach the servo motor on the upper right side (tape is your friend, feel free to use it). Attach the straw- Hand to the servo with some glue. Then put the arduino with the breadboard and the sensor on the upper left side. Put the battery under the servo motor. Don’t plug the battery in yet.
Because once you put it, you would have hard time every time you unintentionally put your hand in front of the sensors :)
Fill the Remaining Space
Adjust the proportions :
Cut two pieces of foam cup and fill the remaining space of the box (we used two 11-6 pieces of 2cm thickness). So that it could be in a higher position with your studying posture that it can more precisely detect your laziness.
You can also even make it higher or shorter, as you wish. But we just suggest these dimensions.
Plug the Battery and Close the Box
Ready to be slapped?
Plug in the battery. Watch out because the hand is working now. Glue the last box component (11-6 with hole) as seen in the picture. The sensor should be free of obstacles in order to work properly, but while adjusting be ready to get one or two slaps :)
Now you can also slide in the base component and put it up right.
Let the Work Begin
Take care of yourselves:
Your slapstick is ready to use. Start studying. And please use mindfully. You don’t want to make the slapstick angry.