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 LCDFor 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 SensorYou can follow this tutorial to get it working. Remember to try the template code.
STEP 4: Connect ESP8266 to Firebase to Send & Receive DataIn 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.
Comments
Please log in or sign up to comment.