Node Micro Controller Programming
We are talking about Micro Programming to detect alcohol. now let’s connect an MQ-3 Alcohol Sensor module to the NMCU board, and write programs to detect if a device needs to be activated. Here’s the way to put one together to be used with a light-weight bulb and an alarm buzzer.no. A program like this works on devices that are used to find out if someone has consumed alcohol.
Connecting devices for micro programming
You will need a NODMCU board, a breadboard, a jumper wire and an MQ3 alcohol sensor module use in Micro Programming. now as well as two red and other, coloured LED bulbs and a buzzer, and three resistors of 220 ohms.
- First, the four pins on the MQ3 sensor module must be connected horizontally on the dashboard. Now connect a jumper wire to its AO and connect it to the AO pin on the NODMCU board.
- Then connect another jumper wire to the VCC pin and connect it to the 3V pin on the NMCU board.
- After connecting a jumper wire to the GND pin and connect the other end to a row of single or serial holes marked with a negative mark near the outer edge of the braiding board. Then connect a jumper wire to another hole in the same series of holes and connect the other end to the GND pin on the NODMCU board.
Micro Programming circuit board
- Then connect the two LED bulbs to the braiding board. In this case, the braiding board should be placed horizontally and the negative ends of the two bulbs should be connected to the same side. At that point interface one finish of the resistor to the negative terminals and associate the opposite finish of the resistor to a column of openings in the line set apart with a negative imprint close to the external edge of the board.
- In Micro Programming, Once the bulbs are connected, the positive terminals should be connected as well. This should be done as if each bulb had a separate output from the NMCU board for the positive terminal. First, the positive terminal of the red bulb should be connected to the GPIO16 pin on the NOMCU board with the help of a jumper cable. Then the positive terminal of the other coloured bulb should be connected to a pin such as GPIO5.
- also, Next, the buzzer must be connected to the dashboard. Interface one finish of the resistor to the negative terminal. now along these lines, the opposite finish of the resistor to a progression of sequential openings set apart with a negative blemish on the board.
- Then connect a jumper wire to the positive terminal of the buzzer and connect the opposite end to a pin-like GPIO4.
After, configuring the Micro Programming circuit in this way, the NMCU board should be connected to the computer via the USB port. Then open the Arduino program on your computer, go through File –> New and open a new project window. Now the following code should be typed there. The parts shown in blue here should be written as single lines.
After writing the code, click on the upload button in the project window and upload the code to the NMCU board. The program will then be activated.
Now when a cloth soaked in an alcohol-based sanitizer solution or eau de cologne is brought near the module. then the output obtained through the AO pin is received as an input to the NODMCU board. According to the output received through this, the red bulb lights up and therefore the buzzer sounds. In the absence of such alcohol vapour, the other coloured bulb is lit.
It works according to the rules used in Micro Programming languages. You need to have an understanding of this code to modify the code shown here or to rewrite the code as you wish.
- In the first two lines, two variables named RedLed and GreenLed are set to 16 and 5, respectively. The variable is used to identify the PIN numbers associated with the LED bulb. Inline 3, a variable named Buzzer is set up and the value 4 is added to it. It is used to identify the PIN number associated with the buzzer. Inline 4 here we have set up a variable called Apin and entered the AO number of the pin that gets the analogue input. It is used to detect the input of the MQ3 sensor.
- Line 6 starts the main code section called Void setup. This is the primary part of the program to be executed. The variable outputs are RedLed, GreenLed, and Buzzer. Also, the Apin variable is named as an input pin.
Micro Programming Resister
- The Void Loop code starts with line 11 in this code. It is the part of the code that runs until power is supplied to the microcontroller. Line 13 below shows the input value received by the sensor to the variable.
- Line 14 checks if the value in the value variable is greater than 785. (If this is a 785 value, the value of the sensor must be adjusted to suit the functionality.) Then, online 16, RedLed, HIGH, directs the HIGH signal to the LED bulb connected to the pin named RedLed. That red bulb lights up through it. The other bulb is switched off inline 17 and the buzzer is sounded inline 18.
- The else part inline 20 is activated when the condition of the if inline 14 is invalid. Then the red LED bulb inline 22 is turned off. The green bulb inline 23 is turned off and the buzzer inline 24 is turned off.