Glasses Cleaner (Prototype)

Published

Introduction: Glasses Cleaner (Prototype)

Having glasses is a real stopper in real life. It can really hold people back. This project takes a simple button-activated Servo Motor and gives it an idea to help life today. Each time you press the button the servo makes one sweep from one side to the other. In the future I hope to make it smaller and be able to fit on glasses.

Step 1: Materials

1. Arduino Uno Board

2. USB Wire (For Computer)

3. Power Source

4. Multiple Male Wires

5. Servo Motor

6. Push Button

7. Resistor (Brown, Black, Orange/ 10K Ohms)

Step 2: Set Up

1. Plug in Power Source (Into Outlet) and USB Charger (Into Computer)

2. Plug in Male Wires from:

A. Pin9-Orange Servo Wire

B. VN-Red Servo Wire

C. GND-Brown ServoWire

D. GND- Positive Side of Breadboard

E. 3v3- Negative Side of BreadBoard

F. Negative Side of Breadboard-Anywhere on BreadBoard

G. Pin7-Back Side of Button

H. Next to Resistor- Positive Side of BreadBoard

3. Button- Put with one leg next to F

4. Resistor- Next to H

Step 3: Code

#include
int ButtonState = 0; // sets up variable for if button is pressed or not int ButtonPin = 7; //sets up what pin button is plugged into

Servo myservo; // create servo object to control a servo // twelve servo objects can be created on most boards

int pos = 0; // variable to store the servo position

void setup() {

myservo.attach(9); // attaches the servo on pin 9 to the servo object

Serial.begin(9600);// reads button }

void loop() {
ButtonState = digitalRead(ButtonPin);

Serial.println(ButtonState); // prints button on serial moniter

if (ButtonState == 1)// if button is pressed {

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(15); // waits 15ms for the servo to reach the position

}

for (pos = 180; pos >= 0; pos -= 5) { // goes from 180 degrees to 0 degrees

myservo.write(pos); // tell servo to go to position in variable 'pos'

delay(15); } // waits 15ms for the servo to reach the position }

Share

    Recommendations

    • Casting Contest

      Casting Contest
    • Oil Contest

      Oil Contest
    • Planter Challenge

      Planter Challenge
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    2 Comments

    Thanks