connect@howdiyworld.com
|

Toxic Gas Sensor

What is Needed?

Blynk Application
Gas Sensor
ADS1115 ADC
Jumpers

BLOCK DIAGRAM

Procedure

  1. Gas Sensor and ADS1115
  2. Blynk Application setup
  3. Connections
  4. Program
  5. Output

Procedure

Toxic Gas Sensor

Electrochemical sensors or cells are most commonly used in the detection of toxic gases like carbon monoxide, chlorine and nitrogen oxides. They function via electrodes signals when a gas is detected. … The sensitive film reacts with gases, triggering the device when toxic levels are present.

ADS1115

The ADS1115 is an external digital analog converter (ADC) that we can connect to a processor like Raspberry Pi to measure analog signals. Raspberry Pi doesn’t have internal ADCs that we use when we use the Raspberry Pi analog inputs.

Download Blynk app

  • Sign in and add new device (Raspberry Pi 3) in Blynk App.
  • An Authentication code will be sent to your mail
  • Check the Authentication code and replace it in the Python Code.

create a Value Display

  • Click the + Button
  • Select Value Display
  • A Value Display is created to edit it’s properties click the created Display
  • Now in the Value Display settings click the PIN Button
  • In the Select PIN pop-up, Select Virtual and V9
  • You can change the Name and output should be 0 and 1023

Connections

  • Connect Toxic Gas Sensor’s VCC to 2nd pin.
  • Connect Toxic Gas Sensor’s GND to 9th pin.
  • Connect ADS1115’s VCC to 1st pin.
  • Connect ADS1115’s GND to 6th pin.
  • Connect ADS1115’s SCL to 5th pin.
  • Connect ADS1115’s SDA to 3rd pin.
  • Connect ADS1115’s A0 to Toxic Gas Sensor’s AOUT or A0.

Program

from gpiozero import LED, Button, Buzzer

import blynklib

import Adafruit_ADS1x15

import time

BLYNK_AUTH = ‘Enter_Your_AUTH_Code’

adc = Adafruit_ADS1x15.ADS1115()

GAIN = 1

Initialize Blynk

blynk = blynklib.Blynk(BLYNK_AUTH)

Register Virtual Pins

@blynk.handle_event(‘read V22’)

def my_write_handler(value):

print(‘Current V1 value: {}’.format(value[0]))

if int(format(value[0])) == 1:

led8.on()

else:

led8.off()

def my_user_task():

toxic = adc.read_adc(2, gain=GAIN)

toxic=toxic/500

print(toxic)

blynk.virtual_write(9, ‘{:.2f}’.format(toxic))

time.sleep(2)

try:

while True:

blynk.run()

my_user_task()

except KeyboardInterrupt:

sys.exit(0)

Output

The Toxic level will be updated on your mobile application (Output Visible in Mobile VIA Application)

Social media & sharing icons powered by UltimatelySocial
Facebook
Twitter
YouTube
LinkedIn
Instagram