Things used in this project

Schematics

Arduino + Raspberry Pi
Fritzing Diagram

Code

Arduino IDEArduino
upload to Arduino IDE
/*
 * Project: Temperature Reading and uploading value to Ubidots
 * Created by: David Escobar
 */


 const int analogTemp = A0; //temperature input pin


 void setup()
{
  //start serial communication
  Serial.begin(9600);
}

void loop()
{
  int tempRead = analogRead(analogTemp); //read analog value
  float voltage = (tempRead/1024.0) * 5.0; //convert to voltage
  float tempC = (voltage - .5) * 100; //convert voltage to celsius
  float tempF = (tempC * 1.8) + 32; //convert to fahrenheit
  Serial.println(tempF); //print value to serial port
  delay(10000); //wait 10 seconds before new reading
}
Python CodePython
Python serial connection, and uploading to Ubidots
import serial

from ubidots import ApiClient

print("Program Started")

api = ApiClient(token ='Insert your API token here') #update token

my_temp = api.get_variable('Insert your variable token here') #update variable ID

ser = serial.Serial('/dev/ttyACM0', 9600) #update with port for Arduino

while True:
    read_serial = ser.readline()
    tempReading = (float(read_serial)) #convert to float 
    new_value = my_temp.save_value({'value': tempReading})
    print(read_serial) #prints serial reading to python

Credits

4bc432f479e194e9215a893dc3ae0bc0
David Escobar

Healthcare Simulation Specialist. 9+ years in healthcare.I have been actively involved with 3D printing and electronics for the past 2 years

Contact
Thanks to AdrieSentosa.

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Water Softener
Easy
  • 80
  • 4

Full instructions

Sweeping frequency magnetic hard water conditioner

Know the temp of your home from anywhere with Arduino Cloud!
Easy
  • 177
  • 4

Full instructions

Ever wanted to know the temp of your home from somewhere? Here's an easy way to do it with Arduino Cloud and the Yun Shield!

Safe City: A Device to Keep You Safe
Easy
  • 345
  • 6

Full instructions

The device will keep you safe. Just have to click a button and your precise location will be shared.

Test Your Internet Speed Using a Raspberry Pi + Ubidots
Easy
  • 233
  • 4

Protip

Use your Raspberry Pi to measure any internet connection speed with Ubidots.

Chicken Coop Livestream
Easy
  • 2,242
  • 7

Full instructions

We have two chickens, and their coop is located at the back of the garden. I decided to build a Pi-based streaming device to check on them.

Connect Your Thinxtra Xkit Using Sigfox
Easy
  • 110
  • 2

Protip

Learn how to build an IoT application over Sigfox integrated with Ubidots - send temp readings based on motion sensors.

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaFree StoreBlog