Skip to content

Marcuii/4ledsrpi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

IoT LED Controller Project πŸ’‘

A multi-platform IoT project that controls LEDs via Blynk mobile app and syncs data to Adafruit IO cloud dashboard.

πŸ“‹ Project Overview

This project consists of three Python scripts that work together:

  1. blynk_control_RPI.py - Controls physical LEDs on Raspberry Pi
  2. blynk_control_VH.py - Virtual hardware version for testing without Pi
  3. adafruit_monitor.py - Syncs LED states to Adafruit IO cloud

πŸš€ Quick Start

1. Set Up Virtual Environment

# Create virtual environment (if not already created)
python3 -m venv bonus.venv

# Activate it
source bonus.venv/bin/activate

2. Install Dependencies

pip install -r requirements.txt

3. Configure Your Credentials

# Copy the example config file
cp config.example.py config.py

# Edit config.py and add your credentials
nano config.py

You'll need:

4. Run the Project

On Raspberry Pi (with physical LEDs):

# Terminal 1 - Run the Blynk controller
python blynk_control_RPI.py

# Terminal 2 - Run the Adafruit monitor
python adafruit_monitor.py

For Testing (Virtual Hardware):

# Terminal 1 - Run the virtual hardware controller
python blynk_control_VH.py

# Terminal 2 - Run the Adafruit monitor
python adafruit_monitor.py

πŸ”§ Hardware Setup (Raspberry Pi)

Connect 4 LEDs to your Raspberry Pi:

  • LED 1 (Top): GPIO 17
  • LED 2 (Right): GPIO 27
  • LED 3 (Bottom): GPIO 22
  • LED 4 (Left): GPIO 10

Don't forget current-limiting resistors! (220Ξ© - 330Ξ© recommended)

πŸ“± Blynk App Setup

  1. Create a new project in Blynk app
  2. Add 4 switch widgets
  3. Assign them to Virtual Pins: V0, V1, V2, V3
  4. Copy your Auth Token to config.py

☁️ Adafruit IO Setup

  1. Create 4 feeds in Adafruit IO:
    • led-top
    • led-right
    • led-bottom
    • led-left
  2. Copy your Username and Key to config.py

πŸ“ Project Structure

4ledsrpi/
β”œβ”€β”€ blynk_control_RPI.py    # Raspberry Pi hardware controller
β”œβ”€β”€ blynk_control_VH.py     # Virtual hardware controller
β”œβ”€β”€ adafruit_monitor.py     # Adafruit IO sync service
β”œβ”€β”€ config.py               # Your credentials (DO NOT COMMIT!)
β”œβ”€β”€ config.example.py       # Template for credentials
β”œβ”€β”€ requirements.txt        # Python dependencies
β”œβ”€β”€ .gitignore             # Git ignore file
β”œβ”€β”€ led_state.json         # Generated at runtime
└── bonus.venv/            # Virtual environment

πŸ”’ Security Notes

  • NEVER commit config.py to GitHub (it's in .gitignore)
  • Use config.example.py as a template for others
  • Keep your API keys private!

πŸ› Troubleshooting

"ModuleNotFoundError: No module named 'config'"

  • Make sure you created config.py from config.example.py

"RPi.GPIO not found" on laptop/desktop

  • This is normal! Use blynk_control_VH.py instead

Adafruit IO rate limit errors

  • The code has built-in protection, but if you see errors, increase MONITOR_INTERVAL in config

LEDs not turning on

  • Check GPIO pin numbers in config.py
  • Verify wiring and resistors
  • Test with a simple GPIO test script

πŸ“ License

Educational project for ECEN430 course.

πŸ‘€ Author

Created by Marcelino Saad, NU - BS of Engineering

About

πŸ”Œ A versatile IoT LED controller with dual-platform support (Raspberry Pi & Virtual Hardware) built with Python. Features real-time control via Blynk mobile app, cloud sync with Adafruit IO, and persistent state management. Perfect for demonstrating IoT fundamentals, cloud integration, and embedded systems development.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages