3
0

Compare commits

..

No commits in common. "4e1a7a848a61ab31dbcc4ede03b3d42278f8d0b8" and "eef06a17f52481cff2e7051c0713696f9c610f9a" have entirely different histories.

5 changed files with 18 additions and 77 deletions

View File

@ -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(16,GPIO.OUT) GPIO.setup(12,GPIO.OUT)
try: try:
while True: while True:
print(LED ON) print(LED ON)
GPIO.output(16,GPIO.HIGH) GPIO.output(12,GPIO.HIGH)
time.sleep(1) time.sleep(1)
print(LED OFF) print(LED OFF)
GPIO.output(16,GPIO.LOW) GPIO.output(12,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(16,GPIO.OUT) GPIO.setup(12,GPIO.OUT)
GPIO.setup(26,GPIO.OUT) GPIO.setup(19,GPIO.OUT)
try: try:
while True: while True:
print(LED ON) print(LED ON)
GPIO.output(16,GPIO.HIGH) GPIO.output(12,GPIO.HIGH)
GPIO.output(26,GPIO.HIGH) GPIO.output(19,GPIO.HIGH)
time.sleep(1) time.sleep(1)
print(LED OFF) print(LED OFF)
GPIO.output(16,GPIO.LOW) GPIO.output(12,GPIO.LOW)
GPIO.output(26,GPIO.LOW) GPIO.output(19,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(16,GPIO.OUT) GPIO.setup(12,GPIO.OUT)
GPIO.setup(26,GPIO.OUT) GPIO.setup(19,GPIO.OUT)
try: try:
while True: while True:
print("LED Buzzer ON") print("LED Buzzer ON")
GPIO.output(16,GPIO.HIGH) GPIO.output(12,GPIO.HIGH)
GPIO.output(26,GPIO.HIGH) GPIO.output(19,GPIO.HIGH)
time.sleep(1) time.sleep(1)
print("LED & Buzzer OFF") print("LED & Buzzer OFF")
GPIO.output(16,GPIO.LOW) GPIO.output(12,GPIO.LOW)
GPIO.output(26,GPIO.LOW) GPIO.output(19,GPIO.LOW)
time.sleep(1) time.sleep(1)
except: except:
GPIO.cleanup() GPIO.cleanup()

0
Practical/Assignment-3/IoT - Code-3.py Normal file → Executable file
View File

View File

@ -1,58 +0,0 @@
# 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
---

View File

@ -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(26, GPIO.OUT) # Set GPIO 6 as output for LED GPIO.setup(6, 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(26, True) # Turn ON LED if water detected GPIO.output(6, True) # Turn ON LED if water detected
else else
GPIO.output(26, False) # Keep LED OFF if no water detected GPIO.output(6, 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.")

View File

@ -13,7 +13,6 @@
> 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/)