Trending Technology Machine Learning, Artificial Intelligent, Block Chain, IoT, DevOps, Data Science

Recent Post

Codecademy Code Foundations

Search This Blog

Implementation of IoT with Raspberry Pi

IoT

Internet of Things
  • Creating an interactive environment
  • Network of devices connected together
Sensor
  • Electronic element
  • Converts physical quantity into electrical signals
  • Can be analog or digital
Actuator
  • Mechanical/Electro-mechanical device
  • Converts energy into motion
  • Mainly used to provide controlled motion to other components
System Overview
  • Sensor and actuator interfaced with Raspberry Pi
  • Read data from the sensor
  • Control the actuator according to the reading from the sensor
  • Connect the actuator to a device
Requirements
  • DHT Sensor
  • 4.7K ohm resistor
  • Relay
  • Jumper wires
  • Raspberry Pi
  • Mini fan


DHT Sensor
  • Digital Humidity and Temperature Sensor (DHT)
  • PIN 1,2,3,4 (from left to right)
  • PIN 1-3.3V - 5V Power supply
  • PIN 2- Data
  • PIN 3- Null
  • PIN 4 - Ground



Relay

Mechanical/electromechanical switch

3 output terminals (left to right)
  • NO (normal open) :
  • Common
  • NC (normal close)

Temperature Dependent Auto Cooling System


Sensor interface with Raspberry Pi
  • Connct pin 1 of DHT sensor to the 3.3V pin of Raspberry Pi
  • Connect pin 2 of DHT sensor to any input pins of Raspberry Pi, here we have used pin 7
  • Connect pin 4 of DHT sensor to the ground pin of the Raspberry Pi

Relay interface with Raspberry Pi


  • Connect the VCC pin of relay to the 5V supply pin of Raspberry Pi
  • Connect the GND (ground) pin of relay to the ground pin of Raspberry Pi
  • Connect the input/signal pin of Relay to the assigned output pin of Raspberry Pi (Here we have used pin 11)
Adafruit provides a library to work with the DHT22 sensor

Install the library in your Pi -
  • Get the clone from GIT
          → git clone https://github.com/adafruit/Adafruit_Pythone_DHT.git
  • Go to folder Adafruit_Python_DHT
          → cd Adafruit_Python_DHT
  • Install the library
          → sudo python setup.py install


Program : DHT22 with Pi
 Output :



Connection : Relay
  • Connect the relay pins with the Raspberry Pi as mentioned in previous slides 
  • Set the GPIO pin connected with the relay's input pin as output in the sketch
               GPIO.setup (11,GPIO.OUT)
  • Set the relay pin high when the temperature is greater than 30
                  if temperature > 20:
                     print ('Temp > 20')
                   GPIO.output (FAN,0)
                    print('Fan on')
                     sleep(5)
                     print('Fan off ')
                    GPIO.output(FAN,1)
else:
                  GPIO.output(FAN,1)
                  print ('Temp below max value.FAN OFF')

Connection : Fan

Connect the Li-po battery in series with the fan
  • No terminal of the relay -> positive terminal of the Fan.
  • Common terminal of the relay -> Positive terminal of the battery
  • Negative terminal of the battery -> Negative terminal of the fan.
Run the existing code. The fan should operate when the surrounding temperature is greater than the threshold value in the sketch



No comments:

Post a Comment

Popular Posts