Translate

Monitor Suhu Sensor PT100 ESP32 IOT BLYNK

Monitor Suhu Sensor PT100 ESP32 IOT BLYNK


          Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat mengukur suhu suatu ruangan dengan menggunakan sensor PT100 yang dilengkapi amplifier untuk pengkondisi sinyal. alat ini juga dilengkapi fitur IOT Blynk sehingga dapat memonitor device secara jarak jauh.



a. Komponen




b. Program Arduino IDE

#define BLYNK_TEMPLATE_ID "TMPL6BDtMpxxx"
#define BLYNK_TEMPLATE_NAME "SUHU"
#define BLYNK_AUTH_TOKEN "qanCOAe3V1JrtNQ4Vel5GatTWVr2Oxxx"

#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

BlynkTimer timer;
int dataadc1;
int dataadc2;
float faktor_kalibrasi = 7.0;
float voltage1;
float voltage2;
float suhu1;
float suhu2;
float mbg;
float gfast = 80;
float a;
float gref;
float tref = 0.45;
float DT, ttragus,tanti,HA,G;
 
char ssid[] = "hotspothpku";
char pass[] = "123456789";

void senddata() {
    Blynk.virtualWrite(V0, ttragus);
    Blynk.virtualWrite(V1, tanti);
    Blynk.virtualWrite(V2, G);
}

void setup() {
  Serial.begin(9600);
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
  timer.setInterval(1000L, senddata);
}

void loop() {

  dataadc1 = analogRead(34);
  dataadc2 = analogRead(35);

  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5000mV):
  voltage1 = (dataadc1 * (3.3 / 4095.0)) * 1000.0; 
  //dihitung dg arus 1 mA dan 100 ohm pada suhu 0 deg celc maka didapatkan V pada suhu 0 deg celc = 100 mV
  suhu1 = ((voltage1-100)/0.385)-faktor_kalibrasi; // 100 mV at 0 deg celc dan 0.385 mV per 1 deg celc

  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5000mV):
  voltage2 = (dataadc2 * (3.3 / 4095.0)) * 1000.0; 
  //dihitung dg arus 1 mA dan 100 ohm pada suhu 0 deg celc maka didapatkan V pada suhu 0 deg celc = 100 mV
  suhu2 = ((voltage2-100)/0.385)-faktor_kalibrasi; // 100 mV at 0 deg celc dan 0.385 mV per 1 deg celc

  ttragus = suhu1 / 100.0;
  tanti = suhu2 / 100.0;

  mbg = (33.3 * 5)-86;
  a = mbg * gfast;
  gref = sqrt(a);
  DT = ttragus - tanti;
  HA = ((tref-DT)/0.024);
  G = gref + HA;
  
  Blynk.run();
  timer.run();
}




c. VIDEO HASILNYA



Monitor Timbangan Bayi Digital IOT BLYNK ESP32 / NODEMCU ESP8266

Monitor Timbangan Bayi Digital IOT BLYNK ESP32 / NODEMCU ESP8266


      Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah timbangan digital dengan menggunakan ESP32 atau Nodemcu ESP8266 dengan fitur yaitu bisa mengukur berat dan tinggi bayi lalu mengirimkan nilainya ke aplikasi BLYNK dengan IOT untuk lebih jelasnya berikut adalah koding dan komponennya.


 
a. Komponen




b. Program ESP32 

#define BLYNK_TEMPLATE_ID "TMPL6ou3EQ9xx"
#define BLYNK_TEMPLATE_NAME "monitor timbangan bayi"
#define BLYNK_AUTH_TOKEN "vcclo04QhO5qyH0qzUQLVt3Wm7WL5xxx"

#define BLYNK_PRINT Serial    
#include <Wire.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#include "HX711.h"

// HX711.DOUT    - pin #23
// HX711.PD_SCK    - pin #19

#define trigPin 25
#define echoPin 26
#define trigPin2 12
#define echoPin2 13

HX711 scale(23, 19);  
     
BlynkTimer timer;

char ssid[] = "hotspothpku";
char pass[] = "123456789";

long duration, distance;
long duration2, distance2;
float tera = 0;
int berat;
float fix;
int x;
int jarak;
int sp = 30;
float kg;
float weight; 
float calibration_factor = 211000; // for me this vlaue works just perfect 211000  
int tinggi;
float BMI;
int statusnya;

void sendSensor()
{
 Blynk.virtualWrite(V0, weight);
 Blynk.virtualWrite(V1, tinggi);
 Blynk.virtualWrite(V2, statusnya);
 delay(1000);
}

void setup() {

  Serial.begin(9600);
  lcd.begin();
  lcd.clear();
  lcd.noCursor();
  
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
  timer.setInterval(1000L, sendSensor);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(trigPin2, OUTPUT);
  pinMode(echoPin2, INPUT);
  
   lcd.setCursor (0,0);
   lcd.print ("LOADING... ");
   delay(5000);
   lcd.clear();
   
  // Set up serial monitor
  Serial.println("HX711 calibration sketch");
  Serial.println("Remove all weight from scale");
  Serial.println("After readings begin, place known weight on scale");
  Serial.println("Press + or a to increase calibration factor");
  Serial.println("Press - or z to decrease calibration factor");
  scale.set_scale();
  scale.tare(); //Reset the scale to 0
  long zero_factor = scale.read_average(); //Get a baseline reading
  Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
  Serial.println(zero_factor);

}

void loop() 
{

  digitalWrite(trigPin, LOW);  // Added this line
  delayMicroseconds(2); // Added this line
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10); // Added this line
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;

  digitalWrite(trigPin2, LOW);  // Added this line
  delayMicroseconds(2); // Added this line
  digitalWrite(trigPin2, HIGH);
  delayMicroseconds(10); // Added this line
  digitalWrite(trigPin2, LOW);
  duration2 = pulseIn(echoPin2, HIGH);
  distance2 = (duration2/2) / 29.1;
  
  tinggi = 55 - distance - distance2; 
  BMI = weight / (tinggi * tinggi);
  
  measureweight();
  
   lcd.setCursor(0,0);
   lcd.print("W/H:");
   lcd.print(weight);
   lcd.print("/");
   lcd.print(tinggi);
   lcd.print("   ");

   lcd.setCursor(11,1);
   lcd.print(BMI); 
   
 if(BMI < 17){
   statusnya = 1;
   lcd.setCursor(0,1);
   lcd.print(" KURUS    ");  
  }

 if((BMI > 17)&&(BMI < 23)){
   statusnya = 2;
   lcd.setCursor(0,1);
   lcd.print(" NORMAL  ");  
  }  

 if((BMI > 23)&&(BMI < 30)){
  statusnya = 3;
   lcd.setCursor(0,1);
   lcd.print(" GEMUK   ");  
  }  

 if(BMI > 30){
   statusnya = 4;
   lcd.setCursor(0,1);
   lcd.print(" OBES   ");  
  }   
   
  Blynk.run();
  timer.run();
   
}


void measureweight(){
 scale.set_scale(calibration_factor); //Adjust to this calibration factor
  Serial.print("Reading: ");
  weight = scale.get_units(5); 
    if(weight<0)
  {
    weight=0.00;
    }
  //Serial.print(scale.get_units(), 2);
 // Serial.print(" lbs"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
  Serial.print("Kilogram:");
  Serial.print( weight); 
  Serial.print(" Kg");
  Serial.print(" calibration_factor: ");
  Serial.print(calibration_factor);
  Serial.println();
  // Delay before repeating measurement
  delay(100);
}




c. Program NODEMCU ESP8266

#define BLYNK_TEMPLATE_ID "TMPL6KNlz0xxx"
#define BLYNK_TEMPLATE_NAME "timbangan bayi"
#define BLYNK_AUTH_TOKEN "hdIky8QH-niNXKXhgB0xznG9PklZ4xxx"

#define BLYNK_PRINT Serial    

#include <Wire.h>                           
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#include "HX711.h"

// HX711.DOUT    - pin #D4 gpio 14
// HX711.PD_SCK    - pin #D3 gpion 12

#define trigPin D7
#define echoPin D8
//#define trigPin2 16
//#define echoPin2 2

HX711 scale(14, 12);  

  
BlynkTimer timer;

char ssid[] = "hotspothpku";
char pass[] = "123456789";

long duration, distance;
long duration2, distance2;
float tera = 0;
int berat;
float fix;
int x;
int jarak;
int sp = 30;
float kg;
float weight; 
float calibration_factor = 211000; // for me this vlaue works just perfect 211000  
int tinggi;
float BMI;
int statusnya;

void sendSensor()
{
 Blynk.virtualWrite(V0, weight);
 Blynk.virtualWrite(V1, tinggi);
 Blynk.virtualWrite(V2, statusnya);
 delay(1000);
}


void setup() {

  Serial.begin(9600);
  lcd.begin();
  lcd.clear();
  lcd.noCursor();
  
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
  timer.setInterval(1000L, sendSensor);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  //pinMode(trigPin2, OUTPUT);
  //pinMode(echoPin2, INPUT);
  
   lcd.setCursor (0,0);
   lcd.print ("LOADING... ");
   delay(5000);
   lcd.clear();
  
  // Set up serial monitor
  Serial.println("HX711 calibration sketch");
  Serial.println("Remove all weight from scale");
  Serial.println("After readings begin, place known weight on scale");
  Serial.println("Press + or a to increase calibration factor");
  Serial.println("Press - or z to decrease calibration factor");
  scale.set_scale();
  scale.tare(); //Reset the scale to 0
  long zero_factor = scale.read_average(); //Get a baseline reading
  Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
  Serial.println(zero_factor);

}


void loop() 
{

  digitalWrite(trigPin, LOW);  // Added this line
  delayMicroseconds(2); // Added this line
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10); // Added this line
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;

/*
  digitalWrite(trigPin2, LOW);  // Added this line
  delayMicroseconds(2); // Added this line
  digitalWrite(trigPin2, HIGH);
  delayMicroseconds(10); // Added this line
  digitalWrite(trigPin2, LOW);
  duration2 = pulseIn(echoPin2, HIGH);
  distance2 = (duration2/2) / 29.1;
*/
  
  tinggi = 55 - distance; 
  BMI = weight / (tinggi * tinggi);
  
  measureweight();
  
   lcd.setCursor(0,0);
   lcd.print("W/H:");
   lcd.print(weight);
   lcd.print("/");   
   lcd.print(tinggi);
   lcd.print("   ");

/*
   lcd.setCursor(0,1);
   lcd.print("T:");
   lcd.print(distance);
   lcd.print(" / ");
   lcd.print(distance2);
   lcd.print("   ");
*/
   
   lcd.setCursor(11,1);
   lcd.print(BMI); 


 if(BMI < 17){
   statusnya = 1;
   lcd.setCursor(0,1);
   lcd.print(" KURUS    ");  
  }

 if((BMI > 17)&&(BMI < 23)){
   statusnya = 2;
   lcd.setCursor(0,1);
   lcd.print(" NORMAL  ");  
  }  

 if((BMI > 23)&&(BMI < 30)){
  statusnya = 3;
   lcd.setCursor(0,1);
   lcd.print(" GEMUK   ");  
  }  

 if(BMI > 30){
   statusnya = 4;
   lcd.setCursor(0,1);
   lcd.print(" OBES   ");  
  }   

  Blynk.run();
  timer.run();
   
}


void measureweight(){
 scale.set_scale(calibration_factor); //Adjust to this calibration factor
  Serial.print("Reading: ");
  weight = scale.get_units(5); 
    if(weight<0)
  {
    weight=0.00;
    }
  //Serial.print(scale.get_units(), 2);
 // Serial.print(" lbs"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
  Serial.print("Kilogram:");
  Serial.print( weight); 
  Serial.print(" Kg");
  Serial.print(" calibration_factor: ");
  Serial.print(calibration_factor);
  Serial.println();
  // Delay before repeating measurement
  delay(100);
}




d. VIDEO HASILNYA





Timer Lomba Tamiya 3 Jalur / Line

Timer Lomba Tamiya 3 Jalur / Line


      Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang digunakan untuk timer lomba tamiya dengan spek yaitu 3 jalur mobil mini 4 wd dan juga alat ini menggunakan penampil dmd p10 dan sensor optocoupler. untuk lebih jelasnya berikut adalah komponen dan kodingnya.


a. Komponen




b. Program Arduino IDE

#include <Wire.h>
#include <SPI.h>        //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include <DMD.h>        //Library DMD yang menyediakan fungsi penampilan teks, gambar dsb
#include <TimerOne.h>   //Library peripheral Timer1 untuk menjalankan prosedur pindai panel DMD
#include <Time.h>     //Library waktu yang menyediakan tipe data, struktur, dan obyek waktu
#include "Arial_black_16.h"
#include "Arial_Black_16_ISO_8859_1.h"
#include "Arial14.h"
#include "DejaVuSans9.h"
#include "Droid_Sans_12.h"
#include "Droid_Sans_16.h"
#include "DejaVuSansItalic9.h"
#include "Mono5x7.h"
#include "SystemFont5x7.h"

#define WAKTU_TAMPIL_JAM      10    //detik
#define WAKTU_TAMPIL_KALENDAR 5     //detik

#define DISPLAY_COLUMN_COUNT  2
#define DISPLAY_ROW_COUNT     1

#define PIXELS_PER_COLUMN  32
#define PIXELS_PER_ROW    16

DMD dmd(DISPLAY_COLUMN_COUNT, DISPLAY_ROW_COUNT);
unsigned char show = 0;

char lineBuff[20];
char lineBuff2[20];

int lineA;
int lineB;
int lineC;
int mulai;
int seconds;
int cs;
long start_time = 0;
int lapa,lapb,lapc;

void ScanDMD()
{
  dmd.scanDisplayBySPI();
}


void setup(void)
{
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,INPUT);
  dmd.clearScreen( true );   //true is normal (all pixels off), false is negative (all pixels on)
  Serial.begin(9600);
   //initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
  Timer1.initialize( 1000 );           //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
  Timer1.attachInterrupt( ScanDMD );   //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI() 
  //clear/init the DMD pixels held in RAM
  dmd.clearScreen( true );
}


void loop(void)
{

//============================================
lineA = digitalRead(2);
lineB = digitalRead(3);
lineC = digitalRead(4);

if((lineA == 0)&&(lineB == 1)&&(lineC == 1)&&(mulai == 1)){
lapa++;
delay(100);
}

if((lineA == 1)&&(lineB == 0)&&(lineC == 1)&&(mulai == 1)){
lapb++;
delay(100);
}

if((lineA == 1)&&(lineB == 1)&&(lineC == 0)&&(mulai == 1)){
lapc++;
delay(100);
}

if((lineA == 0)&&(lineB == 0)&&(lineC == 1)&&(mulai == 1)){
lapa++;
lapb++;
delay(100);
}

if((lineA == 0)&&(lineB == 1)&&(lineC == 0)&&(mulai == 1)){
lapa++;
lapc++;
delay(100);
}

if((lineA == 1)&&(lineB == 0)&&(lineC == 0)&&(mulai == 1)){
lapb++;
lapc++;
delay(100);
}

if((lineA == 0)&&(lineB == 0)&&(lineC == 0)&&(mulai == 1)){
lapa++;
lapb++;
lapc++;
delay(100);
}

//=============================================
if(lapa > 2){
dmd.clearScreen( true );   
sprintf(lineBuff2, "WIN", lapa, lapb, lapc);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 3,  3, lineBuff2, strlen(lineBuff2), GRAPHICS_NORMAL);  
delay(2000);
dmd.clearScreen( true );  
hasila();  
}

if(lapb > 2){
dmd.clearScreen( true );   
sprintf(lineBuff2, "WIN", lapa, lapb, lapc);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 3,  3, lineBuff2, strlen(lineBuff2), GRAPHICS_NORMAL);  
delay(2000);
dmd.clearScreen( true );  
hasilb();  
}

if(lapc > 2){
dmd.clearScreen( true );   
sprintf(lineBuff2, "WIN", lapa, lapb, lapc);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 3,  3, lineBuff2, strlen(lineBuff2), GRAPHICS_NORMAL);  
delay(2000);
dmd.clearScreen( true );  
hasilc();  
}

//=============================================
lineA = digitalRead(2);

if((lineA == 0)&&(mulai == 0)){
  delay(200);
  mulai = 1;
  start_time = millis();  
}  

if(mulai == 1){
seconds = (millis() - start_time) / 1000;
cs = ((millis() - start_time) / 10) % 100;;
}

//===========================================================================  
sprintf(lineBuff, "%d:%d ", seconds, cs);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 37,  3, lineBuff, strlen(lineBuff), GRAPHICS_NORMAL);  

sprintf(lineBuff2, "%d/%d/%d ", lapa, lapb, lapc);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 3,  3, lineBuff2, strlen(lineBuff2), GRAPHICS_NORMAL);  
//===========================================================================

}


void hasila(){
sprintf(lineBuff, "%d:%d ", seconds, cs);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 35,  3, lineBuff, strlen(lineBuff), GRAPHICS_NORMAL);  

sprintf(lineBuff2, " A", lapa, lapb, lapc);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 3,  3, lineBuff2, strlen(lineBuff2), GRAPHICS_NORMAL);  

hasila();  
}


void hasilb(){
sprintf(lineBuff, "%d:%d ", seconds, cs);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 35,  3, lineBuff, strlen(lineBuff), GRAPHICS_NORMAL);  

sprintf(lineBuff2, " B", lapa, lapb, lapc);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 3,  3, lineBuff2, strlen(lineBuff2), GRAPHICS_NORMAL);  

hasilb();  
}


void hasilc(){
sprintf(lineBuff, "%d:%d ", seconds, cs);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 35,  3, lineBuff, strlen(lineBuff), GRAPHICS_NORMAL);  

sprintf(lineBuff2, " C", lapa, lapb, lapc);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 3,  3, lineBuff2, strlen(lineBuff2), GRAPHICS_NORMAL);  

hasilc();  
}




c. VIDEO HASILNYA




TIMER LOMBA LARI DIGITAL 3 JALUR / LINE DMD P10 ARDUINO SENSOR LASER

TIMER LOMBA LARI DIGITAL 3 JALUR / LINE DMD P10 ARDUINO SENSOR LASER


         Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang digunakan untuk timer lomba lari digital dengan menggunakan penampil dmd p10 dan sensor laser. alat ini menggunakan arduino sebagai kontrolernya. untuk lebih jelasnya berikut adalah komponen dan kodingnya. 



a. Komponen




b. Program Arduino IDE

#include <Wire.h>
#include <SPI.h>        //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include <DMD.h>        //Library DMD yang menyediakan fungsi penampilan teks, gambar dsb
#include <TimerOne.h>   //Library peripheral Timer1 untuk menjalankan prosedur pindai panel DMD
#include <Time.h>     //Library waktu yang menyediakan tipe data, struktur, dan obyek waktu
#include "Arial_black_16.h"
#include "Arial_Black_16_ISO_8859_1.h"
#include "Arial14.h"
#include "DejaVuSans9.h"
#include "Droid_Sans_12.h"
#include "Droid_Sans_16.h"
#include "DejaVuSansItalic9.h"
#include "Mono5x7.h"
#include "SystemFont5x7.h"

#define DISPLAY_COLUMN_COUNT  3
#define DISPLAY_ROW_COUNT     1

#define PIXELS_PER_COLUMN  32
#define PIXELS_PER_ROW    16

DMD dmd(DISPLAY_COLUMN_COUNT, DISPLAY_ROW_COUNT);
unsigned char show = 0;

char lineBuff[20];
char lineBuff2[20];
char lineBuff3[20];
int tombol = 5;
int tombolx;
int lineA;
int lineB;
int lineC;
int mulai;
int seconds;
int cs;
int secondsa;
int csa;
int secondsb;
int csb;
int secondsc;
int csc;

long start_time = 0;
int lapa,lapb,lapc;
int finisha = 0;
int finishb = 0;
int finishc = 0;


void ScanDMD()
{
  dmd.scanDisplayBySPI();
}


void setup(void)
{  
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,INPUT);
pinMode(tombol,INPUT_PULLUP);

  dmd.clearScreen( true );   //true is normal (all pixels off), false is negative (all pixels on)
  Serial.begin(9600);
   //initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
  Timer1.initialize( 1000 );           //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
  Timer1.attachInterrupt( ScanDMD );   //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI() 
  //clear/init the DMD pixels held in RAM
  dmd.clearScreen( true );
}


void loop(void)
{
//Serial.print(lineA);
//Serial.print(lineB);
//Serial.println(lineC);

//============================================
lineA = digitalRead(2);
lineB = digitalRead(3);
lineC = digitalRead(4);

if((lineA == 0)&&(lineB == 1)&&(lineC == 1)&&(mulai == 1)&&(finisha == 0)){
secondsa = seconds;
csa = cs; 
finisha = 1; 
}

if((lineA == 1)&&(lineB == 0)&&(lineC == 1)&&(mulai == 1)&&(finishb == 0)){
secondsb = seconds;
csb = cs; 
finishb = 1;
}

if((lineA == 1)&&(lineB == 1)&&(lineC == 0)&&(mulai == 1)&&(finishc == 0)){
secondsc = seconds;
csc = cs; 
finishc = 1;
}

if((finisha == 1)&&(finishb == 1)&&(finishc == 1)){
 hasil();   
}

//=============================================
tombolx = digitalRead(tombol);

if((tombolx == 0)&&(mulai == 0)){
  delay(200);
  sprintf(lineBuff3, "GO ", seconds, cs);
  dmd.selectFont(Droid_Sans_12);
  dmd.drawString( 70,  3, lineBuff3, strlen(lineBuff3), GRAPHICS_NORMAL);  
  mulai = 1;
  start_time = millis();  
}  

if(mulai == 1){
seconds = (millis() - start_time) / 1000;
cs = ((millis() - start_time) / 10) % 100;;
}

//===========================================================================  

sprintf(lineBuff, "%d:%d ", seconds, cs);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 35,  3, lineBuff, strlen(lineBuff), GRAPHICS_NORMAL);  

sprintf(lineBuff2, "%d/%d/%d ", finisha, finishb, finishc);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 1,  3, lineBuff2, strlen(lineBuff2), GRAPHICS_NORMAL);  
//===========================================================================

delay(1);
}


void hasil(){

sprintf(lineBuff, "%d:%d  ", secondsa, csa);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 1,  3, lineBuff, strlen(lineBuff), GRAPHICS_NORMAL);  

sprintf(lineBuff2, "%d:%d ", secondsb, csb);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 35,  3, lineBuff2, strlen(lineBuff2), GRAPHICS_NORMAL);  

sprintf(lineBuff3, "%d:%d ", secondsc, csc);
dmd.selectFont(Droid_Sans_12);
dmd.drawString( 67,  3, lineBuff3, strlen(lineBuff3), GRAPHICS_NORMAL);  

delay(30000);
hasil();  
}




c. VIDEO HASILNYA






Monitor Debu IOT Blynk Nodemcu ESP8266

Monitor Debu IOT Blynk Nodemcu ESP8266


 
         Pada kesempatan kali ini saya akan mejelaskan mengenai bagaimana cara membuat sebuah alat yang menggunakan IOT untuk monitoring debu dan juga menampilkan nilainya pada lcd sehingga user bisa tahu untuk tingkat debu di sebuah ruangan tersebut layak atau tidak. untuk lebih jelasnya berikut adalah koding dan komponennya.




a. Komponen





b. Program Arduino IDE

#define BLYNK_TEMPLATE_ID "TMPL6wOC--xcc"
#define BLYNK_TEMPLATE_NAME "monitor daya"
#define BLYNK_AUTH_TOKEN "VOK0cWiFN5ycHj3SV_snEDXTfTfeixxx"

#define BLYNK_PRINT Serial    
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

int dustPin = A0; // dust sensor - Wemos A0 pin
int ledPin = D3;    

float voltsMeasured = 0;
float calcVoltage = 0;
float dustDensity = 0;

BlynkTimer timer;

char ssid[] = "hotspothpku";
char pass[] = "123456789";

void sendSensor()
{
 Blynk.virtualWrite(V2, dustDensity);
 delay(1000);
}

void setup()
{
  lcd.begin();
  lcd.clear();
  lcd.noCursor();
  Serial.begin(9600);
  pinMode(ledPin,OUTPUT);
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
  timer.setInterval(1000L, sendSensor);
}

  
void loop()
{
  digitalWrite(ledPin,LOW); // power on the LED
  delayMicroseconds(280);
  
  voltsMeasured = analogRead(dustPin); // read the dust value
  
  delayMicroseconds(40);
  digitalWrite(ledPin,HIGH); // turn the LED off
  delayMicroseconds(9680);
  
  //measure your 5v and change below
  calcVoltage = voltsMeasured * (3.3 / 1024.0);
  dustDensity = 0.17 * calcVoltage - 0.1;

  lcd.setCursor(0,0);
  lcd.print("mg/m3: ");
  lcd.print(dustDensity);
  lcd.print("    ");

  /*
  Serial.println("GP2Y1010AU0F readings"); 
  Serial.print("Raw Signal Value = ");
  Serial.println(voltsMeasured); 
  Serial.print("Voltage = ");
  Serial.println(calcVoltage);
  Serial.print("Dust Density = ");
  Serial.println(dustDensity); // mg/m3
  Serial.println("");
  */

  Blynk.run();
  timer.run();
  
  delay(200);
}




c. VIDEO HASILNYA