Translate

KURSUS ROBOTIK / MIKROKONTROLLER ARDUINO KOTA KEDIRI JAWA TIMUR

KURSUS ROBOTIK / MIKROKONTROLLER ARDUINO KOTA KEDIRI JAWA TIMUR


         Kabar gembira bagi siswa siswi yang ingin belajar membuat robot segera daftarkan diri Anda, Kami membuka kursus robotik untuk segala usia ( tidak ada batasan usia ). lokasi kami berada di kota kediri, kursus robotik menggunakan mikrokontroller Arduino dan juga program yang digunakan juga Arduino IDE. untuk materi pelatihan atau kursus yaitu sebagai berikut:  

a. LEVEL BASIC
1. Pengenalan Basic I/O
2. Mempelajari LCD 16x2
3. Mengakses Sensor Analog
4. Mengakses Serial Monitor (UART)
5. Mengakses Motor DC dan Servo


b. LEVEL LANJUTAN
1. Robot Line Tracer / Line Follower
2. Robot Wall Avoider
3. Robot Kendali HP Android
4. Robot Kendali Joystick PS2
5. Robot Pemindah Barang / Robot Lengan


        Sistem pelatihan atau kursus yang kami adakan yaitu sistemnya PRIVATE di rumah siswa sehingga wajib memberikan alamat yang jelas untuk kami tahu lokasinya. biaya pelatihan sebesar Rp.500.000 / Bulan dengan setiap kali pertemuan maksimal 2 jam bisa lebih atau kurang tergantung kondisi dan kemampuan siswa. untuk waktu senin - sabtu pukul 16.00 atau 19.00 WIB untuk hari minggu waktu fleksibel. untuk info lebih lanjut bisa hubungi WA : 085726496643 (wa only) atau bisa melalui E-Mail : Yanuarm@hotmail.com 


untuk melihat robot yang sudah pernah kami buat silahkan kunjung link berikut:
http://kursuselektronikaku.blogspot.com/2015/10/jual-robot-edukasi-untuk-pelatihan.html





IOT Project NodeMCU ESP8266 Thingspeak Monitor Tegangan AC 220 Volt INTERNET

IOT Project NodeMCU ESP8266 Thingspeak Monitor Tegangan AC 220 Volt INTERNET


         Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang menggunakan internet sebagai media komunikasinya untuk monitor jarak jauh tegangan AC 220 volt. alat ini menggunakan sensor zmpt dan mikrokontroller yang dipakai yaitu nodemcu esp8266. berikut adalah program dan daftar komponennya.




a. Nodemcu ESP8266




b. Sensor ZMPT101B






c. Program Arduno IDE

#include <ESP8266WiFi.h>
#include "Wire.h"

String apiKey = "aaabbbccdddeeffff";     //  Enter your Write API key from ThingSpeak
const char* resource = "/update?api_key=";

const char *ssid =  "Hotspot Wifiku";     // replace with your wifi ssid and wpa2 key
const char *pass =  "123456789";
const char* server = "api.thingspeak.com";

int vin = 0;
int iin = 0;
int vout;
float kal;

unsigned long start_times[100];
unsigned long stop_times[100];
unsigned long values[100];

// Define various ADC prescaler
//const unsigned char PS_16 = (1 << ADPS2);
//const unsigned char PS_32 = (1 << ADPS2) | (1 << ADPS0);
//const unsigned char PS_64 = (1 << ADPS2) | (1 << ADPS1);
//const unsigned char PS_128 = (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);

int a = 0;
int zero = 1;

WiFiClient client;

void setup() 
{
       Serial.begin(9600);
       delay(10);

       Serial.println("Connecting to ");
       Serial.println(ssid);

// Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, pass);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");


      while (WiFi.status() != WL_CONNECTED) 
     {
            delay(500);
            Serial.print(".");
     }
      Serial.println("");
      Serial.println("WiFi connected");

 // set up the ADC
//  ADCSRA &= ~PS_128;  // remove bits set by Arduino library

  // you can choose a prescaler from above.
  // PS_16, PS_32, PS_64 or PS_128
//  ADCSRA |= PS_128;    // set our own prescaler to 64
      
}



void loop() 
{
  
  unsigned int i1;
  unsigned int z1;
  z1 = 0;

  unsigned int i2;
  unsigned int z2;
  z2 = 0;

  unsigned int i3;
  unsigned int z3;
  z3 = 0;

  unsigned int i4;
  unsigned int z4;
  z4 = 0;
  
  for(i1=0;i1<100;i1++) {
    start_times[i1] = micros();
    values[i1] = analogRead(A0);            

  if (values[i1] >= z1) {
  z1 = values[i1];
  }

    stop_times[i1] = micros();
  }

    for(i2=0;i2<100;i2++) {
    start_times[i2] = micros();
    values[i2] = analogRead(A0);            

  if (values[i2] >= z2) {
  z2 = values[i2];
  }

    stop_times[i2] = micros();
  }


    for(i3=0;i3<100;i3++) {
    start_times[i3] = micros();
    values[i3] = analogRead(A0);            

  if (values[i3] >= z3) {
  z3 = values[i3];
  }

    stop_times[i3] = micros();
  }


    for(i4=0;i4<100;i4++) {
    start_times[i4] = micros();
    values[i4] = analogRead(A0);            

  if (values[i4] >= z4) {
  z4 = values[i4];
  }

    stop_times[i4] = micros();
  }


   int vin1 = z1 ;
   int vin2 = z2 ;
   int vin3 = z3 ;
   int vin4 = z4 ;

  z1 = 0;
  z2 = 0;
  z3 = 0;
  z4 = 0;

if((vin1 > vin2)&&(vin1 > vin3)&&(vin1 > vin4)){
  vout = vin1;
  kal = (vout - 515.9) / 0.413 ;
}
else if((vin2 > vin1)&&(vin2 > vin3)&&(vin2 > vin4)){
  vout = vin2;
  kal = (vout - 515.9) / 0.413 ;
}
else if((vin3 > vin1)&&(vin3 > vin2)&&(vin3 > vin4)){
  vout = vin3;
  kal = (vout - 515.9) / 0.413 ;
}
else if((vin4 > vin1)&&(vin4 > vin2)&&(vin4 > vin3)){
  vout = vin4;
  kal = (vout - 515.9) / 0.413 ;
}

kal = kal - 20;

if(kal < 0){
kal = 0;
}

                         if (client.connect(server,80))   //   "184.106.153.149" or api.thingspeak.com
                      {  
                            
                             String postStr = apiKey;
                             postStr +="&field1=";
                             postStr += String(kal);
                             postStr += "\r\n\r\n";

                            client.print(String("GET ") + resource + apiKey + "&field1=" + kal + " HTTP/1.1\r\n" + "Host: " + server + "\r\n" + "Connection: close\r\n\r\n");                             
                                        
                             client.print("Host: api.thingspeak.com\n");
                             client.print("Connection: close\n");
                             client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n");
                             client.print("Content-Type: application/x-www-form-urlencoded\n");
                             client.print("Content-Length: ");
                             client.print(postStr.length());
                             client.print("\n\n");
                             client.print(postStr);
                             
                             Serial.print("voltage: ");
                             Serial.print(kal);
                             Serial.println("v. Send to Thingspeak.");
                        }
                        
          client.stop();

          Serial.println("Waiting...");
  
  // thingspeak needs minimum 15 sec delay between updates, i've set it to 30 seconds
  delay(10000);
}





d. Gambar Hasilnya






e. VIDEO HASILNYA







Membuat alat Monitor PH dan Suhu ds18b20 via Android dengan ARDUINO

Membuat alat Monitor PH dan Suhu ds18b20 via Android dengan ARDUINO


          Pada kesempatan kali ini saya akan menjelaskan mnengenai bagaimana cara membuat sebuah alat yang berfungsi untuk monitoring suhu dan ph via android. alat ini dilengkapi dengan bluetooth hc-05 dan sensor suhu ds18b20. untuk lebih jelasnya berikut adalah program dan daftar komponennya. 




a. Arduino Uno




b. Sensor PH




c. Sensor suhu ds18b20




d. Bluetooth HC-05






e. Program Arduino IDE

#include <OneWire.h>
#include <Wire.h>

OneWire  ds(8);  // on pin 10 (a 4.7K resistor is necessary)

int suhu;
int dataadc;
int ph;

void setup() {
  Serial.begin(9600);
  //Serial.println("test");

}

void loop(void) {
  byte i;
  byte present = 0;
  byte type_s;
  byte data[12];
  byte addr[8];
  float celsius, fahrenheit;

  if ( !ds.search(addr)) {
    ds.reset_search();
    delay(250);
    return;
  }

  for( i = 0; i < 8; i++) {

  }

  if (OneWire::crc8(addr, 7) != addr[7]) {
      return;
  }

  switch (addr[0]) {
    case 0x10:
      type_s = 1;
      break;
    case 0x28:
      type_s = 0;
      break;
    case 0x22:
      type_s = 0;
      break;
    default:
      return;
  }

  ds.reset();
  ds.select(addr);
  ds.write(0x44, 1);        // start conversion, with parasite power on at the end

  delay(1000);     // maybe 750ms is enough, maybe not

  present = ds.reset();
  ds.select(addr);  
  ds.write(0xBE);         // Read Scratchpad

  for ( i = 0; i < 9; i++) {           // we need 9 bytes
    data[i] = ds.read();
  }

  int16_t raw = (data[1] << 8) | data[0];
  if (type_s) {
    raw = raw << 3; // 9 bit resolution default
    if (data[7] == 0x10) {
      raw = (raw & 0xFFF0) + 12 - data[6];
    }
  } else {
    byte cfg = (data[4] & 0x60);
    if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms
    else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
    else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms

  }
  celsius = (float)raw / 16.0;
  fahrenheit = celsius * 1.8 + 32.0;
  suhu = celsius;

  dataadc = analogRead(A0);
  ph = -0.021 * dataadc;
  ph = ph + 19.92;

    Serial.print("Hasil|");       
    Serial.print(suhu);
    Serial.print("|");
    Serial.println(ph);
    
    delay(300);
   

}





f. Program Interface Android








g. VIDEO HASILNYA







IOT Project NodeMCU ESP8266 Monitor Suhu dan Kelembaban via Internet Sensor DHT11 Server THINGSPEAK

IOT Project NodeMCU ESP8266 Monitor Suhu dan Kelembaban via Internet Sensor DHT11 Server THINGSPEAK


          Pada kesempatan kali ini saya akan menjelaskan mengenai sebuah alat yang berfungsi untuk monitoring suhu dan kelembaban via internet dengan server ThingSpeak. alat ini menggunakan sensor DHT11 dan mikrokontroller NodeMcu ESP8266. untuk lebih jelasnya berikut adalah daftar komponen dan programnya.




a. NodeMCU ESP8266




b. Sensor DHT11






c. Program Arduino IDE

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <DHT.h>

#define DHTPIN 0   //nodemcu pin D3
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);


String apiKey = "AAaaaBBbbCCcc123";     //  Enter your Write API key from ThingSpeak
const char* resource = "/update?api_key=";

const char *ssid =  "Hotspot Wifiku";     // replace with your wifi ssid and wpa2 key
const char *pass =  "123456789";
const char* server = "api.thingspeak.com";

WiFiClient client;

void setup() 
{
  
       Serial.begin(115200);
       delay(10);

       Serial.println("Connecting to ");
       Serial.println(ssid);

// Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, pass);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");


      while (WiFi.status() != WL_CONNECTED) 
     {
            delay(500);
            Serial.print(".");
     }
      Serial.println("");
      Serial.println("WiFi connected");

      dht.begin();
}



void loop() 
{

  int h = dht.readHumidity();
  int t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  

                         if (client.connect(server,80))   //   "184.106.153.149" or api.thingspeak.com
                      {  
                            
                             String postStr = apiKey;
                             postStr +="&field1=";
                             postStr += String(t);
                             postStr += "\r\n\r\n";

                             client.print(String("GET ") + resource + apiKey + "&field1=" + t + "&field2=" + h + " HTTP/1.1\r\n" + "Host: " + server + "\r\n" + "Connection: close\r\n\r\n");
                             //client.print(String("GET ") + resource + apiKey + "&field1=" + t + " HTTP/1.1\r\n" + "Host: " + server + "\r\n" + "Connection: close\r\n\r\n");                             
                                        
                             client.print("Host: api.thingspeak.com\n");
                             client.print("Connection: close\n");
                             client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n");
                             client.print("Content-Type: application/x-www-form-urlencoded\n");
                             client.print("Content-Length: ");
                             client.print(postStr.length());
                             client.print("\n\n");
                             client.print(postStr);
                             
                             Serial.print("Temperature: ");
                             Serial.print(t);
                             Serial.print(" humidity: ");
                             Serial.print(h);
                             Serial.println(". Send to Thingspeak.");
                        }
                        
          client.stop();

          Serial.println("Waiting...");
  
  // thingspeak needs minimum 15 sec delay between updates, i've set it to 30 seconds
  delay(10000);
}




d. Gambar Hasilnya






e. VIDEO HASILNYA








IOT Blynk Project Nodemcu ESP8266 Monitor Suhu Lm35 dan Kendali LED via internet dengan aplikasi Blynk

IOT Blynk Project Nodemcu ESP8266 Monitor Suhu Lm35 dan Kendali LED via internet dengan aplikasi Blynk


        Pada kesempatan kali ini saya akan menjelaskan mengenai sebuah alat yang berfungsi untuk memonitor suhu menggunakan sensor LM35 dan kendali led via internet menggunakan aplikasi Blynk. aplikasi Blynk bisa didapatkan di handphone atau tablet dengan cara install pada play store di android atau app store di IOS. untuk lebih jelasnya berikut adalah program dan daftar komponennya 




a. Nodemcu ESP8266




b. Sensor Suhu LM35






c. Program Arduino IDE

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
 
    // You should get Auth Token in the Blynk App.
    // Go to the Project Settings (nut icon).
    char auth[] = "aaaaaaaabbbbbccccccddddddeeeeeffffff";
    char ssid[] = "Hotspot Wifiku";
    char pass[] = "123456789";

    int dataadc;
 
    float suhu;
    int tempPin = A0;   //Output lm35 ke A0 dan LED ke pin D4
 
    SimpleTimer timer;
 
    void setup()
    {
      Serial.begin(9600); // See the connection status in Serial Monitor
      Blynk.begin(auth, ssid, pass);
 
      // Setup a function to be called every second
      timer.setInterval(1000L, sendUptime);
    }
 
    // that you define how often to send data to Blynk App.
    void sendUptime()
    {
     // shows the value temp on virtual pin 10
      Blynk.virtualWrite(V10, suhu);
    }
 
    void loop()
    {
      Blynk.run(); // Initiates Blynk
      timer.run(); // Initiates SimpleTimer
   
       dataadc = analogRead(tempPin);
       suhu = dataadc * (3.2 / 1023.0) * 100.0;
   
    }



 
d. Gambar Interface Blynk






e. VIDEO HASILNYA







IOT Project Blynk + NodeMCU ESP8266 Monitor Suhu - Kelembaban Sensor DHT11 dan kendali LED via Internet

IOT Project Blynk + NodeMCU ESP8266 Monitor Suhu - Kelembaban Sensor DHT11 dan kendali LED via Internet   


          Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat alat berbasis internet menggunakan aplikasi Blynk. mikrokontroller yang dipakai yaitu Nodemcu ESP8266. sensor yang digunakan adalah DHT11. selain itu alat ini juga bisa mengendalikan led melalui aplikasi blynk via internet. untuk lebih jelasnya berikut adalah program dan skemanya.



a. Nodemcu ESP8266




b. Sensor DHT11







c. Program Arduno IDE

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "aaaaaaabbbbbbccccccccddddddeeeeeeeefff";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Hotspot Wifiku";
char pass[] = "123456789";

#define DHTPIN 0          // D3 dan led di D4

// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, t);
  Blynk.virtualWrite(V6, h);
}

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);

  dht.begin();

  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
}

void loop()
{
  Blynk.run();
  timer.run();
}





d. Gambar Interface Blynk







e. VIDEO HASILNYA







IOT Project NodeMCU ESP8266 Monitor Suhu LM35 dan Kendali LED via Internet SERVER THINGSPEAK

IOT Project NodeMCU ESP8266 Monitor Suhu LM35 dan Kendali LED via Internet SERVER THINGSPEAK


        Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat berbasis IOT dengan mikrokontroller yang digunakan adalah NodeMCU ESP8266. server yang digunakan adalah THINGSPEAK dan sensor suhu yang digunakan adalah LM35. untuk lebih jelasnya berikut adalah program dan daftar komponennya.




a. NodeMCU ESP8266




b. Sensor Suhu LM35





c. LED




d. Gambar Hasilnya







e. Program Arduino IDE

//alamat kendali
//https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field2=1&field3=1&field4=0

#include "ThingSpeak.h"
#include <ESP8266WiFi.h>

//Replace your wifi credentials here
const char* ssid     = "Hotspot Wifiku";
const char* password = "123456789";

//change your channel number here
unsigned long channel = 884148;

//2,3 and 4 are channel fields in thingspeak.
unsigned int led1 = 2;
unsigned int led2 = 3;
unsigned int led3 = 4;

String apiKey = "TTPXYPWJTOC07JYW";     //  Enter your Write API key from ThingSpeak
const char* resource = "/update?api_key=";

const char* server = "api.thingspeak.com";

const int AnalogIn  = A0;
float suhu;
int dataadc;

WiFiClient  client;


void setup() {

         Serial.begin(115200);
       delay(10);

// Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");


  delay(100);

  pinMode(D1, OUTPUT);
  pinMode(D2, OUTPUT);
  pinMode(D3, OUTPUT);
  digitalWrite(D1, 0);
  digitalWrite(D2, 0);
  digitalWrite(D3, 0);
  // We start by connecting to a WiFi network


  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  Serial.print("Netmask: ");
  Serial.println(WiFi.subnetMask());
  Serial.print("Gateway: ");
  Serial.println(WiFi.gatewayIP());
  ThingSpeak.begin(client);

}


void loop() {

  //get the last data of the fields
  int led_1 = ThingSpeak.readFloatField(channel, led1);
  int led_2 = ThingSpeak.readFloatField(channel, led2);
  int led_3 = ThingSpeak.readFloatField(channel, led3);

  if(led_1 == 1){
    digitalWrite(D1, 1);
    Serial.println("D1 is On..!");
  }
  else if(led_1 == 0){
    digitalWrite(D1, 0);
    Serial.println("D1 is Off..!");
  }

  if(led_2 == 1){
    digitalWrite(D2, 1);
    Serial.println("D2 is On..!");
  }
  else if(led_2 == 0){
    digitalWrite(D2, 0);
    Serial.println("D2 is Off..!");
  }

  if(led_3 == 1){
    digitalWrite(D3, 1);
    Serial.println("D3 is On..!");
  }
  else if(led_3 == 0){
    digitalWrite(D3, 0);
    Serial.println("D3 is Off..!");
  }
 
  Serial.println(led_1);
  Serial.println(led_2);
  Serial.println(led_3);
  delay(5000);


  dataadc = analogRead(AnalogIn);
suhu = dataadc * (3.2/1023.0) * 100.0;


                         if (client.connect(server,80))   //   "184.106.153.149" or api.thingspeak.com
                      {
                         
                             String postStr = apiKey;
                             postStr +="&field1=";
                             postStr += String(suhu);
                             postStr += "\r\n\r\n";

                             //client.print(String("GET ") + resource + apiKey + "&field1=" + temperatureTemp + "&field2=" + humidityTemp + " HTTP/1.1\r\n" + "Host: " + server + "\r\n" + "Connection: close\r\n\r\n");
                             client.print(String("GET ") + resource + apiKey + "&field1=" + suhu + " HTTP/1.1\r\n" + "Host: " + server + "\r\n" + "Connection: close\r\n\r\n");                           
                                     
                             client.print("Host: api.thingspeak.com\n");
                             client.print("Connection: close\n");
                             client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n");
                             client.print("Content-Type: application/x-www-form-urlencoded\n");
                             client.print("Content-Length: ");
                             client.print(postStr.length());
                             client.print("\n\n");
                             client.print(postStr);
                           
                             Serial.print("Temperature: ");
                             Serial.print(suhu);
                             Serial.println("C. Send to Thingspeak.");
                        }
                     
          client.stop();

          Serial.println("Waiting...");

  // thingspeak needs minimum 15 sec delay between updates, i've set it to 30 seconds
  delay(5000);

}




f. Program index.php

<html>
<head>
<title>LED ON/OFF</title>
</head>
<body>

<p align="center">
<font size="8">

<b>LAMPU 1 = &nbsp <a href="https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field2=1">ON </a></b> /
<b><a href="https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field2=0">OFF</a></b>
<br>
<b>LAMPU 2 = &nbsp <a href="https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field3=1">ON </a></b> /
<b><a href="https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field3=0">OFF</a></b>
<br>
<b>LAMPU 3 = &nbsp <a href="https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field4=1">ON </a></b> /
<b><a href="https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field4=0">OFF</a></b>
<br>

</font>
</p>

</body>
</html>






g. VIDEO HASILNYA







IOT Project Nodemcu ESP8266 Control Led Menggunakan Internet Server THINGSPEAK

IOT Project Nodemcu ESP8266 Control Led Menggunakan Internet Server THINGSPEAK


         Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat dikendalikan secara jarak jauh. Alat ini menggunakan NodeMCU ESP8266 yang mana telah dilengkapi dengan modul wifi. server yang digunakan adalah THINGSPEAK. untuk lebih jelasnya berikut adalah daftar komponen dan programnya.    




a. NodeMCU ESP8266




b. Led




c. Gambar Hasilnya






d. Program Arduino IDE

//alamat kendali
//https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field2=1&field3=1&field4=0

#include "ThingSpeak.h"
#include <ESP8266WiFi.h>

//Replace your wifi credentials here
const char* ssid     = "Hotspot Wifiku";
const char* password = "123456789";

//change your channel number here
unsigned long channel = 884148;

//2,3 and 4 are channel fields in thingspeak.
unsigned int led1 = 2;
unsigned int led2 = 3;
unsigned int led3 = 4;

WiFiClient  client;


void setup() {
  Serial.begin(115200);
  delay(100);

  pinMode(D1, OUTPUT);
  pinMode(D2, OUTPUT);
  pinMode(D3, OUTPUT);
  digitalWrite(D1, 0);
  digitalWrite(D2, 0);
  digitalWrite(D3, 0);
  // We start by connecting to a WiFi network

  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  Serial.print("Netmask: ");
  Serial.println(WiFi.subnetMask());
  Serial.print("Gateway: ");
  Serial.println(WiFi.gatewayIP());
  ThingSpeak.begin(client);

}


void loop() {

  //get the last data of the fields
  int led_1 = ThingSpeak.readFloatField(channel, led1);
  int led_2 = ThingSpeak.readFloatField(channel, led2);
  int led_3 = ThingSpeak.readFloatField(channel, led3);

  if(led_1 == 1){
    digitalWrite(D1, 1);
    Serial.println("D1 is On..!");
  }
  else if(led_1 == 0){
    digitalWrite(D1, 0);
    Serial.println("D1 is Off..!");
  }

  if(led_2 == 1){
    digitalWrite(D2, 1);
    Serial.println("D2 is On..!");
  }
  else if(led_2 == 0){
    digitalWrite(D2, 0);
    Serial.println("D2 is Off..!");
  }

  if(led_3 == 1){
    digitalWrite(D3, 1);
    Serial.println("D3 is On..!");
  }
  else if(led_3 == 0){
    digitalWrite(D3, 0);
    Serial.println("D3 is Off..!");
  }
 
  Serial.println(led_1);
  Serial.println(led_2);
  Serial.println(led_3);
  delay(5000);

}





e. Program index.php

<html>
<head>
<title>LED ON/OFF</title>
</head>
<body>

<p align="center">
<font size="8">

<b>LAMPU 1 = &nbsp <a href="https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field2=1">ON </a></b> /
<b><a href="https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field2=0">OFF</a></b>
<br>
<b>LAMPU 2 = &nbsp <a href="https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field3=1">ON </a></b> /
<b><a href="https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field3=0">OFF</a></b>
<br>
<b>LAMPU 3 = &nbsp <a href="https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field4=1">ON </a></b> /
<b><a href="https://api.thingspeak.com/update?api_key=TTPXYPWJTOC07JYW&field4=0">OFF</a></b>
<br>

</font>
</p>

</body>
</html>





f. VIDEO HASILNYA







IOT Project Nodemcu ESP8266 Monitor Suhu / Temperature Sensor LM35 Server THINGSPEAK

IOT Project Nodemcu ESP8266 Monitor Suhu / Temperature Sensor LM35 Server THINGSPEAK


         Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat memonitor suhu dengan jarak jauh karena menggunakan internet untuk transfer datanya. alat ini menggunakan Nodemcu esp8266 dan sensor suhu LM35. untuk server menggunakan THINGSPEAK. untuk lebih jelasnya berikut adalah daftar komponen dan programnya.



a. Nodemcu ESP8266




b. Sensor Suhu LM35




c. Gambar Hasilnya






d. Program Arduino IDE

#include <ESP8266WiFi.h>

String apiKey = "TTPXYPWJTOC07JYW";     //  Enter your Write API key from ThingSpeak
const char* resource = "/update?api_key=";

const char *ssid =  "Hotspot Wifiku";     // replace with your wifi ssid and wpa2 key
const char *pass =  "123456789";
const char* server = "api.thingspeak.com";

const int AnalogIn  = A0;
float suhu;
int dataadc;

WiFiClient client;

void setup() 
{
       Serial.begin(115200);
       delay(10);

       Serial.println("Connecting to ");
       Serial.println(ssid);

// Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, pass);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");


      while (WiFi.status() != WL_CONNECTED) 
     {
            delay(500);
            Serial.print(".");
     }
      Serial.println("");
      Serial.println("WiFi connected");
      
}



void loop() 
{
  
dataadc = analogRead(AnalogIn);
suhu = dataadc * (3.2/1023.0) * 100.0;


                         if (client.connect(server,80))   //   "184.106.153.149" or api.thingspeak.com
                      {  
                            
                             String postStr = apiKey;
                             postStr +="&field1=";
                             postStr += String(suhu);
                             postStr += "\r\n\r\n";

                             //client.print(String("GET ") + resource + apiKey + "&field1=" + temperatureTemp + "&field2=" + humidityTemp + " HTTP/1.1\r\n" + "Host: " + server + "\r\n" + "Connection: close\r\n\r\n");
                             client.print(String("GET ") + resource + apiKey + "&field1=" + suhu + " HTTP/1.1\r\n" + "Host: " + server + "\r\n" + "Connection: close\r\n\r\n");                             
                                        
                             client.print("Host: api.thingspeak.com\n");
                             client.print("Connection: close\n");
                             client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n");
                             client.print("Content-Type: application/x-www-form-urlencoded\n");
                             client.print("Content-Length: ");
                             client.print(postStr.length());
                             client.print("\n\n");
                             client.print(postStr);
                             
                             Serial.print("Temperature: ");
                             Serial.print(suhu);
                             Serial.println("C. Send to Thingspeak.");
                        }
                        
          client.stop();

          Serial.println("Waiting...");
  
  // thingspeak needs minimum 15 sec delay between updates, i've set it to 30 seconds
  delay(10000);
}





e. VIDEO HASILNYA