Compare commits
2 Commits
eef06a17f5
...
4e1a7a848a
Author | SHA1 | Date | |
---|---|---|---|
4e1a7a848a | |||
34b0bf01e9 |
@ -12,14 +12,14 @@ import RPi.GPIO as GPIO
|
|||||||
import time
|
import time
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setmode(GPIO.BCM)
|
||||||
GPIO setwarnings(False)
|
GPIO setwarnings(False)
|
||||||
GPIO.setup(12,GPIO.OUT)
|
GPIO.setup(16,GPIO.OUT)
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
print(“LED ON”)
|
print(“LED ON”)
|
||||||
GPIO.output(12,GPIO.HIGH)
|
GPIO.output(16,GPIO.HIGH)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print(“LED OFF”)
|
print(“LED OFF”)
|
||||||
GPIO.output(12,GPIO.LOW)
|
GPIO.output(16,GPIO.LOW)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
except:
|
except:
|
||||||
GPIO.cleanup()
|
GPIO.cleanup()
|
||||||
@ -31,17 +31,17 @@ import RPi.GPIO as GPIO
|
|||||||
import time
|
import time
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setmode(GPIO.BCM)
|
||||||
GPIO setwarnings(False)
|
GPIO setwarnings(False)
|
||||||
GPIO.setup(12,GPIO.OUT)
|
GPIO.setup(16,GPIO.OUT)
|
||||||
GPIO.setup(19,GPIO.OUT)
|
GPIO.setup(26,GPIO.OUT)
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
print(“LED ON”)
|
print(“LED ON”)
|
||||||
GPIO.output(12,GPIO.HIGH)
|
GPIO.output(16,GPIO.HIGH)
|
||||||
GPIO.output(19,GPIO.HIGH)
|
GPIO.output(26,GPIO.HIGH)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print(“LED OFF”)
|
print(“LED OFF”)
|
||||||
GPIO.output(12,GPIO.LOW)
|
GPIO.output(16,GPIO.LOW)
|
||||||
GPIO.output(19,GPIO.LOW)
|
GPIO.output(26,GPIO.LOW)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
except:
|
except:
|
||||||
GPIO.cleanup()
|
GPIO.cleanup()
|
||||||
@ -53,17 +53,17 @@ import RPi.GPIO as GPIO
|
|||||||
import time
|
import time
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setmode(GPIO.BCM)
|
||||||
GPIO.setwarnings(False)
|
GPIO.setwarnings(False)
|
||||||
GPIO.setup(12,GPIO.OUT)
|
GPIO.setup(16,GPIO.OUT)
|
||||||
GPIO.setup(19,GPIO.OUT)
|
GPIO.setup(26,GPIO.OUT)
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
print("LED Buzzer ON")
|
print("LED Buzzer ON")
|
||||||
GPIO.output(12,GPIO.HIGH)
|
GPIO.output(16,GPIO.HIGH)
|
||||||
GPIO.output(19,GPIO.HIGH)
|
GPIO.output(26,GPIO.HIGH)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print("LED & Buzzer OFF")
|
print("LED & Buzzer OFF")
|
||||||
GPIO.output(12,GPIO.LOW)
|
GPIO.output(16,GPIO.LOW)
|
||||||
GPIO.output(19,GPIO.LOW)
|
GPIO.output(26,GPIO.LOW)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
except:
|
except:
|
||||||
GPIO.cleanup()
|
GPIO.cleanup()
|
||||||
|
0
Practical/Assignment-3/IoT - Code-3.py
Executable file → Normal file
0
Practical/Assignment-3/IoT - Code-3.py
Executable file → Normal file
58
Practical/Connections.md
Normal file
58
Practical/Connections.md
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# IoT Connections
|
||||||
|
|
||||||
|
[Refer Raspberry Pi pinout diagram](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Practical/Raspberry%20Pi%20%282+3+4+5%29%20GPIO%20Pinout.png)
|
||||||
|
![Raspberry Pi PINOUT](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/raw/branch/main/Practical/Raspberry%20Pi%20%282+3+4+5%29%20GPIO%20Pinout.png)
|
||||||
|
|
||||||
|
## Assignment 2 - LEDs and Buzzer
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Long terminal in LED is always positive, short terminal is always negative.
|
||||||
|
|
||||||
|
### Single LED
|
||||||
|
|
||||||
|
**Device** | **Positive terminal** | **Negative terminal (Ground/GND)** | **Signal/Output**
|
||||||
|
--- | --- | --- | ---
|
||||||
|
LED | GPIO 16 (PIN 36) | GROUND (PIN 34) | N/A
|
||||||
|
|
||||||
|
|
||||||
|
### Two LEDs
|
||||||
|
|
||||||
|
**Device** | **Positive terminal** | **Negative terminal (Ground/GND)** | **Signal/Output**
|
||||||
|
--- | --- | --- | ---
|
||||||
|
LED 1 | GPIO 16 (PIN 36) | GROUND (PIN 34) | N/A
|
||||||
|
LED 2 | GPIO 26 (PIN 37) | GROUND (PIN 39) | N/A
|
||||||
|
|
||||||
|
### Buzzer with one LED
|
||||||
|
|
||||||
|
**Device** | **Positive terminal** | **Negative terminal (Ground/GND)** | **Signal/Output**
|
||||||
|
--- | --- | --- | ---
|
||||||
|
Buzzer | GPIO 16 (PIN 36) | GROUND (PIN 34) | N/A
|
||||||
|
LED | GPIO 26 (PIN 37) | GROUND (PIN 39) | N/A
|
||||||
|
|
||||||
|
## Assignment 3 - IR Sensor
|
||||||
|
|
||||||
|
**Device** | **Positive terminal** | **Negative terminal (Ground/GND)** | **Signal/Output**
|
||||||
|
--- | --- | --- | ---
|
||||||
|
IR Sensor | 5V power (PIN 2) | GROUND (PIN 34) | GPIO 16 (PIN 36)
|
||||||
|
LED | GPIO 26 (PIN 37) | GROUND (PIN 39) | N/A
|
||||||
|
|
||||||
|
## Assignment 4 - DHT11 (Temperature sensor)
|
||||||
|
|
||||||
|
**Device** | **Positive terminal** | **Negative terminal (Ground/GND)** | **Signal/Output**
|
||||||
|
--- | --- | --- | ---
|
||||||
|
DHT11 | 5V power (PIN 2) | GROUND (PIN 34) | GPIO 16 (PIN 36)
|
||||||
|
|
||||||
|
## Assignment 5 - Camera
|
||||||
|
|
||||||
|
**Device** | **Positive terminal** | **Negative terminal (Ground/GND)** | **Signal/Output**
|
||||||
|
--- | --- | --- | ---
|
||||||
|
Picamera | N/A | N/A | CSI port
|
||||||
|
|
||||||
|
## Water level
|
||||||
|
|
||||||
|
**Device** | **Positive terminal** | **Negative terminal (Ground/GND)** | **Signal/Output**
|
||||||
|
--- | --- | --- | ---
|
||||||
|
Water sensor | 5V power (PIN 2) | GROUND (PIN 34) | GPIO 16 (PIN 36)
|
||||||
|
LED | GPIO 26 (PIN 37) | GROUND (PIN 39) | N/A
|
||||||
|
|
||||||
|
---
|
@ -14,14 +14,14 @@ GPIO.setmode(GPIO.BCM)
|
|||||||
GPIO.setwarnings(False)
|
GPIO.setwarnings(False)
|
||||||
GPIO.cleanup()
|
GPIO.cleanup()
|
||||||
GPIO.setup(16, GPIO.IN) # Set GPIO 16 as input for water level sensor signal
|
GPIO.setup(16, GPIO.IN) # Set GPIO 16 as input for water level sensor signal
|
||||||
GPIO.setup(6, GPIO.OUT) # Set GPIO 6 as output for LED
|
GPIO.setup(26, GPIO.OUT) # Set GPIO 6 as output for LED
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
if (GPIO.input(16))
|
if (GPIO.input(16))
|
||||||
GPIO.output(6, True) # Turn ON LED if water detected
|
GPIO.output(26, True) # Turn ON LED if water detected
|
||||||
else
|
else
|
||||||
GPIO.output(6, False) # Keep LED OFF if no water detected
|
GPIO.output(26, False) # Keep LED OFF if no water detected
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
GPIO.cleanup()
|
GPIO.cleanup()
|
||||||
print("Program exited by user.")
|
print("Program exited by user.")
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
> These folders contain **handout**, **write-up** and **other content**.
|
> These folders contain **handout**, **write-up** and **other content**.
|
||||||
|
|
||||||
- [Raspberry Pi 2/3/4 GPIO Pinout](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Practical/Raspberry%20Pi%20%282+3+4+5%29%20GPIO%20Pinout.png)
|
- [Raspberry Pi 2/3/4 GPIO Pinout](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Practical/Raspberry%20Pi%20%282+3+4+5%29%20GPIO%20Pinout.png)
|
||||||
|
- [Refer this for all connections](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Practical/Connections.md)
|
||||||
|
|
||||||
1. [Assignment-1](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Practical/Assignment-1/)
|
1. [Assignment-1](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Practical/Assignment-1/)
|
||||||
2. [Assignment-2](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Practical/Assignment-2/)
|
2. [Assignment-2](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Practical/Assignment-2/)
|
||||||
|
Loading…
Reference in New Issue
Block a user