Recent

11 มกราคม 2564

ESP8266 (NodeMCU V2) มาลองเปิดไฟ กับ โมดูลรีเลย์ 2 Ch 2 ตัว

ESP8266 (NodeMCU V2)

มึนๆ งง ๆ กับครูโป้ง





ขั้นแรก   ต้องมี Drivers

1.ดาวน์โหลด Driver :

Wireless module NodeMcu ESP8266 ESP-12E

CP2102

Wireless module NodeMcu 4M bytes Lua WIFI Internet of Things development board based ESP8266 ESP-12E for arduino Compatible


ดาวน์โหลด Driver https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers


วิธีการติดตั้งไดรเวอร์ 


2. ติดตั้ง IDE // ส่วนตัวใช้ 1.8.9 


   Downloads : V 1.8.9 แบบ Zip มาแตกไฟล์  ที่นี่

   Downloads : รุ่นอื่นๆ ที่นี่


3.เพิ่ม ESP ให้ IDE รู้จัก


เพิ่ม http://arduino.esp8266.com/stable/package_esp8266com_index.json ลงในช่อง Additional Boards Manager URLs 

4.เขียนโปรแกรม

วิธีการติดตั้ง ESP8266 ใช้งานใน ARDUINO IDE ได้

ขั้นต่อมา เขียนโปรแกรม // ด้วย 

วิธี upload esp8266 ให้เลือกบอร์ดดังนี้


ลอง เปิด/ปิด RELAY 4 ตัวดูเล่นๆ




5. ทดสอบการทำงาน 

ทดสอบการทำงาน 


6.ปรับปรุงแก้ไข

ปรับปรุงแก้ไข



อ้างอิง :

https://www.myarduino.net/article/119/


2 ความคิดเห็น:

  1. Driver NodeMCU V3
    ===========================
    https://github.com/nodemcu/nodemcu-devkit/raw/master/Drivers/CH341SER_WINDOWS.zip

    Blynk Test Code:
    /*************************************************************
    Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

    Blynk is a platform with iOS and Android apps to control
    Arduino, Raspberry Pi and the likes over the Internet.
    You can easily build graphic interfaces for all your
    projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator: http://examples.blynk.cc
    Blynk community: http://community.blynk.cc
    Follow us: http://www.fb.com/blynkapp
    http://twitter.com/blynk_app

    Blynk library is licensed under MIT license
    This example code is in public domain.

    *************************************************************

    You can send/receive any data using WidgetTerminal object.

    App project setup:
    Terminal widget attached to Virtual Pin V1
    *************************************************************/

    /* Comment this out to disable prints and save space */
    #define BLYNK_PRINT Serial


    #include
    #include

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

    // Your WiFi credentials.
    // Set password to "" for open networks.
    char ssid[] = "YourNetworkName";
    char pass[] = "YourPassword";

    // Attach virtual serial terminal to Virtual Pin V1
    WidgetTerminal terminal(V1);

    // You can send commands from Terminal to your hardware. Just use
    // the same Virtual Pin as your Terminal Widget
    BLYNK_WRITE(V1)
    {

    // if you type "Marco" into Terminal Widget - it will respond: "Polo:"
    if (String("Marco") == param.asStr()) {
    terminal.println("You said: 'Marco'") ;
    terminal.println("I said: 'Polo'") ;
    } else {

    // Send it back
    terminal.print("You said:");
    terminal.write(param.getBuffer(), param.getLength());
    terminal.println();
    }

    // Ensure everything is sent
    terminal.flush();
    }

    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", 80);
    //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

    // Clear the terminal content
    terminal.clear();

    // This will print Blynk Software version to the Terminal Widget when
    // your hardware gets connected to Blynk Server
    terminal.println(F("Blynk v" BLYNK_VERSION ": Device started"));
    terminal.println(F("-------------"));
    terminal.println(F("Type 'Marco' and get a reply, or type"));
    terminal.println(F("anything else and get it printed back."));
    terminal.flush();
    }

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

    ตอบลบ
  2. https://www.arduitronics.com/product/927/nodemcu-version-3-2

    ตอบลบ