Tuesday, June 18, 2024

Smart GSM Based Anti Drunk Car Alert System

Accidents due to drunk driving are a common occurrence in metropolitan cities. Albeit helpful, constructing checkpoints at different locations is a cumbersome job and takes a lot of timing, as does stopping and checking every potential drunk driver. To combat this we have decided to create an automated anti-drunk system that checks if a driver is operating his/her vehicle under the influence.

The MQ 3 sensor discerns the alcohol content. The digital pin out of the module is connected to Arduino pin 11. The Sil800l module is used to inform the RTO and Police checkpoints regarding the driver’s drunken state. The SIM 800l communicates with Arduino over a serial peripheral. 

Let us begin by shopping for all the material required for the project.

Bill Of Material


Open your Arduino IDE and then go to sketch->library manager and search for MQunifiedsensor, and Fona library and install that.

- Advertisement -

Now we create a code for the project. First of all, we have to initialize the FONA and MQ sensor, and software serial library in code. Then we declare the pins for RX and TX for software serial communication with SIM800L. (Refer Fig 1 ).

Next, in setup function, we set the baud rate of software serial for SIM800l. Here we have used 4800 which is the default baud rate of SIM800L module. Next, we have set the Pinmode 13 as output for relay switching and 11 is input to set the sensor digital read. (Refer fig 2).

After that, we have created a loop function that runs constantly. In this loop function, we check the reading of the Mq sensor and using the ‘if’ condition the sensor checks to see whether the driver has consumed any alcohol or not. If it concludes that alcohol has been consumed, then it sets the output of Pin no 13 as high, which makes the relay turn off the ignition of the car. At the same time, SIM800l sends a message to set numbers informing them that the driver is trying to drive the car after consumption of alcohol. (Refer Fig 4).

- Advertisement -
Fig 1
Fig 2.
Fig 3

Now select the right port and board and upload the code. Connect the components according to circuit diagram. (Refer Fig 4.)


Fig 4. Circuit diagram created in fritzing


Now to test this, insert a 2G capable SIM in SIM800l and power the Arduino. Wait a few seconds so that the sim gets registered to its operator provider. When it is ready the red LED on SIM 800l will start blinking slowly. Now put any type of alcohol near the sensor. When it detects the alcohol it will turn off the relay and also send a message to the set numbers.

 Download Source Folder: click here


Ashwini Sinha
Ashwini Sinha
A tech journalist at EFY, with hands-on expertise in electronics DIY. He has an extraordinary passion for AI, IoT, and electronics. Holder of two design records and two times winner of US-China Makers Award.


Unique DIY Projects

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components