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.
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).
Now select the right port and board and upload the code. Connect the components according to circuit diagram. (Refer Fig 4.)
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