Project without digital ocean?

How can i do the project Sending an SMS when Temperature Crosses Threshold without using digital ocean droplet, and how can i do with repl.it?

Hi @223j5a4205

Yes, you can sure do the achieve this without using digital ocean droplet and instead use Repl.it. Please do checkout the “Repl.it as an alternative to digital Ocean” topic from the training content. Proper instructions are given on how to you use Repl.it and build the projects.

If you still face any issues, please feel free to get back to us.

can you please send me the instructions to complete the Sending an SMS when Temperature Crosses Threshold project using repl.it?

Hi @223j5a4205

Here are the complete instructions to send an SMS alert when Temperature Crosses Threshold project using repl.it:

  1. Do the hardware connections as shown in the training content.
  2. Create an account on www.twilio.com. Verify your email id and password. Next follow the steps provided in the Twilio section in the training content. Note down the Twilio phone number, account SID and authorization token .
  3. Create an account on replit.com and create new a repl, select python as the programming language.
  4. Next in your Repl.it code editor, create 2 files: main.py( which will be created by default) and conf.py.
  5. Write the following code in main.py and conf.py and run the project. Make sure to replace your phone number, Twilio number, account SID, auth token, Bolt API key and Bolt device ID corretly in conf.py file

Write the below code in main.py file:

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']))
    try: 
        sensor_value = int(data['value']) 
        Temperature=(100*sensor_value)/1024 
        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)
    time.sleep(10)


Write the below code in conf.py file:
Make sure to replace the text inside this quotes(’ ') with the actual credentials.

SID = 'You can find SID in your Twilio Dashboard' 
AUTH_TOKEN = 'You can find  on your Twilio Dashboard' 
FROM_NUMBER = 'This is the no. generated by Twilio. You can find this on your Twilio Dashboard'
TO_NUMBER = 'This is your number. Make sure you are adding +91 in beginning'
API_KEY = 'This is your Bolt Cloud accout API key'
DEVICE_ID = 'This is the ID of your Bolt device' 

Done. Now just run the project, you should be able to get SMS alerts when temperature crosses the threshold. If you are not getting alerts, try changes the threshold values in the main.py file and run the code again.

If you still face issues, please feel free to get back to us.

It’s working. Thank you so much

1 Like