# SunGlass-BOT || Automatic SunGlass Robot.

4,146

17

4

## Introduction: SunGlass-BOT || Automatic SunGlass Robot.

A Sun Glass that automatically detects light intensity and closes or opens it's black glass.

So from now on you don't need to worry about eyes, this Glass is here to automatically protect your eyes.and also Opens the glass for ease of viewing at low light.

This robot is made using Arduino and some basic parts. Sounds cool,isn't it?

Update August2018: This robot has been Featured as TOP PROJECT on HackSpace Magazine #issue9 https://hackspace.raspberrypi.org/issues/9

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Parts

1. 1x arduino pro mini (5v 16 MHz)

2. 1x micro servo motor (any model is good but it needs to be small)

3. 1x LDR ( LIght depending resistor)

4. 1x 10k ohm resistor

and of course

5. a Sun glass

------------------------------------------------

for programming you'll need

a USB to TTl converter or Arduino UNO.

## Step 2: Principle

We'll make a voltage divider circuit and connect it with arduino. Now we know that LDR is a variable resistor and it's resistance value changes according to light intensity. So as our Resistor is 10k our value will be in between 0 to 1023 . If there is bright or a medium sun light the value will be less than 100. In room light the value will be something around 500 to 600. If too dark the amount will be 1023. You got it, right? now let's proceed.

## Step 3: The Circuit

The circuit is simple enough to build. I've tested it on bread board. Then soldered it on arduino pro mini. make room for the LDR as it will have to detect the light.

## Step 4: Programming the Arduino Pro Mini

As you can see we don't have a USB programming option on pro mini. Use a USB to TTL converter or use an ARDUINO UNO. We all have an UNO right? So why waste money?

just remove the ATmega328P ic from arduino uno using a screwdriver to lift it up.

the connect the pin as following

UNO -------- Pro mini

5v---------------vcc

Gnd------------Gnd

tx----------------tx

rx----------------rx

reset----------- rst

You may watch the video to do so (language different)

That's it and then connect arduino uno usb cable and connect to your pc or android to upload the code.

also select the right processor 5v 16 MHz in our case. See picture.

//*SunGlass-Bot an automatic sunglass by ashraf minhaj.
//Contact if necessary ashraf_minhaj@yahoo.com

#include<Servo.h>
Servo sglass; //servo name
int ldr= 0;   //connect LDR to A0
int value= 0; //define value 0

void setup()
{
Serial.begin(9600); //this is not necessary-but to show value to pc
sglass.attach(9);   //declare in which pin the servo you attach
}
void loop()
{
Serial.println(value);
delay(100);
if(value<100)        //change the value as you wish
{
sglass.write(155); //black glass down (depends on how you connect servo)//
delay(100);        //a bit delay for the servo to move there
}
else
{
sglass.write(80);  //black glass up
delay(100);
}
}

Upload it and see how it works.

## Step 5: Prepare the Sun Glass

Push hard to remove the black glasses and glue them on a hard wire just like this. and then mound the servo and add a servo arm to glue it with the extra glass frame we made. You may power it up using any 5v 1A power source. I'll be using a home made power bank.

## Step 6: Done!!!!!!!!

Power up the circuit and you should see the arduino light up. Now go out and have fun with this weird looking amazing Sun Glass Robot.

Participated in the
Make it Move Contest

155 8.6K
7 1.6K
39 11K