Abhishek V
Published © MIT

Room temperature monitor using Google Assistant

Automate LM-35 Temperature sensor with boltIOT and Google Assistant trigger to get the current room temperature.

BeginnerFull instructions provided1 hour1,722
Room temperature monitor using Google Assistant

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
LM-35 Temperature sensor
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×3
Micro-USB to USB Cable (Generic)
Micro-USB to USB Cable (Generic)
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
WayScript

Story

Read more

Schematics

LM-35 sensor Circuit diagram

Circuit diagram for the LM-35 temperature sensor

Code

bolttemp.py

Python
from boltiot import Bolt
import json, time

API_KEY = 'YourBolt_API_Key'
DEVICE_ID = 'Your Bolt_Device_Id' 
mybolt = Bolt(API_KEY, DEVICE_ID)

response = mybolt.analogRead('A0')
data = json.loads(response) 
if str(data['value']) == 'Device is offline':
    print("Device is offline ")
    outputs[ 'MessageBack' ] = 'Device is offline \n Make sure device is powered on and connected to a stable power source'
    
else:
    sensor_value = int(data['value'])
    temp =  round(((100*sensor_value)/1024),1)
    print ("The current room temperature is", temp, "degrees celsius")
    outputs[ 'temperature' ] = 'The current room temperature is ' + str(temp) + ' degrees celsius'
    
    if temp >= 30 and temp <= 40:
        print ("Turn on the fan/Ac")
        outputs[ 'MessageBack' ] = 'Turn on the fan/AC'
    elif temp >= 18 and temp < 30:
        print ("Enjoy the natural winds !!!")
        outputs[ 'MessageBack' ] = 'Enjoy the natural winds !!!'
    elif temp >= -10 and temp < 18:
        outputs[ 'MessageBack' ] = 'Turn on the heaters'
    else:
        outputs[ 'MessageBack' ] = 'Please diagnose the temperature sensor'

Credits

Abhishek V

Abhishek V

1 project • 1 follower

Comments