Saturday, June 5, 2021

GAS SENSOR | EMBEDDED SYSTEM | R2C TECHNOLOGIES

 





UNDERSTANDING A GAS SENSOR



Different Types of Gas Sensors

Different Types of Gas Sensors



gas sensor is a device which detects the presence or concentration of gases in the atmosphere. Based on the concentration of the gas the sensor produces a corresponding potential difference by changing the resistance of the material inside the sensor, which can be measured as output voltage. Based on this voltage value the type and concentration of the gas can be estimated.

MQ-6 Gas Sensor

 

The type of gas the sensor could detect depends on the sensing material present inside the sensor. These comparators can be set for a particular threshold value of gas concentration. When the concentration of the gas exceeds this threshold the digital pin goes high. The analog pin can be used to measure the concentration of the gas.

 

Different Types of Gas sensors

Gas sensors are typically classified into various types based on the type of the sensing element it is built with. Below is the classification of the various types of gas sensors based on the sensing element that are generally used in various applications:

  • Metal Oxide based gas Sensor.
  • Optical gas Sensor.
  • Electrochemical gas Sensor.
  • Capacitance-based gas Sensor.
  • Calorimetric gas Sensor.

CONSTRUCTION:


Of all the above-listed types, the most commonly used gas sensor is the Metal oxide semiconductor based gas sensor. All Gas sensors will consist of a sensing element which comprises of the following parts.

  1. Gas sensing layer
  2. Heater Coil
  3. Electrode line
  4. Tubular ceramic
  5. Electrode

The below image illustrates the parts present in a metal oxide gas sensor

 Sensing Element in Gas-Sensor

 

The purpose of each of these elements is as below:

Gas sensing layer: It is the main component in the sensor which can be used to sense the variation in the concentration of the gases and generate the change in electrical resistance. The gas sensing layer is basically a chemiresistor which changes its resistance value based on the

The concentration of particular gas in the environment. Here the sensing element is made up of a Tin Dioxide (SnO2) which is, in general, has excess electrons (donor element). So whenever toxic gases are being detected the resistance of the element changes and the current flown through it varies which represents the change in concentration of the gases.

Heater coil: The purpose of the heater coil is to burn-in the sensing element so that the sensitivity and efficiency of the sensing element increases. It is made of Nickel-Chromium which has a high melting point so that it can stay heated up without getting melted.

Electrode line: As the sensing element produces a very small current when the gas is detected it is more important to maintain the efficiency of carrying those small currents. So Platinum wires come into play where it helps in moving the electrons efficiently.

Electrode: It is a junction where the output of the sensing layer is connected to the Electrode line. So that the output current can flow to the required terminal. An electrode here is made of Gold (Au –Aurum) which is a very good conductor.

Tubular ceramic: In between the Heater coil and Gas sensing layer, the tubular ceramic exists which is made of Aluminum oxide (Al2O3). As it has high melting point, it helps in maintaining the burn-in (preheating) of the sensing layer which gives the high sensitivity for the sensing layer to get efficient output current.

Mesh over the sensing element: In order to protect the sensing elements and the setup, a metal mesh is used over it, which is also used to avoid/hold the dust particles entering into the mesh and prevent damaging the gas sensing layer from corrosive particles.

 

WORKING:


The ability of a Gas sensor to detect gases depends on the chemiresister to conduct current. The most commonly used chemiresistor is Tin Dioxide (SnO2) which is an n-type semiconductor that has free electrons (also called as donor). Normally the atmosphere will contain more oxygen than combustible gases. The oxygen particles attract the free electrons present in SnO2 which pushes them to the surface of the SnO2. As there are no free electrons available output current will be zero. The below gif shown the oxygen molecules (blue color) attracting the free electrons (black color) inside the SnO2 and preventing it from having free electrons to conduct current.

 Gas Sensor Working Principle

 

When the sensor is placed in the toxic or combustible gases environment, this reducing gas (orange color) reacts with the adsorbed oxygen particles and breaks the chemical bond between oxygen and free electrons thus releasing the free electrons. As the free electrons are back to its initial position they can now conduct current, this conduction will be proportional the amount of free electrons available in SnO2, if the gas is highly toxic more free electrons will be available.

 

How to use a Gas sensor?

A basic gas sensor has 6 terminals in which 4 terminals (A, A, B, B) acts input or output and the remaining 2 terminals (H, H) are for heating the coil. Of these 4 terminals, 2 terminals from each side can be used as either input or output (these terminals are reversible as shown in the circuit diagram) and vice versa.

 Gas Sensor Pinout

 

These sensors are normally available as modules (shown right), these modules consist of the gas sensor and a comparator IC. Now let’s see the pin description of the gas sensor module which we will generally use with an Arduino. The gas sensor module basically consists of 4 terminals

  • Vcc – Power supply
  • GND – Power supply
  • Digital output – This pin gives an output either in logical high or logical low (0 or 1) that means it displays the presence of any toxic or combustible gases near the sensor.
  • Analog output – This pin gives an output continuous in voltage which varies based on the concentration of gas that is applied to the gas sensor.

As discussed earlier the output of a gas sensor alone will be very small (in mV) so an external circuit has to be used in order to get a digital high low output from the sensor. For this purpose, a comparator (LM393), adjustable potentiometersome resistors and capacitors are used.

The purpose of LM393 is to get the output from the sensor, compare it with a reference voltage and display whether the output is logically high or not. Whereas the purpose of the potentiometer is to set the required threshold value of the gas above which the digital output pin should go high.

 

The below diagram shows the basic circuit diagram of a gas sensor in a gas sensor module

 Gas Sensor Module Circuit Diagram

 

Here A and B are the input and output terminals (these are reversible - means any of the paired terminals can be used as input or output) and H is the Heater coil terminal. The purpose of the variable resistor is to adjust the output voltage and to maintain high sensitivity.

If no input voltage is applied to the heater coil, then the output current will be very less (which is negligible or approximately 0). When sufficient voltage is applied to the input terminal and heater coil, the sensing layer wakes up and is ready to sense any combustible gases nearby it. Initially let’s assume that there is no toxic gas near the sensor, so the resistance of the layer doesn’t change and the output current and voltage are also unchanged and are negligible (approximately 0).

Now let’s assume that there is some toxic gas nearby. As the heater coil is pre-heated it is now easy to detect any combustible gases. When the sensing layer interacts with the gases, the resistance of the material varies and the current flowing through the circuit also varies. This change in variation can be then observed at the load resistance (RL).

The value of load resistance (RL) can be anywhere from 10KΩ to 47KΩ. The exact value of the load resistance can be selected by calibrating with the known concentration of the gas. If low load resistance is selected then the circuit has less sensitivity and if high load resistance is selected then the circuit has high sensitivity.

 


List of Gas Sensors and What Gases They Sense

Sensor Name

Gas to measure

MQ-2

Methane, Butane, LPG, Smoke

MQ-3

Alcohol, Ethanol, Smoke

MQ-4

Methane, CNG Gas

MQ-5

Natural gas, LPG

MQ-6

LPG, butane

MQ-7

Carbon Monoxide

MQ-8

Hydrogen Gas

MQ-9

Carbon Monoxide, flammable gasses

MQ131

Ozone

MQ135

Air Quality

MQ136

Hydrogen Sulphide gas

MQ137

Ammonia

MQ138

Benzene, Toluene, Alcohol, Propane, Formaldehyde gas, Hydrogen

MQ214

Methane, Natural Gas

MQ216

Natural gas, Coal Gas

MQ303A

Alcohol, Ethanol, smoke

MQ306A

LPG, butane

MQ307A

Carbon Monoxide

MQ309A

Carbon Monoxide, flammable gas

 

Applications of Gas Sensors

  • Used in industries to monitor the concentration of the toxic gases.
  • Used in households to detect an emergency incidents.
  • Used at oil rig locations to monitor the concentration of the gases those are released.
  • Used at hotels to avoid customers from smoking.
  • Used in air quality check at offices.
  • Used in air conditioners to monitor the CO2 levels.
  • Used in detecting fire.
  • Used to check concentration of gases in mines.
  • Breath analyzer.





















IF ELSE STATEMENT | C PROGRAMMING | R2C TECHNOLOGIES


IF ELSE STATEMENT



In this tutorial we  are going to see how if else statement work and how to perform a simple EB billing  program using if else statement…..

*   We are using stdio.h in a program to get standard input and output of the program.

*   We are using units and c as a variable and in print statement we are giving enter the no of units and in scanf we are giving  %d to declare a variable here.

*   And in if statement  now we are giving a condition units>100 the following statement are printed and in c we are delaring c=units*5

*   In print statement we are using %d to declare the integer value of c.

*   If the condition is false the else condition will run to get the output.

*   Here we are using c=units*3 . In print statement we are using %d to declare the integer value of c.

*   We are using return 0 to declare the program is end.

PROGRAM:

include <stdio.h>

int main()

{

    int units,c;

    printf("Enter the no.of.units : ");

    scanf("%d",&units);

    if(units>100)

    {

        c=units*5;

        printf("The bill amount is :%d\n",c);

    }

    else

    {

        c=units*3;

        printf("The bill amount is :%d\n",c);

    }

    return 0;

}

OUTPUT

Enter no.of units:103

The bill amount is:515





Thursday, June 3, 2021

STOCK MARKET|C PROGRAMMING|R2C TEHNOLOGIES

 


SIMPLE STOCK MARKET CHECKING PROGRAM

In this tutorial we are going to see how to do a simple stock checking program. Let us see how the program works….

*    We are using stdio.h to get the standard input and output of the program. I declare stock=150 as a constant here and as a variable we are using sales, today, shampoo and soap.

 

*    In the print statement we are using enter no of shampoos as a string and using scanf we are giving input for the shampoos. As same as shampoos we are doing same things for soap.

 

*    Next at sales we are declaring that sales= shampoo + soap and we are declaring  toady=stock-sales and in the next print statement we are giving the string enter the sales we are giving  %d to declare the  integer and the integer value will be taken from the sales.

 

*    At last the amount will be subtracted with stock to get the output. We are using return 0 to declare the program is end.

Try it out for yourself to learn more!!!

 

Program:

#include <stdio.h>

int main()

{

    int stock=150;

    int sales,today,shampoo,soap;

     printf("enter the no of shampoos: ");

    scanf("%d",&shampoo);

    printf("enter the no of soaps: ");

    scanf("%d",&soap);

  

     sales=shampoo+soap;

      today=stock-sales;

    printf("enter the sales :%d\n",sales);

    printf("available stock is :%d\n",today);

return 0; 

}

OUTPUT:

Enter the no of shampoo: 5

Enter the no of soap: 5

Enter the sales: 10

Available stock is: 140

 


Super Market billing in C programming|C PROGRAMMING|R2C TECHNOLOGIES



SUPER MARKET BILLING

         In this tutorial we are going to see how to do a simple super market billing program. Let us see the program…

*   We are using  <stdio.h> to get the standard input and output of the program and as a variable here we are using  item , chocolate , chocolates  , biscuit , biscuits and sum.

*   We are declaring chocolates=20 and in print statement we are giving enter the no of chocolates and now we are using scanf to give the input for the above print statement.

*   Now we are declaring chocolates = Items*chocolate to get the value for the total no of chocolates we are entering.

*   We have to follow  the same things for the biscuits also.

*   At last we are printing the bill so we print the statement super market and then next statement item  and price.

*   We are using \t  for the tab and we are using \n for new line.

*   At the sum we are adding the total values to give the bill amount.

We are using return 0 to declare 



Program:

#include <stdio.h>

int main()

{

    int item,chocolate,chocolates,biscuit,biscuits,sum;

    chocolate=20;

    printf("Enter the no of chocolates : ");

    scanf("%d",&item);

    chocolates=item*chocolate;

    biscuit=20;

    printf("Enter the no of biscuits : ");

    scanf("%d",&item);

    biscuits=item*biscuit;

    printf("Super Market\n");

    printf("Item\t\tPrice\n");

    printf("chocolates\t%d\nbiscuits\t%d\n",chocolates,biscuits);

    sum=chocolates+biscuits;

    printf("The total bill amount is : %d ",sum);

    scanf("%d",&sum);

    return 0;

}

 


Wednesday, June 2, 2021

Size of integer datatype|C PROGRAMMING |R2C TECHNOLOGIES




SIZE OF INTEGER DATATYPE

In this tutorial we are going to see how to do a size of an integer using normal C program.

We are using stdio.h to get the standard input and output of the program.

The size of is a unary operator that returns the size of data (constants, variables, array, structure, etc).

Here we are declaring variables for the integers short , long , long long ,etc….

And now in print statement we are giving a string sizeof the short or integer.

We are declaring %d to declare the sizeof integer in bytes.

We use \n to initiate new line and we are using sizeof to enter the value of the given integer.

#include <stdio.h>     

int main() {

  short a;

  long b;

  long long c;

  short int d;

  unsigned int e;

  long int f;

  long long int g;

  unsigned long int h;

  unsigned long long int i;

  signed char j;

  unsigned char k;

  long double l;

  printf("size of short = %d bytes\n", sizeof(a));

  printf("size of long = %d bytes\n", sizeof(b));

  printf("size of long long = %d bytes\n", sizeof(c));

  printf("size of short int = %d bytes\n", sizeof(d));

  printf("size of unsigned int  = %d bytes\n", sizeof(e));

  printf("size of long int = %d bytes\n", sizeof(f));

  printf("size of long long int = %d bytes\n", sizeof(g));

  printf("size of unsigned long int  = %d bytes\n", sizeof(h));

  printf("size of unsigned long long int = %d bytes\n", sizeof(i));

  printf("size of signed char = %d bytes\n", sizeof(j));

  printf("size of unsigned char = %d bytes\n", sizeof(k));

  printf("size of long double = %d bytes\n", sizeof(l));

Try it out for yourself to learn more!!!

OUTPUT:

  




   


Tuesday, June 1, 2021

Arithmetic Operations|R2C TECHNOLOGIES | C Programming



Arithmetic Operations


In this tutorial we are going to see how to perform arithmetic operations in a single program. We can even try a single arithmetic operation addition, subtraction, multiplication and division etc….

#include <stdio.h>

int main()

{

    int a = 10,b = 5, c;

    c = a+b;

    printf("a+b = %d \n",c);

    c = a-b;

    printf("a-b = %d \n",c);

    c = a*b;

    printf("a*b = %d \n",c);

    c = a/b;

    printf("a/b = %d \n",c);

    return 0;

}

Output:

a+b=15

a-b=5

a*b=50



We are using stdio.h to get the standard input and output of the program.

v As a constant we are declaring a=10, b=5 and as a variable we are declaring c.

v Now we are declaring c=a+b and in the printf we are declaring the string a+b=%d. we are declaring %d to declare a integer c .so we are using , c next to the string.

v Like above we should do the same things for the following operations. After that we are using return 0 to declare the main function’s Exit status.

Thus we got the output. Try it out of your own to learn more!!!

 

✅ *AI Model Evaluation Interview Questions & Answers* 🧠📊

✅ *AI Model Evaluation Interview Questions & Answers* 🧠📊 *1️⃣ Q: What is a confusion matrix, and how do you interpret it?*   *A:* A co...