Shreyash is a supervisor at company which deals with Cotton. Cotton is very sensitive to temperature, single spark can make company a big loss. Shreyash have to be alert all the time, maintaining the temperature or shifting trunks of cotton here and there. Then he found Smart Fire Alarm, he put a threshold and now his life Becomes much easier.
This project has Three main functionalities
- Sensing the temperature
- Response with Buzzer and LED
- Inform User via Text Messaging
By Clicking Start Button, LM35 starts sensing temperature. Sensed value is then converted to temperature using the formula
Temperature=(100*sensor_value)/1024
Threshold value is set manually on the users requirement. Once temperature crosses threshold value then Buzzer and LED start their working(Which is both for both workers[deaf/blind]). Beside this an SMS is also sent to user to inform about incident. After overcoming the situation times when accident happens and when this situation overs sent to user.
IV. ConfigurationCircuit Connections
Below shows the circuit connections to LM35(Temperature Sensor), LED, Peizzo Buzzer with Bolt.
As shown in circuit, GPIO pins 1, 2 are used. Connections are shown below
LM35- Temperature Sensor
- Positive Leg(Green Wire) -- 5V
- Output Leg(Yellow Wire) -- A0
- Ground(Orange Wire) -- GND
Buzzer
- Positive/Longer Leg(Blue Wire) -- GPIO 2 Through 10k Ohm Resister
- Negative/Shorter Leg(Purple Wire) -- GND
LED
- Positive/Longer Leg(Black Wire) -- GPIO 1
- Negative/Shorter Leg(Short Red Wire) -- GND
Note: Above Three components have polarity so pay good attention while circuiting.
Twilio Account
Here we have to create Twilio account first, move to twilio website you will screen as follows. Follow the link to setup Twilio account. Appearance may change but just follow text which is shown (Setup Twilio). From there you must copy following, It will be required while coding.
- SID
- Authentication Token
- Contact Number generated by Twilio
Bolt Cloud Account
You must have Bolt API key with BOLT device ID. These two things are found on Bolt Cloud, visit https://cloud.boltiot.com/, You will be asked to login, Login your account and you will see screen similar as follow.
Copy Device ID as shown below.
Copy API key from API module as shown below.
Keep these two things saved, API key and Device ID, it will be essential for our project.
Code Files
Codes for working of this project has been done in Ubuntu 18.04 There are two files on which whole project work.
- conf.py
- smart_fire_alarm.py
You must have python3
and boltiot
package. download python3 with following command.
sudo apt-get install python3
sudo apt-get install pip3
after installation of python3, install boltiot package.
pip3 install boliot
We have put conf.py file apart, which is holding all our key info which is varying account by account. This file is used to configure our main project.
The following is the configuration file (named as conf.py):
SID = "SID Provided By Twilio"
AUTH_TOKEN = "Authentication Token From Twilio"
FROM_NUMBER = "Twilio Provided Contact Number"
TO_NUMBER = "To Number you want to receive message"
API_KEY = "Bolt Api Key"
DEVICE_ID = "BOLTXXXXXX"
Temperature is collected from surrounding through LM35 from A0 pin of Bolt(A0 is used to convert analog value to digital). Code for same is below.
response = mybolt.analogRead('A0')
Threshold value is placed in code as
maximum_limit = 38.0
Here 38.0℃ is threshold value for code, as temperature rises over 38℃, Buzzer and LED start their working and SMS is sent sent to mobile number which is specified in code(conf.py) to subscriber through following code.
mybolt.digitalWrite('1', 'HIGH')
mybolt.digitalWrite('2', 'HIGH')
response = sms.send_sms("Attention !! Fire in Company")
Here 1, 2 shows respective port numbers. Port 1 is used for Buzzer, where as Port 2 is used for LED. As temperature goes down, Both(Buzzer, LED) gets OFF through following code.
mybolt.digitalWrite('1', 'LOW')
mybolt.digitalWrite('2', 'LOW')
Note: Make sure both files have in same directory.
V. WorkingBelow working descriptions are taken from referred websites, you can visit that sites by clicking [1], [2], [3]
1. Working of LM-35 [1]
There are two transistors(Q1, Q2). One has one ten times the emitter area of the other. This means it has ten times of the current density, as the same current is going through both transistors. This causes a voltage across the resistor R1 that is proportional to the absolute temperature, and is almost linear across the range.The "almost" part is taken care of by a special circuit that straightens out the slightly curved graph of voltage versus temperature.
The amplifier at the top ensures that the voltage at the base of the left transistor (Q1) is proportional to absolute temperature (PTAT) by comparing the output of the two transistors.
The amplifier at the right converts absolute temperature (measured in Kelvin) into either Fahrenheit or Celsius, depending on the part (LM34 or LM35).The little circle with the "i" in it is a constant current source circuit.
The two resistors are calibrated in the factory to produce a highly accurate temperature sensor.
The integrated circuit has many transistors in it -- two in the middle, some in each amplifier, some in the constant current source, and some in the curvature compensation circuit. All of that is fit into the tiny package with three leads.
2.working of LED [2]
The LED simply, we know as a diode. When the diode is forward biased, then the electrons & holes are moving fast across the junction and they are combining constantly, removing one another out. Soon after the electrons are moving from the n-type to the p-type silicon, it combines with the holes, then it disappears. Hence it makes the complete atom & more stable and it gives the little burst of energy in the form of a tiny packet or photon of light.
3. Working of Piezo Buzzer [3]
When an alternating voltage is applied to the piezoceramic element, the element extends and shrinks diametrically. This characteristic of piezoelectric material is utilized to make the ceramic plate vibrate rapidly to generate sound waves.
In our project Vout gives input to A0 of Bolt, As Pin A0 takes input in the form of waves, but we have to convert it into human readable format, That task has done by Bolt. A0 concerts analog signal to digital signal and shows some value (sensor_value). In code we converted that value to actual temperature. By formula
temperature = (sensor_value*100)/1024
Now through code, digital signal has sent to port 1 i.e. Buzzer and port 2 i.e. LED to get ON and simultaneously start checking temperature, if temperature become normal both port i.e 1 & 2 send 'LOW' signal to Buzzer and LED respectively.
VI. Future WorkHere I used Temperature sensor for detecting abnormal behavior of nature in particular area. To detect fire more accurately we can use smoke detector
, and in response we can trigger an event such as starting exhaust fan
until temperature becomes normal or Open knob of water tank
so that water will flow and fire will gets down.
THANK YOU !!!
Comments