Wi-Fi Module
About this section, we are showing how to use the Wi-Fi module in arduino.
Motivation
In order to send data to firebase, we use Wi-Fi module to upload it.
Experiments
- Purpose
- We need to send data from one sensor to another one. We would like to send the Arduino sensor data to Wi-Fi module, and send the Wi-Fi time data to Arduino.
- Method
- We use Arduino TX to send sensor data to Wi-Fi RX, then upload data to database. And we use Wi-Fi TX to send time data to Arduino RX, then print it on LCD.
- Precaution
- Because we cannot send data by float, so we need to separate the data before and after the decimal. For instance, 25.35 may be send by 25 and 35. Then merge it on another sensor. For instance, 25.35 may be merged by 25 + 0.01 * 35
- Result
- We send an array which is 25.35、26.56、27.54 from Arduino to Wi-Fi module. And we let the Wi-Fi module Serial to print the data which are send separately. Then we merge the data to what it should be originally.
- We check the format of the header and end of the packet and also check if there are 6 values in each packet. If it had, we translate the contents of the packet into pH value, temperature and CO2 concentration, and upload the translated result to the cloud.
- Materials used
- Arduino UNO
- Wi-Fi module (NodeMcu)
- Arduino Code
Wi-Fi Code
Wiring