To prevent falling asleep while driving, an electronics engineer from India offers a special device made on the basis of glasses.
Tools and materials:
-Arduino Pro Mini;
-IR sensor; -BC547 transistor; -Micro- vibrating motor for a mobile phone; -5 V buzzer; -Resistor 4.7K; -Battery 3.7 V;
-Frame for glasses;
Step one: the principle of operation
The operation of this device is based on the operation of an infrared sensor. The IR sensor module consists of an IR transmitter LED, a photodiode, an operational amplifier chip, and a potentiometer.
The photodiode is placed next to the IR LED so that it cannot receive IR rays directly .. Its cathode is connected to a positive voltage, that is, 5 volts, and the anode is connected to the non-inverting input of the operational amplifier. The potentiometer in the IR sensor is used to adjust the sensitivity of the sensor connected to the inverting input of the op amp. An IR LED continuously transmits infrared rays, and if an object enters the area where they are propagated, the IR rays are reflected back and received by the photodiode. In this case, the voltage at the anode changes.
According to the diagram, the master connected an IR sensor (Vcc) to the Arduino Pro Mini (VCC) board, GND to GND and OUT to A1 Arduino Pro Mini.
For signaling, the master used a 5-volt buzzer and a vibration motor from an old mobile phone in the device. The buzzer and vibration motor are connected in parallel through a transistor. The emitter of the transistor is connected to ground and the collector is connected to the negative terminal of the buzzer and the motor. The positive terminal of the vibration motor and buzzer is additionally connected to the VCC of the Arduino Pro Mini. The base of the transistor is connected to the D3 pin of the Arduino Pro Mini through a 4.7k resistor.
Step two: assembly
The sensor is glued to the Arduino board using hot glue. < br> Then he assembles the buzzer circuit.
The buzzer is mounted on the bow of the glasses closer to the ear. The battery is attached in the middle of the shackle. A sensor with an arduino is mounted on the frame. The distance between the eye and the sensor is no more than 15-20 mm.
Before fixing the sensor it needs to be adjusted. The sensor response distance is not more than 10 mm.
Step three: programming
Arduino pro mini does not have a USB connector for programming and the master will program it with arduino uno. From the arduino uno board, you need to dismantle the AtMEGA328P, and then connect the arduino pro mini to the uno.
The connection is as follows:
Arduino UNO — Arduino Pro Mini
Vcc ——————————– Vcc
GND – —————————– GND
Rx —————- —————– Rx
Tx —————————- —— Tx
Rst ——————————— Rst
Once connected, connects the Arduino Uno to the computer using a USB cable. Copies the Arduino code and opens it in the Arduino ide. Goes to the tools menu, selects the Arduino Pro mini board, goes back to the tools menu and selects the COM port. Then he clicks the download button.
The code is very simple, it controls the delay in the buzzer after the sensor is triggered.
& lt; p & gt; int Sinput = A1; //creating or assigning an int type variable for sensor input signal & lt; br & gt; int Buz = 3; //creating or assigning an int type variable for output buzz and vibrator & lt;/p & gt; & lt; p & gt; void setup () ///in void setup we make the selected pins output or input. & # 123; & lt;/p & gt; & lt; p & gt; 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 & lt;/p & gt; & lt; p & gt;} void loop () & # 123; if (digitalRead (Sinput) == LOW) & # 123; 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 & # 123; if (digitalRead (Sinput) == HIGH) & # 123; digitalWrite (Buz, LOW); }}} & lt;/p & gt;