How to Make an Absolutely Useless Coaster.
by AsvinR in Circuits > Arduino
2716 Views, 10 Favorites, 0 Comments
How to Make an Absolutely Useless Coaster.
INTRODUCTION
Have you ever felt the need to hurt your friends on an emotional, physical, and psychological level? Well, we have a solution for you. Introducing the world's most useless coaster! This coaster will scurry away every time you or a friend attempts to place a drink on it. It's incredibly pointless, and there isn't a single reason for you to build this device. So, if you want to waste your time for absolutely no reason, build this impotent coaster!
Supplies
SUPPLIES
1 PVC Cap
1 Ultrasonic Sensor
1 Toy Car Motor With Wheels
2 "1-inch" bearing wheels
1 Circle of Any Hard but Fairly Light Material (Ex: Acrylic, Plastic, Plywood)
1 Transistor
1 Arduino (We used an Arduino Pico)
2 9-Volt Batteries
2 9-Volt Battery Clips
Female-Male, Male-Male, and Female-Female Wires
Screws
Create the Main Base
Step 1
Cut holes into the circular material to make room your toy car motor's wheels and base. Create some space for the wheels to touch the ground as well as space for the red and black wire to go through the base.
Step 2
Take the circular material and attach the wheels and the ball bearings as seen in the photo. To do this, we used hot glue to attach them to the plastic disk. Your method may be different depending on the material and toy car motor you are using.
Create the Cap
Step 1
Cut two holes into the PVC cap to make room for the ultrasonic sensor. Make sure these holes allow the ultrasonic sensor to be placed in the middle of the coaster. We cut these holes by solely using a 1/2 inch drill bit.
Connect the Wires
Step 1
Follow this connection guide:
Ultrasonic Sensor "Trigger Pin" -> Arduino "Pin 3"
Ultrasonic Sensor "Ground Pin" -> Arduino "Pin 2"
Ultrasonic Sensor "VCC Pin" -> Arduino "VCC 3.3v"
Ultrasonic Sensor "Ground Pin" -> Arduino "Ground"
Transistor "Ground 1 Pin" -> Battery Clip "Ground"
Transistor "VCC 1 Pin" -> Battery Clip "VCC"
Transistor "Trigger Pin" -> Arduino "Pin 4"
Transistor "Ground 2 Pin -> Car Motor "Black Wire"
Transistor "VCC 2 Pin" -> Car Motor "Red Wire"
Step 2
Place the cap made in the last step on top of the base with the wheels facing down.
The Code
Step 1
Copy and paste this code to the Arduino program and upload this code to the Arduino, and your useless coaster will work!
The Code:
#include <Servo.h>
int trigPin = 3;
int echoPin = 2;
int motorTrig = 4;
String DOIMOVE;
long duration, cm, inches;
void setup() {
//Serial Port begin
Serial.begin (9600);
//Define inputs and outputs
pinMode(motorTrig, OUTPUT);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
inches = (duration/2) / 74;
if (inches < 3) {
DOIMOVE = "YES";
digitalWrite(motorTrig, HIGH);
}
else {
DOIMOVE = "NO";
digitalWrite(motorTrig, LOW);
}
runrun.write(20);
Serial.print(DOIMOVE);
Serial.print(", DO I MOVE");
Serial.print(inches);
Serial.print("in, ");
Serial.println();
delay(250);
}