Things used in this project


Arduino + Raspberry Pi
Fritzing Diagram


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

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


David Escobar

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

Thanks to AdrieSentosa.


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


Similar projects you might like

Arduino - Have Fun with Color Sensor
  • 517
  • 11

Full instructions

This project shows how to change color of Minion using Arduino, PHPoC WiFi Shield and color sensor.

Arduino - Web-Based Thermometer
  • 647
  • 11

Full instructions

This project allows you to check temperature at home from anywhere using web browser.

Electronic Voting Machine Using Arduino
  • 157
  • 5

It is an EVM using Arduino. There are five switches in all, assigned for various activities.

Setting Up Your Pi Cap on the Raspberry Pi 1, 2 or 3
  • 69
  • 2


Follow this tutorial to set up your Pi Cap with a Raspberry Pi 1 A+/B+, Raspberry Pi 2 or Raspberry Pi 3.

Setting Up Your Pi Cap on the Raspberry Pi Zero
  • 76
  • 2


Follow this tutorial to set up your Pi Cap with a Raspberry Pi Zero.

Using Python and Arduino MKR1000 for Secure IoT
  • 1,858
  • 10

Full instructions

Getting started with Python and Arduino MKR1000 for secure IoT projects.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login