greg
Published © GPL3+

Connecting to the Arduino IOT Cloud (S1.2)

Connecting your Arduino to the Arduino IOT Cloud and display the temperature on the Cloud.

BeginnerFull instructions provided4,552
Connecting to the Arduino IOT Cloud (S1.2)

Things used in this project

Hardware components

Arduino MKR1000
Arduino MKR1000
×1
Breadboard (generic)
Breadboard (generic)
×1
Temperature Sensor
Temperature Sensor
×1

Software apps and online services

Arduino IoT Cloud
Arduino IoT Cloud
Arduino Web Editor
Arduino Web Editor
Arduino Create Agent (plugin)

Story

Read more

Schematics

temp-fritz_bb-anot_UzFhkbrA4I.jpg

Code

Snippet 1

Arduino
Temperature Sensor variables
// Temperature Sensor variables
int sensorPin = A0;       // Sets A0 as the input pin for the sensor
int sensorValue = 0;      // initialise a variable to store the value coming from the sensor
int Dres = 1024;          // set max 10-bit digital value
int VCC = 3300;           // set VCC voltage milliVolts
int offset = 500;         // set tolerance of 500 milliVolts
int scaling = 10;         // set the voltage scaling at 10mM / deg C
float voltage = 0.0;      // set the initial voltage to 0

Snippet 2

Arduino
Board setup instructions
  // Set 10bit read resolution
  analogReadResolution(10);

Snippet 3

Arduino
Main program code
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  Serial.print("sensorValue = ");
  Serial.print(sensorValue);

  // Calculate the voltage
  voltage = sensorValue * (VCC/Dres); // milliVolts
  Serial.print(" voltage = ");
  Serial.print(voltage);
  Serial.print(" VCC = ");
  Serial.print(VCC);

  // Calculate the temperature
  temperature = (voltage - offset ) / scaling;
  Serial.print(" temperature(C) = ");
  Serial.println(temperature);

  delay(1000);

Project Repository

Credits

greg
0 projects • 2 followers
Contact

Comments

Please log in or sign up to comment.