Video není dostupné.
Omlouváme se.

Send Data From Arduino to NodeMCU and NodeMCU to Arduino Via Serial Communication

Sdílet
Vložit
  • čas přidán 4. 05. 2020
  • Send Data From Arduino to NodeMCU and NodeMCU to Arduino Via Serial Communication
    Scroll down for code.....
    In this tutorial we will learn how to make serial communication between Arduino to ESP8266 & ESP8266 to Arduino. Serial communication is required when you want to transfer sensor data or any data from one device to another device, In our case it is ESP8266 NodeMCU and Arduino. Moreover, we will transfer DHT22 Sensor data from Arduino to NodeMCU and NodeMCU to Arduino. Apart from this we will also see how to use software serial library on Arduino and Serial1 on ESP8266 NodeMCU, So that you can transfer data with another serial port, which we will be helpful. If you are doing lots of things on both Arduino and ESP8266 NodeMCU.
    If you want to support my video please buy any product through my amazon affiliate link. I will receive a commission, at no extra cost to you.
    LIST OF COMPONENT (affiliate links)
    amzn.to/2Uo7M93 (NodeMCU ESP8266 12E)
    amzn.to/2fvSRJq (Arduino)
    amzn.to/2vqIKJP (DHT22)
    amzn.to/2wxPmWz (Breadboard)
    amzn.to/2vJ3lvo (Jumper wire)
    amzn.to/2vmSK8l (Resistor)
    Music provided by NoCopyrightSounds.
    Watch: • Lost Sky - Vision | Du...
    Free Download / Stream: ncs.io/VisionID
    Code for Arduino:
    #include "DHT.h"
    #include (SoftwareSerial.h) //instead of parenthesis () put angle bracket as CZcams description does not allow angle bracket
    #define DHTPIN 2
    // Uncomment whatever type you're using!
    //#define DHTTYPE DHT11 // DHT 11
    #define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
    //#define DHTTYPE DHT21 // DHT 21 (AM2301)
    SoftwareSerial espSerial(5, 6);
    DHT dht(DHTPIN, DHTTYPE);
    String str;
    void setup(){
    Serial.begin(115200);
    espSerial.begin(115200);
    dht.begin();
    delay(2000);
    }
    void loop()
    {
    float h = dht.readHumidity();
    // Read temperature as Celsius (the default)
    float t = dht.readTemperature();
    Serial.print("H: ");
    Serial.print(h);
    Serial.print("% ");
    Serial.print(" T: ");
    Serial.print(t);
    Serial.println("C");
    str =String("coming from arduino: ")+String("H= ")+String(h)+String("T= ")+String(t);
    espSerial.println(str);
    delay(1000);
    }
    Code for ESP8266:
    void setup() {
    // Open serial communications and wait for port to open:
    Serial.begin(115200);
    while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
    }
    }
    void loop() { // run over and over
    if (Serial.available()) {
    Serial.write(Serial.read());
    }
    }

Komentáře • 49

  • @luistimana2393
    @luistimana2393 Před 2 lety +9

    I was able to fix the communication issue from the Arduino to the ESP8266. The problem can be solved by: 1. Change board for NodeMCU 0.9 (ESP-12 Module). 2. Change the baud rate to 9600. 3. Use the readString() function instead of the read() function. 4. Assign pins D6 and D5 as Rx and Tx, respectively

  • @shehabxcode
    @shehabxcode Před 3 lety +2

    Can I send and receive at same time I mean send on off value from nodemcu to arduino and receive relay status from arduino. Also can I apply same example to esp8266-01.

  • @leonardchung9729
    @leonardchung9729 Před 2 lety +1

    Does it similarly applies to ESP32? When I looked through the serial monitor on the ESP32 I could not receive temperature and humidity readings from the Arduino.

  • @user-ko1uz4lg1v
    @user-ko1uz4lg1v Před 3 lety +1

    Спасибо. Отличное видео

  • @HakkiOgrt
    @HakkiOgrt Před 2 měsíci

    thanks for the simple understandable video, subbed

  • @mazharulsabbir6768
    @mazharulsabbir6768 Před 3 lety

    it was helpful. thanks

  • @ouafaebouamar6837
    @ouafaebouamar6837 Před 3 lety

    Did you use to cables? One for arduino and one for nodemcu?

  • @friendyprasetiawan05
    @friendyprasetiawan05 Před 3 lety

    sir, for example, if there are 2 arduino and each arduino there is sensor data and then it is sent to 1nodemcu, what do you do?

  • @yogabayuangganapratama6558

    Can I use Arduino 2-way communication with nodemcu?

  • @nandhinijagadeesan3835

    Can i connect Arduino mega with NodeMCU esp8266 and then connect to thingspeak to visualize sensor data?

  • @startobytes
    @startobytes Před 3 lety +2

    Pls Help me! If i want to Upload Code to nodeMcu it says that there are no programmers available! Pls Help, what should i do?!

  • @baslinjames7714
    @baslinjames7714 Před 4 lety

    Can i use softwareserial if i want to send data from nodemcu to any othet microcontroller eg. Stm32f103c8

  • @icjay1793
    @icjay1793 Před 10 měsíci

    i have pms sensor and i have data on arduino but i want to send to nodemcu to use esp8266 to send data on application it its possible?

  • @candrasniper3404
    @candrasniper3404 Před 2 lety

    So, it's more safe if we do from nodemcu to arduino than from arduino to nodemcu.

  • @baburamchaudhary159
    @baburamchaudhary159 Před 7 měsíci

    what about parsing the sent string and further send to cloud like Blynk.

  • @leonardchung9729
    @leonardchung9729 Před 2 lety

    Does it also work with ESP Wroom 32?

  • @firstfokers
    @firstfokers Před 2 lety

    why does it need 10k resistor to dht22?

  • @nelsonortega9340
    @nelsonortega9340 Před rokem

    HI, i flashed by error the arduino while tx was connected to rx, and now nodemcu is not recognized, can someone help me?

  • @isaacgahou8514
    @isaacgahou8514 Před 4 lety +1

    Good

  • @anasbee1472
    @anasbee1472 Před 2 lety

    What's that?
    What do we can do if we need native USB

  • @jordycarloscarrionlojan7614

    Puede enviar datos desde un NodeMCU hacia otro NodeMCU??

  • @spandanroy9273
    @spandanroy9273 Před 3 lety +1

    The arduino uno cable and Nodemcu cable are same? Or both are different data cable?
    Please reply, all clear by this video, only one doubt

  • @jeremytiempo9639
    @jeremytiempo9639 Před 2 lety +1

    How can i declare string variable to arduino uno? Ex . Nodemcu>>arduino where t= is the temperature

  • @monzerkidda
    @monzerkidda Před 3 lety

    can Send Data From Arduino to NodeMCU and NodeMCU to Arduino Via Serial in the same time and same code ?????

  • @giseric3249
    @giseric3249 Před 3 lety +1

    Use 2 diode In series to reduce 5v to 3.3v

  • @annachapmann
    @annachapmann Před 3 lety +3

    In order to work with the divider, you need to swap pin 5 and 6

  • @aruneshkumarsagar
    @aruneshkumarsagar Před 2 lety

    When we are sending Data from NodeMCU to Arduino , Is their Anyway to Store the Received Data On Arduino Side ??

  • @lokeshsaravanan5274
    @lokeshsaravanan5274 Před 3 lety

    You displayed 9600 baud rate for arduino and node mcu. Is 9600 baud rate is enough for both arduino and node mcu becoz both are working at different baud rates arduino works at 9600 and node mcu works at 115200 pls anybody knows reply me.

    • @firstfokers
      @firstfokers Před 2 lety

      just try with 9600, cause it works with both arduino and nodemcu

  • @zakimukhammad2375
    @zakimukhammad2375 Před 3 lety

    can we send data from arduino to nodemcu and nodemcu to arduino at the same time?

  • @darkieffllbs.1623
    @darkieffllbs.1623 Před 3 lety +1

    Who will provide the code

  • @meleeset
    @meleeset Před 3 lety

    this serial communication from arduino to nodemcu, right?
    how about serial communication from nodemcu to arduino?, please help me

    • @candrasniper3404
      @candrasniper3404 Před 2 lety

      Lihat videonya sampai selesai, jangan cuma baca judulnya atau lihat thumbnailnya.

  • @kaalesaaye4261
    @kaalesaaye4261 Před rokem

    Hello
    Whoever reading this please reply if you can. I want to connect 2 nodemcu with Arduino UNO and they both are sending data to the Arduino. But within some time period data is lost of any one of the nodemcu plz help me out with this. I am using software serial and Arduino json libraries. If u have any simpler technique that can be successful please share....

  • @CVideo2014
    @CVideo2014 Před 2 lety

    I have a problem,how to send data from NodeMCU to NodeMCU?

    • @HakkiOgrt
      @HakkiOgrt Před 2 měsíci

      wifi bridge ile sanırım

  • @adilabusafa
    @adilabusafa Před rokem

    يتعذر التعليق لا أعلم .

  • @drivelur8016
    @drivelur8016 Před 2 lety

    it was helpful. thanks