Gas Sensor (MQ-9) :
MQ-9 Gas Sensor is one kind of semiconductor which has very lower conductivity in open air. But in Carbon Monoxide, Methane and LPG gas it has good conductivity. By using ADC of pic microcontroller we can measure it. Let's take a look on MQ-9 sensor .
Datasheet of MQ-9
Basic Concepts :
The MQ-9 sensor will be connected with a pic microcntroller and a buzzer will also be connected with microcontroller. When LPG gas will be detected in sensor, it will provide voltage into microcontroller's RA1 pin(ADC). It will provide reading more than 590. At this situation microcontroller will turn on the buzzer and LED. That's the basic concept.
Basically ADC works like as a voltage divider. According to voltage It produce output.
bit 5 : VCFG0: Voltage Reference Configuration bit (VREF- source)
1 = VREF- (AN2)
0 = VSS or 0 volt
bit 4 :VCFG0: Voltage Reference Configuration bit (VREF+ source)
1 = VREF+ (AN3)
0 = VDD or 5volt
We will set VCFG0[bit 5]=0and VCFG0[bit4]=0. So we will get highest value 5volt[1023] and lowest value 0volt[0].The ADCON1 is a 10 bit register that means 2 to the power 10 is it's highest counting capacity and result is 1024. So this register can count from 0 to 1023. When 0 volt, we get reading at RA1 pin 0. When 5 volt, we get reading at RA1 pin 1023. It means 5volt equivalent to 1023 .
If 5 volt equal reading 1023 .
So 1 volt equal reading 1023/5
[When LPG Gas detect MQ-9 Sensor provide more than 2.93 volt at AO Pin]
So 3 volt equal reading (1023/5)*2.93 =599 When we get reading 599 at ADC channel, we understand that sensor detects LPG. So it makes PORTB.F6 pin high and Buzzer turns on .
ADC(Analog to Digital Converter ) :
We need a basic knowledge about ADC. Let's take a look at here :![]() |
ADCON1 Register |
Basically ADC works like as a voltage divider. According to voltage It produce output.
bit 5 : VCFG0: Voltage Reference Configuration bit (VREF- source)
1 = VREF- (AN2)
0 = VSS or 0 volt
bit 4 :VCFG0: Voltage Reference Configuration bit (VREF+ source)
1 = VREF+ (AN3)
0 = VDD or 5volt
We will set VCFG0[bit 5]=0and VCFG0[bit4]=0. So we will get highest value 5volt[1023] and lowest value 0volt[0].The ADCON1 is a 10 bit register that means 2 to the power 10 is it's highest counting capacity and result is 1024. So this register can count from 0 to 1023. When 0 volt, we get reading at RA1 pin 0. When 5 volt, we get reading at RA1 pin 1023. It means 5volt equivalent to 1023 .
If 5 volt equal reading 1023 .
So 1 volt equal reading 1023/5
[When LPG Gas detect MQ-9 Sensor provide more than 2.93 volt at AO Pin]
So 3 volt equal reading (1023/5)*2.93 =599 When we get reading 599 at ADC channel, we understand that sensor detects LPG. So it makes PORTB.F6 pin high and Buzzer turns on .
MikroC Source Code :
double source=0;
char txt[15];
void main() {
ADCON1=0x0D; // Configure RA1 pin as input
CMCON=7;
TRISB.F6=0;
ADC_Init();
while(1){
source=Adc_Read(1);
PORTB.F6=0;
if(source>600){
delay_ms(500);
PORTB.F6=1;
}
}
}
ভাল লাগলো
ReplyDeleteThank you sir. My comment option hasn't been working for a long time. Suddenly I've found it working and I'm making reply, sir.
DeleteCan you plz mail me the programme used in this programme?
ReplyDeleteMy mail id is stephenzion96@gmail.com
I have uploaded all I have got. Thank you.
DeleteSir i use pic16f877a and it has a lot unusual errors...Do pic18 family has same issue ?
ReplyDeleteAlthough It's a late reply. But you know I have to response. If your aim is to make project for university exam then use same MCU same circuit as I had done. Thank you.
DeleteI tried to simulate the circuit with the given program in software with mq-9 sensor(I added the sensor in the library) but its not working... I made the hex file burned it in the chip but its not simulating. Any idea where i go wrong?
ReplyDeleteit was supposed to work. While I tried It took some times to work as far as I remember.
Deletewhat is mean double source=0;
ReplyDeleteI initialized a variable double type that's it.
DeleteThis comment has been removed by a blog administrator.
ReplyDeletecan i get the whole code ?
ReplyDeleteI think I have given download link now. Thank you.
Delete
ReplyDeleteThe link is broken. Please upload your new one?
Mail: keremarcaa@gmail.com
Link was updated.
DeleteThat's very good try, reach the best gas company which is located near you to buy quality gas leak detector.
ReplyDeleteHa ha. Yeah Thank you!
DeleteThere is no other completing that will hold up to the higher temperatures of a gas stove as effectively as the porcelain will. Best auto ignition gas stove
ReplyDeleteActually I have not that much idea. Thank you.
DeleteAround the 1930's, the gas stoves the coal and wood stoves two to one. 3 burner gas stove with glass top
ReplyDeleteAlright! Thank you.
DeleteI would like to thank you for the efforts you have made in writing this article. as we provide best lpg prices UK at affordable prices. for more info visit our website.
ReplyDeleteThe two dining establishments beneath the bridge are Snoopy’s and Doc’s. Snoopy’s seems to be the much more remarkably regarded, but we do not comprehend why. Snoopys is just a fried fish-shack. You order at the counter and select up your unique meals served on paper plates. It is money only, and it has no bar just beer. Doc’s has waiters, real plates, and a complete bar. They each have terrific sunset views about the lagoon, but neither appeared to have air-conditioning. Flow Meter LC
ReplyDeleteI got what you mean , a debt of gratitude is in order for posting .Woh I am cheerful to discover this site through google.
ReplyDeleteHosting Companies
Get at all your favourite prodcts at one go. Check the prices and discounts. Grab the best deals and discounts at Flipkart SBI Offer Amazon Cashback Offers 2020Top & Best Gas Stoves in India 2021Flipkart HDFC Offer Indian Hot Deals
ReplyDeleteHow to Register a Seller Account on Amazon
ReplyDeleteHow to Increase Sales on Flipkart
How to Sale Product on Flipkart in 2020
Best Auto Ignition Gas Stove in India
ReplyDeleteBest Mixer Grinder Price List
Best Induction Stove Price List
Full Body Massager Machine Price in India 2020
Best Smart Bulb Alexa in India 2020
Best Selfie Stick for Iphone and Android india
Best Washer Dryer in India
That'sthe rationale advertising and marketing for you to proper studying before writing. Also, it is attainable to write down superior writing because of this. LESCO Online Bill
ReplyDeleteThat is a very good project idea,I am going to recreate this.
ReplyDeletehttps://www.smartgasdetection.com/
The main piece of a gas home purchasers report is Wellbeing, you need to be certain that whenever you have moved into your new property you are protected. www.besteenergieleverancier.com/
ReplyDelete