Shubham Shinganapure
Published © CC BY-NC-SA

Anti-Sleep Glasses

Sleeping on wheels is dangerous sometimes it may converts into fettle accidents. these glasses will alert you when you feeling drowsiness.

BeginnerProtip2 hours51,900
Anti-Sleep Glasses

Things used in this project

Hardware components

Arduino Pro Mini 328 - 5V/16MHz
SparkFun Arduino Pro Mini 328 - 5V/16MHz
×1
Buzzer
Buzzer
×1
Battery, 3.7 V
Battery, 3.7 V
×1
Solar Cockroach Vibrating Disc Motor
Brown Dog Gadgets Solar Cockroach Vibrating Disc Motor
×1
General Purpose Transistor NPN
General Purpose Transistor NPN
×1
Resistor 4.75k ohm
Resistor 4.75k ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Code snippet #1

Plain text
<p>int Sinput = A1;    // creating or assigning an int type variable for sensor input signal<br>int Buz=3;            // creating or assigning an int type variable for output buzz and vibrator</p><p>void setup()      /// in void setup we make the selected pins output or input.
{
  
</p><p>pinMode(Sinput, INPUT);  /// here it is sensors pin  so we are defining here that this pin is input pin 
pinMode(Buz, OUTPUT); /// here it is the pin used for transistor to control it,   so we are defining here that this pin is output pin</p><p>}
void loop()  
{
 
   
    if(digitalRead(Sinput)==LOW)
     {
       delay (2000);    // we are waiting for two second after the input pulse from the sensor. if the pulse is for more than  2 second then buzzer get triggered
  
       digitalWrite(Buz, HIGH);
     }
     else
      {
   
        if(digitalRead(Sinput)== HIGH)
            {
              
               digitalWrite(Buz, LOW);
           }
 
      }
   }</p>

Credits

Shubham Shinganapure

Shubham Shinganapure

19 projects • 126 followers
I am an Electronics Engineer and hobbyist. Love to work with Machines.

Comments