Drowsiness Alerting Device

by Shoeb ALI in Circuits > Microcontrollers

545 Views, 0 Favorites, 0 Comments

Drowsiness Alerting Device

IMG_20210802_153958.jpg
attiny85.jpg
eye-blink-sensor-1-550x550.jpg
buzzer.jpg
led.jpg
battery.jpg
7805.jpg
capacitors random.jpg
switch.jpg
wires.jpg
zero pcb.jpg

Hi friends

As you know drowsiness is a major problem when we drive any vehicle.

Most of the accedent occurs due to this especially in india.

Thats why we have made this project for alerting the driver from the drowsiness and prevent it to accedent.

In this device we have use an attiny85 microcontroller because it is very small in size as compare to arduino nano or other arduino boards.

I have set the delay time to 2 seconds but you can change it according to your choice in the program.

Supplies

For this project we need following component

HARDWARE -

1.) Attiny85 microcontroller

2.) Buzzer

3.) LED

4.) IR sensor ( eye blink sensor )

5.) capacitors 0.33uF and 0.1uF

6.) 7805 Voltage regulator IC

7.) Battery

8.) Switch

9.) Zero PCB

10.) Few wires

TOOLS -

1.) Soldering iron

2.) Solder material

SOFTWARE -

Arduino IDE

Circuit Connection

Screenshot_2021-08-02-17-28-01-92.png
1.) Make circuit according to the circuit diagram
2.) Don't connect attiny85 IC permanently use
8-pin socket to connect it on PCB
3.) Mount the IR sensor to the spectacles

Assembling

ASAPD attiny85.jpg
1.) Now stick the PCB & battery on the spectacle
2.) And mount the IR sensor

Programming

Programming ATtiny85 with Arduino Uno_bb.png

1.) For attiny85 IC board manager setup and bootloading the IC you can watch the steps on my video

https://youtu.be/J7G11H0divM

Or you can also follow the steps from this link

https://create.arduino.cc/projecthub/arjun/program...

2.) Now make the connection according to this circuit diagram

3.) Before uploading the code you have to upload Arduino ISP example code in your Arduino board.

4.) From tools Select attiny85 from the board then select clock speed to 8Mhz and then select programmer as ISP.

5.) Now upload the main program to the attiny85 IC through the Arduino board.

copy this code

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

/*CODE IS WRITTEN BY - SHOEB ALI (CRAZYTRONICS)
THIS CODE IS FOR THE ATTINY85 BASED ANTI SLEEP ACCIDENT PREVENTION DEVICE ASAPD

IN THIS PROJECT WE ARE USING ATTINY85 IC INSTEAD OF ARDUINO MICROCONTROLLER . THIS DEVICE CONSIST OF ATTINY85 IC, EYEBLINK SENSOR ,BUZZER,LED WE ARE USING 3GPIO PINS OF ATTINY85 FOR ANY ISSUE CONTACT - www.crazytronics2000@gmail.com */

#define sensor 1 // Output pin of eye blink sensor(IR sensor) is connect to D1 pin of attiny85 #define buzzer 0 // Buzzer is connect to D0 pin of attiny85 #define led 4 // LED is connect to D4 pin of attiny85

int Response_delay = 2000; // When eye will be close then after 2 seconds buzzer and LED will get turned ON int sound_sets[2] = {50, 200}; // Buzzer will generate sound that having analog values 50 and 100 int index = 0; // This variable stores the index of the above frequency sets int interval = 100; // Buzzer generate the sound of analog values 50 for 100 millisecods // and the sound of analog values 200 for 100 millisecods

void setup() { pinMode(sensor, INPUT); // declaring sensor pin as input pinMode(buzzer, OUTPUT); // declaring buzzer pin as output pinMode(led, OUTPUT); // declaring LED pin as output }

void loop() { if (digitalRead(sensor) == HIGH) // Check whether the eye is open if eye is opened then these instructions will be execute { analogWrite(buzzer, 0); // Buzzer will generate no sound digitalWrite(led, LOW); // Also LED will be off }

else // if eye is close then these instruction will get executed { delay(Response_delay); // Programme will be pause for 2 seconds because Response delay stores 2000 milliseconds if (digitalRead(sensor) == HIGH) // Again check whether the eye is open at this instance ,if it is open then these instructions will be execute { analogWrite(buzzer, 0); // buzzer will generate no sound digitalWrite(led, LOW); // Also LED will be off } else { // If eye is closed at this instance then these instructions will get execute digitalWrite(led, HIGH); // LED will be turned on while (index < 2) // Following instructions will execute till index<2 { if (digitalRead(sensor) == HIGH) // Again check whether the eye is open { // If eye is open then these instructions will get executed analogWrite(buzzer, 0); // buzzer will generate no sound digitalWrite(led, LOW); // Also LED will be off break; // If eye is open at this instance then this while loop will be break } analogWrite(buzzer,sound_sets[index]); // Buzzer will generate 1st sound having analog value 50 delay(interval); // This sound will generate for 100 milliseconds

if (digitalRead(sensor) == LOW) // Again check whether the eye is close at this instance { analogWrite(buzzer,sound_sets[index+1]); // Buzzer will generate 2nd sound having analog value 200 delay(interval); // This sound will generate for 100 milliseconds continue; // If eye is remains closed at this instance then this while loop will be start again from the top. } } } } }

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

or download it from the below

Downloads