1) The LDR sensor keeps reading the value of the light intensity in the room.
2) The maximum value the sensor can read is 1024. Which means that the lights are ON.
3) So you can set the maximum_limit to about 1000 to make sure that the BOLT module respond by sending you an email using MAILGUN, that the lights are ON.
4) If the lights are OFF it does the same thing. The minimum_limit can be set according to your will. I have set it to 500.
5) So if the sensor value becomes less then 500 it will again inform you by sending you an email that that the lights are OFF.
6) If the lights are OFF it automatically turn ON the lights (In this case I used the LEDS to show the working ).
This is the whole working of the project.
It is very important to have a mailgun account. The instructions are given belowCreating an account on Mailgun
Step 1: Open https://www.mailgun.com/ in browser.
Step 2: Click on
Step 3: Fill all the necessary details in SIGN UP form. Make sure you are unchecking the payment option. Below is the screenshot of filled sign up form.
Step 4: You will get a verification mail having a link. Click on that link to verify your mail.
Step 5: To verify they will ask for phone number. Choose India as an option in the dropdown and then enter your phone number.
Step 6: After verification, scroll down to
Sandbox Domain section. Click on
Add Recipient button.
Step 7: Click on
Invite New Recipient button.
Step 8: Enter the Receipient Email ID. In this case enter your Email ID.
Step 9: After adding Email ID a new sandbox will be generated. Click on the ID of the newly generated sandbox. Refer below image for the same.
Step 10: The new screen will have all the necessary credentials that you want for sending an email. Copy all this credentials and save in the notepad.
That's it. You have successfully created the account on Mailgun. In the next lesson, we will use Bolt Python library to create our own Email Alert system.