This project will monitor the temperature in the cold storage unit for food industry by using LM35 temperature sensor. A predefined threshold temperature value for the cold storage unit is set by the operator. The current values are displayed on the monitor with the help of PyCharm software. If the threshold temperature is crossed, an SMS alert is sent to the user via Twilio along with the value of the current temperature reading of the storage unit. Also, lighting of an LED and the buzzing sound from the buzzer alert people or operator around. The data sent by the temperature sensor is stored in the Bolt Cloud which help to make temperature predictions with time using machine learning. Z-Score analysis helps to detect any sudden changes in temperature.
CIRCUITCONNECTIONS
1. LM 35 temperature sensor is the main unit of this project. LM35 sensor gives analog input to A0 pin. Bolt has built in analog to digital convertor (ADC) which converts this analog value to digital value. Then this digital value is sent to Bolt Cloud.
Hold the LM35 sensor such that the flat face of the sensor which has LM35 text written on it, is facing towards you. In this configuration, left pin is VCC, middle pin is V output and right pin is ground pin.
Connect LM35 sensor on the breadboard. Male/male jumper wires are used to connect VCC to the 5V pin of Bolt wifi module, V Output to the A0 pin and ground pin of LM35 to the ground pin (GND) of Bolt wifi module.
2. Shorter leg of LED is connected to GND pin on breadboard while longer leg is connected to one end of the 330ohm resistor in series. The other end of the resistor is connected to GPIO (general purpose input / output) pin 1 using male/male jumper wire.
3. Longer and shorter leg of Buzzer is connected to GPIO pin 4 and GND pin respectively using male/male jumper wires.
4. Finally, connect Bolt wifi module to a laptop/pc/charger using USB-A to Micro-USB cable for powering up.
COMPLETE CIRCUIT
Setting Up ProductOnBolt Cloud
1. Visit https://docs.boltiot.com/docs/setting-up-the-bolt-wifi-module to setup Bolt wifi module.
2. Visit https://cloud.boltiot.com/. Here, you will find your Bolt API key and Bolt Device ID. Save it.
3. Go to PRODUCTS and make a new product, name it and select options as shown below and then click DONE.
4. Go to CONFIGURE and then setup the hardware and write the code for predicting temperature and then save it.
5. Link the product to the device and deploy configuration.
Visit https://docs.boltiot.com/docs for more information (if needed).
MAKE TWILIO ACCOUNTTwilio is a third-party SMS functionality provider. It is a cloud communications platform as a service (PaaS) company. Twilio allows software developers to programmatically make and receive phone calls and also send and receive text messages using its web service APIs.
1. Visit https://www.twilio.com/. Sign up using your mail ID and other details given on the page. Then Twilio will send a verification mail on your mail ID which has to be verified.
2. Then give the mobile number on which OTP will be send for verification.
Now, your are onboarded. Answer a few questions as shown below.
3. For coding, choose 'Yes'. Then choose your preferred coding language. I choose PYTHON. For the goal, choose 'Use Twilio in project'. For messaging, choose from the options given below. I chose SMS for my project.
4. Now, go to Twilio Dashboard and choose the option which will give a TRIAL NUMBER. Choose that number. This number will communicate with you.
5. Finally, you will get your Account SID, Auth Token, your mobile number and trial number available on Twilio Dashboard. save it.
PyCharm is an integrated development environment (IDE) used in computer programming, specifically for the Python language. It is developed by the Czech company JetBrains.It provides code analysis, a graphical debugger, etc. and supports Data Science with Anaconda. PyCharm is cross-platform, with Windows, macOS and Linux versions.
1. Download PyCharm by visiting http://www.jetbrains.com/pycharm/ and click DOWNLOAD (shown in black). Then select the type of OS you have and then download either OPEN SOURCE (COMMUNITY) which is completely free or PROFESSIONAL which is for free trail. I took open source. Then click Download button and wait for it to download.
2. When it gets downloaded. Double click the file stored on your computer. Then follow the steps shown in the images below to install PyCharm.
3. Click NEXT. Select the folder where you want to install PyCharm. Select 64 bit launcher. Create a folder with name 'JetBrains'. Wait for PyCharm to install.
4. Click FINISH once installed. Click OK for 'Do not import settings'. Accept the terms and con5.ditions shown. Finally, click on 'Don't send'.
5. Now, open PyCharm. Select the screen colour DARCULA or INTELLIJ. Skip the next step (If you want, you can install UI themes as also). Then, wait for PyCharm to load. Then select the option CreateNewProject. Then give a name to your project. Make a new file as shown below and name it. Then you can start with your coding.
Z-scoreanalysis is used for anomaly detection i.e. anything outside of normal. When temperature increases or decreases suddenly, it is called anomaly and Z-score analysis detects this. Upper and lower bounds are found out using multiplication factor, frame size and input values from LM 35 sensor.
Mn is the mean of input data collected. Vi is the variance, r is the frame size i.e. number of input data points collected. I have collected 5 data points. C is the multiplication factor which is taken as 3 in my project. Tn gives the upper and lower threshold depending on + and - respectively in the formula shown.
WORKINGLM 35 sensor collects data every 5 minutes and sends it to Bolt Cloud.
I placed the setup in open for getting normal temperature. Then I put the setup in cold area quickly so that temperature decreases suddenly.
Then again, I placed the setup in open for normal temperature. Then, I took the setup in a hot area quickly so that temperature rise is quick.
The code checks if the temperature is within threshold limits or not by using data from LM 35 sensor. If it isn't in the limits, then Twilio sends the message on our mobile regarding threshold getting crossed.
The code also checks if there is sudden change in temperature (increase or decrease) beyond the upper and lower bounds. If there is, then Twilio sends the message on our mobile regarding sudden change in temperature.
Prediction graphs gets plotted using data from LM35 sensor to predict temperature in near future using machine learning. Sudden changes were made to temperature values to see the affect on the prediction.
The detailed explanation of code is given along with the code itself.
PREDICTIONGRAPH
PredictedPoints shows number of future data points of temperature taht need to be predicted. No. of Polynomial Coefficients (value of n) indicates how many coefficients or elements should be present in the function. Number of polynomial coefficients decide the nature of predict history graph (shown in red). This graph gets plotted based on the nature of actual graph (shown in blue) and no. of polynomial coefficients. It helps to tune the machine learning model. Frame size indicates how many points on actual graph should be taken into consideration for plotting predict history graph. Predicted Graph (shown in blue) shows the value and nature of future data points and graphs respectively. The 3 parameters shown in the figure have to changed and set such that predicted data most closely imitates the actual data. This lead to future data being most accurate.
CodedOutputRegardingThresholdCrossing and Sudden Decrease in Temperature
MessageRegardingThresholdCrossing and Sudden Decrease in Temperature
CodedOutputRegardingThresholdCrossing and Sudden Increase in Temperature
MessageRegardingThresholdCrossing and Sudden Decrease in Temperature










_0RxmbJLBlD.png)


Comments