กลับไปหน้ารวมไฟล์
send-sensor-data-from-one-arduino-to-another-using-firebase-85e25c-en.md

OVERVIEW:

In this cool IoT project, you read data from a humidity and temperature sensor connected to one Arduino UNO. Send this data to Firebase using an esp8266 module and then download the data in another Arduino UNO using an esp8266, to finally display it onto an LCD.

STEP 1: Understand how Arduino UNO and ESP8266 work together.

Note that they work as two different boards and have different codes. You use the Arduino UNO to communicate with the ESP8266. Understand that you are not connecting the Arduino to the internet, you are connecting the ESP8266 to the internet You can later send data between the two boards via the Serial terminal.

STEP 2: Connect one Arduino to the LCD

For this part, you can use either I2C communication as we did or normal communication. I2C is always better. Try the example code they present there.

NOTE THAT WE USED A 20x4 LCD. CHANGE THE CODE IF NECESSARY.

STEP 3: Connect the other Arduino to the DHT11 Sensor

You can follow this tutorial to get it working. Remember to try the template code.

STEP 4: Connect ESP8266 to Firebase to Send & Receive Data

In this tutorial, they explain very well how to set it up.

Follow this step-by-step video. They connect a NodeMCU to the ESP8266 but you can use the same connections to the Arduino UNO.

As for advice, I would suggest you create a google sheet or excel with the colours you are using for the ESP8266 so you don't get confused.

GO TO THE ERROR PART AT THE END IF IT DOESN'T WORK. ALSO, CHECK THE COMMENTS ON THE TUTORIAL.

STEP 5: Understand how Serial Communication works.

In this tutorial they send other sensor data to firebase, you can read it to get an idea of how it works or even try it out.

YOU SHOULD ONLY PRINT THE DESIRED STRING ON THE SERIAL MONITOR, ANY OTHER PRINT LINE WILL INTERRUPT THE COMMUNICATION.

STEP 6: Upload the code.

Now that you know how to upload and receive data, you can upload the actual code to the esp8266s connected to the Arduinos and the Arduinos. Refer to step 4 on how to upload code.

READ THE CODE BEFORE UPLOADING AND MAKE ANY NECESSARY CHANGES.

COMMON ERRORS AND ADVICE:

ALWAYS DISCONNECT THE ARDUINO CABLE BEFORE DISCONNECTING ANY WIRE.

Code not uploading to ESP8266:

  • Select the esp8266 generic board.
  • If the code is still not uploading and giving you an error do this.
  • If still not working unplug, reconnect, try to upload and then try the previous solution again.

Code not uploading to Arduino UNO:

  • Read carefully how to upload code to Arduino UNO in this documentation, step 7.
  • Take out GPIO-0 (IO0) from GND and Arduino Uno RESET Pin from Uno's Ground/GND Pin.
  • Remove ESP8266 RX pin from UNO's RX pin and ESP8266 TX pin from UNO's TX pin.
  • Re-check your pins, select Arduino UNO board.

Not working after uploading both codes:

  • Connect the ESP8266 RX pin to Uno's TX pin and ESP8266 TX pin to Uno's RX pin. Yes, you have to connect them oppositely. Don't ask me why. Just do it.
  • Disconnect the ESP8266 GPIO-0 (IO0) from GND.
  • Re-check your pins
  • Make sure you are only printing the values you want to share between the Arduino and the ESP8266 in the Serial Monitor. If you print things like "connected" or any other thing the code will not work.

NOTE:If you get it to work and the LCD prints something weird it should fix it after a few secondswiththeinitializefunction. This may occur due to Serial communication delays.

EXPANDED TECHNICAL DETAILS

Real-Time Cloud Data Routing

This project demonstrates the power of a "Serverless" backend for connecting remote IoT devices anywhere in the world.

  • Firebase Realtime Database Hub: Two independent ESP8266/ESP32 modules connect to a common Google Firebase project. The "Sender" node pushes a JSON packet (e.g., temp: 24.5) to a database reference.
  • Automated Event Subscriptions: The "Receiver" node uses a Firebase StreamListener. As soon as the data changes on the Firebase server, the database "Pushes" the new value to the receiver Arduino in milliseconds.

Multi-Node Scaling

  • Global Mesh Potential: Because it uses the cloud rather than local WiFi, the two Arduinos can be in different cities or countries while still maintaining a near-instant data link for remote telemetry or control.

ข้อมูล Frontmatter ดั้งเดิม

title: "Send sensor data from one Arduino to another using Firebase"
description: "Connect two Arduinos via Firebase real-time database to send sensor data from one and display it onto an LCD in the other one."
author: "rene123456"
category: "Internet of Things, BT & Wireless"
tags:
  - "iot"
  - "iot"
  - "firebase"
  - "esp8266"
  - "internet of things"
  - "esp8266"
views: 23233
likes: 5
price: 699
difficulty: "Intermediate"
components:
  - "2x Breadboard (generic)"
  - "2x ESP8266 ESP-01"
  - "1x I2C 16x2 Arduino LCD Display Module"
  - "2x Arduino UNO"
  - "1x Male/Female Jumper Wires"
  - "1x DHT11 Temperature & Humidity Sensor (3 pins)"
tools: []
apps:
  - "1x Arduino IDE"
  - "1x Firebase"
downloadableFiles:
  - "https://projects.arduinocontent.cc/32d50ade-6c39-42d6-b007-2d8307627184.ino"
  - "https://projects.arduinocontent.cc/32d50ade-6c39-42d6-b007-2d8307627184.ino"
documentationLinks: []
passwordHash: "55151348089b540b3f4dae828e7bb7b0433d66496e0753ac622d6ba6aef1acb2"
encryptedPayload: "U2FsdGVkX19WlOzyB4g4SbJE9dYbjzQFSP+ivfFccFQaUiY8WHQqzlY3H6h2C0HTIpyr69zX9za6e9Jfh0hJg9K+LpZucBrA/iwJBPnNP0VMUl1Uo0OPdRJGEGEcfw2J"
seoDescription: "Learn how to send Sensor data between two Arduinos using Firebase real-time database and display it on an LCD."
videoLinks:
  - "https://www.youtube.com/embed/lzgT1sYV6Ig"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/send-sensor-data-from-one-arduino-to-another-using-firebase-85e25c_cover.jpg"
lang: "en"