IOTIF - IOT Trainer Kit with Raspberry Pi 5 8GB Documentation
The IOTIF - IOT Trainer Kit with Raspberry Pi 5 8GB is a comprehensive kit designed for individuals looking to explore the world of Internet of Things (IoT) and learn about its applications. The kit includes a Raspberry Pi 5 8GB, a powerful single-board computer, along with various sensors and modules to help users develop and prototype IoT projects.
Raspberry Pi 5 8GB
Breadboard
Jumper wires
LED module
Button module
PIR motion sensor
Temperature and humidity sensor
USB cable
Power adapter
Programming Languages Supported
### Example 1: LED Control using Python
In this example, we will use the Raspberry Pi to control the LED module using Python.
Connect the LED module to the breadboard
Connect the breadboard to the Raspberry Pi's GPIO pins (e.g., GPIO 17 for LED positive leg and GND for LED negative leg)
Code
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Set up LED pin as output
LED_PIN = 17
GPIO.setup(LED_PIN, GPIO.OUT)
try:
while True:
# Turn LED on
GPIO.output(LED_PIN, GPIO.HIGH)
print("LED is on")
time.sleep(1)
# Turn LED off
GPIO.output(LED_PIN, GPIO.LOW)
print("LED is off")
time.sleep(1)
except KeyboardInterrupt:
GPIO.cleanup()
```
Explanation
This code sets up the GPIO mode and defines the LED pin as an output. It then enters an infinite loop, toggling the LED on and off every second using the `GPIO.output()` function.
### Example 2: Motion Detection using Python and PIR Sensor
In this example, we will use the PIR motion sensor to detect motion and trigger an action using Python.
Connect the PIR motion sensor to the breadboard
Connect the breadboard to the Raspberry Pi's GPIO pins (e.g., GPIO 23 for PIR sensor signal pin and GND for PIR sensor ground pin)
Code
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Set up PIR sensor pin as input
PIR_PIN = 23
GPIO.setup(PIR_PIN, GPIO.IN)
try:
while True:
# Read PIR sensor value
pir_value = GPIO.input(PIR_PIN)
# Check if motion is detected
if pir_value:
print("Motion detected!")
# Take action (e.g., send notification, turn on LED, etc.)
else:
print("No motion detected")
time.sleep(0.5)
except KeyboardInterrupt:
GPIO.cleanup()
```
Explanation
This code sets up the GPIO mode and defines the PIR sensor pin as an input. It then enters an infinite loop, reading the PIR sensor value every 0.5 seconds using the `GPIO.input()` function. If motion is detected (i.e., the PIR sensor value is HIGH), it triggers an action (e.g., prints a message, sends a notification, etc.).
These examples demonstrate the basics of using the IOTIF - IOT Trainer Kit with Raspberry Pi 5 8GB to develop IoT projects. The kit offers a wide range of possibilities, and users can explore and learn more about IoT development using this comprehensive kit.