Larissa Swift, Paul Palazuelos
Purpose
Since a solution to loneliness would be too complex to solve with a simple machine in 6 weeks, we decided to confront one of the problems lonely people often have, which is that they usually don’t have someone around to give them high fives when they need them the most.
This device is specifically aimed at university students because for most students, the people who surrounded them previously, their friends and family, were the ones who gave them praise and encouragement. When they’re first introduced to this new environment, students can struggle to find friends or study partners which can make them unmotivated.
We are looking to address this potential problem by helping students learn the important skill of self motivation through non-verbal praise.
The device uses an ultrasonic sensor to make a servo move to give someone a high five. It also uses an on/off switch so the servo can be turned off when the device isn’t in use to prevent it from burning out, and a 4 digit 7-segment display to count the number of high fives given.
Components Needed
- Slide switch
- Ultrasonic sensor
- TM1637 4 digit 7-segment display
- Mini servo
- Arduino Uno
Construction
- Arm components and base were 3-D printed
- Hand is made from foam
- Servo is attached with a stiff wire
- Housing box is made from wood
Wiring


The Code
#define trigPin 8
#define echoPin 9
#define CLK 11
#define DIO 12
#define TEST_DELAY 2000
#include <Servo.h>
#include <Arduino.h>
#include <TM1637Display.h>
TM1637Display display(CLK, DIO);
Servo myservo;
int trigger;
int numb=0;
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
trigger = 0;
myservo.attach(2);// attach your servo
myservo.writeMicroseconds(1500);
pinMode(11,INPUT);
display.setBrightness(6);
}
void loop() {
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
display.setBrightness(0x0f);
display.showNumberDec(numb,false);
if (distance <= 30 && distance > 0 && trigger == 0) {
myservo.write(100);
delay(600);
myservo.write(0);
numb++;
trigger = 1;
}
else if (distance > 30 || distance <= 0){
myservo.write(0);
Serial.println(“Out of range”);
trigger = 0;
Serial.print(distance);
}
else {
Serial.print(distance);
Serial.println(” cm”);
}
delay(500);
}
https://www.instructables.com/id/Arduino-Servo-Motors/
Articles