Problem with temperature detecting system. (Problem in sending SMS )

pls see the above images carefully.

even though the requirements to send sms for LM35 sensor by twilio is complete, but still the sms is not being sent and it is showing the error message.

as far as I think the code is all right but still it is failing to send SMS pls assist me in this .
and pls check the hardware setup carefully too .
my mobile number is also active and able to receive sms messages.

I am using Rep-lit to write the python code, and I am using a Windows 7 Ultimate, computer, and using Twilio for SMS messages.

pls help me. Your experience and knowledge will be greatly acknowledged.

Hi @prithwis1201,
you are writing all the codes in,
but you have to create two python files that are and
In you need to mention the SID,AUTH_TOKEN and so on upto DEVICE_ID
In you need to place the remaining code
If you still facing any issue, feel free to ask

Ok I will try. I had been doing this in replit. That’s why , I had done it, like that.

Hi @prithwis1201

The reason you are not getting sms alerts is because you have not defined the required credentials in the python code. Below is the correct method to excute this project.
Create 2 files - which will have the logic of the program. And second file is which will have all your credentials. Here is the code:

import conf
from boltiot import Sms, Bolt
import json, time

minimum_limit = 300
maximum_limit = 600  

mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID)
sms = Sms(conf.SID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER)

while True: 
    print ("Reading sensor value")
    response = mybolt.analogRead('A0') 
    data = json.loads(response) 
    print("Sensor value is: " + str(data['value']))
        sensor_value = int(data['value']) 
        print("The temperature is",Temperature)
        if sensor_value > maximum_limit or sensor_value < minimum_limit:
            print("Making request to Twilio to send a SMS")
            response = sms.send_sms("The Current temperature sensor value is " +str(sensor_value) + " and the temperature is " + str(Temperature))
            print("Response received from Twilio is: " + str(response))
            print("Status of SMS at Twilio is :" + str(response.status))
    except Exception as e: 
        print ("Error occured: Below are the details")
        print (e)

SID = 'put your actual SID from twilio website' 
AUTH_TOKEN = 'put your actual Authorization token from twilio website' 
FROM_NUMBER = 'Enter your from no. This you will get from Twilio website'
TO_NUMBER = 'This is your mobile no. Enter +91 in the beginning'
API_KEY = 'This is your Bolt API Key'
DEVICE_ID = 'This is your Bolt device id. Example: BOLT1234' 

Make sure to replace all the credentials properly. Please try this and do let us know. If you still find any issues, please feel free to get back to us.

1 Like


it is not sending any type of SMS it is only showing the temperature. pls assist me in this and tell me if there is any defect in the code or in the hardware setup. I am again informing you that I am using windows 7 ultimate PC

Hi @prithwis1201

Since the sensor value is 321 and the minimum value set is 300, it is not triggering the sms alert. Please change the minimum value to 400 on line no. 5 and run the code. This will give you the twilio sms alert.

1 Like

Ok I will check that and Inform you upon it

Hello @sneharsh.kerkar
I am really grateful to you for solving my issue.
thank U veryyyyy much. It is working perfectly fine now.
keep up the good work.
:smiley: :smiley: :smiley: :smiley: :smiley: :smiley: :+1: :+1: :+1: :+1: