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

Поділитися
Вставка
  • Опубліковано 4 тра 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 UA-cam 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());
    }
    }
  • Наука та технологія

КОМЕНТАРІ • 49

  • @luistimana2393
    @luistimana2393 2 роки тому +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

  • @leonardchung9729
    @leonardchung9729 2 роки тому

    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.

  • @HakkiOgrt
    @HakkiOgrt Місяць тому

    thanks for the simple understandable video, subbed

  • @shehabxcode
    @shehabxcode 3 роки тому +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.

  • @friendyprasetiawan05
    @friendyprasetiawan05 3 роки тому

    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?

  • @user-ko1uz4lg1v
    @user-ko1uz4lg1v 3 роки тому +1

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

  • @ouafaebouamar6837
    @ouafaebouamar6837 3 роки тому

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

  • @baslinjames7714
    @baslinjames7714 4 роки тому

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

  • @yogabayuangganapratama6558
    @yogabayuangganapratama6558 4 роки тому

    Can I use Arduino 2-way communication with nodemcu?

  • @icjay1793
    @icjay1793 9 місяців тому

    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?

  • @startobytes
    @startobytes 3 роки тому +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?!

  • @nandhinijagadeesan3835
    @nandhinijagadeesan3835 Рік тому

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

  • @mazharulsabbir6768
    @mazharulsabbir6768 3 роки тому

    it was helpful. thanks

  • @baburamchaudhary159
    @baburamchaudhary159 6 місяців тому

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

  • @candrasniper3404
    @candrasniper3404 2 роки тому

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

  • @firstfokers
    @firstfokers 2 роки тому

    why does it need 10k resistor to dht22?

  • @leonardchung9729
    @leonardchung9729 2 роки тому

    Does it also work with ESP Wroom 32?

  • @nelsonortega9340
    @nelsonortega9340 Рік тому

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

  • @spandanroy9273
    @spandanroy9273 3 роки тому +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

  • @anasbee1472
    @anasbee1472 2 роки тому

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

  • @giseric3249
    @giseric3249 3 роки тому +1

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

  • @jeremytiempo9639
    @jeremytiempo9639 2 роки тому +1

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

  • @monzerkidda
    @monzerkidda 3 роки тому

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

  • @jordycarloscarrionlojan7614
    @jordycarloscarrionlojan7614 2 роки тому

    Puede enviar datos desde un NodeMCU hacia otro NodeMCU??

  • @annachapmann
    @annachapmann 3 роки тому +3

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

    • @kevinwong7608
      @kevinwong7608 2 роки тому

      Thanks !

    • @Nicholaechs
      @Nicholaechs 2 роки тому

      Can you explain why?

    • @luistimana2393
      @luistimana2393 2 роки тому

      No, the connections shown in the video are correct

    • @badillahodejul9741
      @badillahodejul9741 Рік тому

      @@Nicholaechs in the arduino code written SoftwareSerial espSerial(5, 6); which means espSerial(RX,TX)

  • @isaacgahou8514
    @isaacgahou8514 3 роки тому +1

    Good

  • @zakimukhammad2375
    @zakimukhammad2375 3 роки тому

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

  • @meleeset
    @meleeset 3 роки тому

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

    • @candrasniper3404
      @candrasniper3404 2 роки тому

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

  • @lokeshsaravanan5274
    @lokeshsaravanan5274 3 роки тому

    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 2 роки тому

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

  • @aruneshkumarsagar
    @aruneshkumarsagar 2 роки тому

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

  • @darkieffllbs.1623
    @darkieffllbs.1623 3 роки тому +1

    Who will provide the code

  • @kaalesaaye4261
    @kaalesaaye4261 Рік тому

    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 2 роки тому

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

    • @HakkiOgrt
      @HakkiOgrt Місяць тому

      wifi bridge ile sanırım

  • @adilabusafa
    @adilabusafa Рік тому

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

  • @drivelur8016
    @drivelur8016 2 роки тому

    it was helpful. thanks