Surilli
Published © GPL3+

Integration of Surilli Basic M0 with MQ2 Sensor and 16x2 LCD

Visualize the changing analog values of the MQ2 Smoke Sensor on 16x2 LCD using your Surilli Basic M0.

BeginnerFull instructions provided15 minutes701
Integration of Surilli Basic M0 with MQ2 Sensor and 16x2 LCD

Things used in this project

Hardware components

Surilli Basic
Surilli Basic
×1
Jumper wires (generic)
Jumper wires (generic)
×1
MQ2 Sensor
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Surilli Basic M0 with MQ2 Smoke Sensor and 16x2 LCD

Code

SurilliBasicM0_MQ2_16x2LCD

C/C++
#include <LiquidCrystal.h>

int gasPin; // GAS sensor output pin to Surilli Basic M0.

const int rs = A1, en = A2, d4 = 9, d5 = 10, d6 = 11, d7 = 6;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup()

{
     
     lcd.begin(16, 2);
     SerialUSB.begin(115200); // Initialize serial port - 115200 bps
  
}

void loop()

{
     
     gasPin = analogRead(0);                      // Read analog input pin A0
     SerialUSB.print("Analog Value=");
     SerialUSB.println(gasPin, DEC);              // Prints the value read
     lcd.setCursor(0,0);
     lcd.print("  Analog Value ");
     lcd.setCursor(0,1);
     lcd.print("   ");
     lcd.print(gasPin,DEC);
     lcd.print("   ");
     delay(1000);                                 // Wait 1000ms for next reading
   
}

Credits

Surilli

Surilli

196 projects • 62 followers
Surilli is a premiere Internet of Things centric Technology Company aimed at providing cutting edge innovative solutions.

Comments