I'm looking for help with connecting my Arduino Uno R3 to the IoT cloud. I'm collecting temperature data that I wish to send to the cloud. Can anyone tell me if I need a wifi module connected to the Uno board and if so can someone recommend me one and perhaps give me guidance on the code and how to set it up? I'm completely new to arduino and coding and so far have managed to cobble together my project using bits of code I've found in other projects online.
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
const int SENSOR_PIN = 13; // Arduino pin connected to DS18B20 sensor's DQ pin
OneWire oneWire(SENSOR_PIN); // setup a oneWire instance
DallasTemperature tempSensor(&oneWire); // pass oneWire to DallasTemperature library
LiquidCrystal_I2C lcd(0x3F, 16, 2); // I2C address 0x3F (from DIYables LCD), 16 column and 2 rows
float tempCelsius; // temperature in Celsius
float tempFahrenheit; // temperature in Fahrenheit
void setup()
{
Serial.begin(9600); // initialize serial
tempSensor.begin(); // initialize the sensor
lcd.init(); // initialize the lcd
lcd.backlight(); // open the backlight
}
void loop()
{
tempSensor.requestTemperatures(); // send the command to get temperatures
tempCelsius = tempSensor.getTempCByIndex(0); // read temperature in Celsius
Serial.print(tempCelsius); // print the temperature in Celsius
Serial.println("°C");
lcd.clear();
lcd.setCursor(0, 0); // start to print at the first row
lcd.print("CONCRETE TEMP:"); // print concrete temp wording
lcd.setCursor(0, 1); // start to print at the second row
lcd.print(tempCelsius); // print the temperature in Celsius
lcd.print((char)223); // print ° character
lcd.print("C");
delay(1000); // read temperature once every 15 minutes which is 900000 ms
}
