Introduction
IntroductionSo automation has already made our life more comfortable in the industrial sector, so why not implement and make out home a more comfortable place to live? Maybe a place where you don’t have to turn off the lights in case the room is too bright or turn on the lights when the room is too dark. Or controlling the charging of one’s phone/Electric vehicle(EV) when the battery and cost of electricity are low or filling the overhead water tank so that you don’t have to think of it continuously? Yeah in short making you, or at least myself a bit lazier.
So that is what this project tries to implement. It is a prototype for Real-time controlling of an indoor lighting system, monitoring of light temperature and electricity cost, energy calculation and monitoring and alert system in case the energy suddenly rises or the price is too high.
Check out the working and explanation in the video below. I know it is too long, like 20 minutes ugh, but unfortunately, the system is also really elaborate. You can watch it at 1.25 speed if you can follow.
Hardware:Upload the Arduino code using the cable and connect the USB to a power bank or a port for power. Connected the USB in the diagram also in a port or power bank for power. No need to supply separate power to the bolt module.
After uploading the code check if all devices working properly including LCD, KeyPad, LDR, temperature sensor, and LED array. Don't connect heavy load in place of theLED array as it may damage the transistor. Use a MOSFET or Motor driver circuit instead. Check if serialBegin command is working properly by clicking on serial monitor tab in Arduino interface.
Next check the bolt connections, relay, micro USB, motor and SPST switch. Use spst switch instead of a sensor as mentioned in the video.
If all good run then creates a text file in the same directory as all other programs named "bolt_data.txt" and run live_data_from_bolt.py file. Check for at least 5 reading if the bolt is receiving the information correctly.
Next, create a text file named "cost.txt" and run web_scraping.py code. again check for at least 5 readings.
After that run the "live_monitoring.py" and "controlling.py" script. See if the energy graphs are good. If the electricity cost is less than 30 and the input at bolt pin 1 is +5v then the motor is should operate and the mobile should charge.
Finally, run the anomaly detection mail by updating your cat in email_conf.py file.
You can check the .fzz file as well for convinience
LCD values
The below figure shows the changes in electricity price for one day. The time below is not California time but a rather Indian standard you can subtract it by 12:30 to get the California time.
Web scraping algorithm is used to get the electricity price in real-time.
The next scrip gets the light, cost and temperature values and makes a line graph for the user to monitor. The graph is refreshed every 30 seconds as the new data is entered.
The cost of electricity is capture and displayed by the controlling script. The controlling scrip also compares the current electricity cost and marginal electricity cost and then charges the battery or fills the water tank in case the sensor reading is 1 (i.e. the EV or water tank is not full).
Z-core is calculated in the anamoly detection script using the below formulas and identify sudden increase in energy consumption.
Twilio and mail gun is used to send SMS and mail alert in case the cost of electricity is very high, or there is a sudden increase in energy consumption.
The video below explains the detailed block diagram explanation of the project you can check it out in case you want to understand the project in more detail.
The only drawback of this project is that in case the machines turn against humanity you might be at a very high-risk :p
Comments