SunGlass-BOT || Automatic SunGlass Robot.




Introduction: SunGlass-BOT || Automatic SunGlass Robot.

About: A Computer Science and Engineering student and a Hobbyist. love to make robots,electric devices,diy things and Programming them by Myself. My youtube channel Follow me on gi…

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

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.

I'll upload code Using UNO.

Buy electronic components at

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





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.

before uploading go to tools>board type> select arduino pro mini

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

Then upload the code

Code link

//*SunGlass-Bot an automatic sunglass by ashraf minhaj.
//full tutorial on youtube:
//Contact if necessary

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()
  value = analogRead(ldr);  //read value-analog from A0
  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
    sglass.write(80);  //black glass up

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.

Make it Move Contest

Participated in the
Make it Move Contest

Be the First to Share


    • Cold Challenge

      Cold Challenge
    • Block Code Contest

      Block Code Contest
    • Clocks Contest

      Clocks Contest



    Tip 4 years ago

    I would add a headlamp, mp3 player, and phone.

    Ashraf Minhaj
    Ashraf Minhaj

    Reply 4 years ago

    Thorondor95 Thanks and i will definitely try this on next version. But i'm afraid arduino pro mini may run out of processing memory if i try #TMRpcm (audio play),#GSM (to make call) #ServoTimer2 (servo run) all together. But i'll definitely try.


    4 years ago

    Please upload the code
    Please upload it by Tomorrow