• Tidak ada hasil yang ditemukan

Perancangan Alat Ukur Kualitas Udara Berbasis Arduino Mini Menggunakan Sensor MQ-135

N/A
N/A
Protected

Academic year: 2017

Membagikan "Perancangan Alat Ukur Kualitas Udara Berbasis Arduino Mini Menggunakan Sensor MQ-135"

Copied!
10
0
0

Teks penuh

(1)
(2)

#include "arduino.h"

#include <LiquidCrystal.h> #include <sstream>

#include <string> #include <iostream>

using namespace std;

float concentration(float x) { const float A[] = {

result = A[0]*x+A[1]*B[0]+A[2]*B[1]+A[3]*B[2]+A[4]*B[3]; return result;

(3)

char messages[5][16] = {

"Heating sensor", "64 seconds", "Autozero", "Ready!", "ppm"};

int L; float x; float x0[5]; float x_initial;

LiquidCrystal lcd(12, 11,10, 9, 8,7,6); // Wiring microcontroller - LCD:

//const int pushbutton = 8; // Pushbutton (normally open). Stops initial heating time when it is pressed. .

const int analogPin = A0; // Reads sensor voltage as a float int the interval (0-1) corresponding to (0 - 3.3V).

float sensor_value_AnalogIn = 7; // Analog output to a multimeter or datalogger (1V = 1000 ppm).

void text_screen( char messages[], int colum, int row) { lcd.setCursor( colum, row);

(4)

void setup() { lcd.begin(16,2); Serial.begin(9600); lcd.clear();

text_screen(messages[0], 0, 0); text_screen(messages[1], 0, 1); delay(2000);

for (int j = 0; j<4; j++) {

lcd.clear(); // Heating sensor 4x16 = 64 seconds text_screen(messages[0], 0, 0);

/* for (int i = 0; i<16; i++){

if (pushbutton == 1){ // Pressing pushbutton stops initial heating and enters in measuring mode.

break; }

(5)

delay(1000); }*/

}

lcd.clear();

text_screen(messages[2], 0, 0); delay(1000);

float sensor_value_AnalogIn = 7; // Analog output to a multimeter or datalogger (1V = 1000 ppm).

for (int i=0; i<5; i++) {

x0[i]= analogRead(analogPin);

delay(2000);

}

(6)

lcd.clear();

text_screen(messages[3], 0, 0); delay(2000);

}

void loop() {

x = analogRead(analogPin); Serial.println(x);

x = (x-x_initial)*3.3; // Calculate real voltage. float sensor_value_AnalogIn = x/1000;

if(x<0) x = 0;

x = concentration(x);

delayMicroseconds(100);

(7)

char buffer[10];

dtostrf(x, 10, 3, buffer);

lcd.clear();

for (int i=0; i<strlen(buffer); i+=1) {

lcd.setCursor(i,0); lcd.write(buffer[i]);

}

text_screen(messages[4], 10, 0);

}

delay(2000); }

(8)
(9)
(10)

Referensi

Dokumen terkait

Hemiselulosa adalah struktur karbohidrat kompleks yang terdiri dari.. polimer yang berbeda seperti pentosa (seperti xilosa

Uji validitas dilakukan pada 30 responden warga yang bekerja sebagai pemulung di Dusun Ngronggo RT 1 dan RT 2 yang berdekatan dengan TPA Ngronggo Salatiga dengan

menggunakan Aspergillus Niger terlebih dahulu dilakukan proses delignifikasi kulit. pinang sebelum proses sakarifikasi, diperoleh data analisa FT-IR

Pengusaha emping melinjo tersebut masih tetap bisa berproduksi sampai sekarang walaupun harga bahan baku yang relatif tinggi karena pengusaha memiliki strategi

berada di dalam lingkungan yang memiliki status sanitasi. cukup dengan presentase 90% dan 3 balita berada

Dengan demikian hipotesis 1 yang menyatakan bahwa Entrepreneurship Education memiliki pengaruh terhadap Entrepreneurial Intention diterima , berarti pendidikan

Penelitian lain oleh Lestari, Septiwi dan Ningiswati (2014) tentang pengaruh KMC terhadap stabilitas suhu tubuh BBLR di ruang Peristi RSUD Kebumen menunjukkan

Faktor yang mempengaruhi efisiensi yang kedua adalah daya output, seperti yang sudah dijelaskan diatas bahwa daya ouput juga merupakan unjuk kerja yang dihasilkan oleh model