Skip to content
Smart light system for Internet of Things class final project.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
PHP
Python
README.md
smartLightElectronics.jpg
smartLightGUI.png
smartLightSetup.jpg

README.md

Smart Light System

Overview

For the final project in my Internet of Things course, I worked in a team to create a smart light system that allows the user to remotely control a LED bulb using a Raspberry Pi. I contributed to the software side of the project.

Hardware Design

The LED bulb, along with a photoresistor, was connected to a Raspberry Pi. The photoresistor was used to determine the ambient brightness of the room in order to adjust the LED brightness accordingly. Additionally, a transistor was used with the LED's battery pack as a relay in order to adjust the LED brightness using the Pulse Width Modulation (PWM) output from the Raspberry Pi.

The design of the smart light includes a lamp modified to hold the 12V LED bulb. The lamp plugs into the box that holds the Raspberry Pi and electronics, including the battery pack. An external USB battery pack is used to power the Raspberry Pi to make the set-up portable.

Software Design

I used an Apache web server on the Raspberry Pi, PHP to handle the HTML form input and to call the appropriate Python scripts, and Python to control the LED (turn on/off, adjust brightness).

How the Smart Light Works

  • User uses their device to connect to the Raspberry Pi via its IP address
  • On the webpage, there is a HTML form that allows the user to select among the following options:
    • Choose among four brightness settings for the LED or turn the LED off (Manual Brightness Control)
    • Enable or disable auto brightness mode, in which the LED brightness is automatically determined by the ambient brightness in the room
  • Upon user input, the PHP script runs the appropriate Python script to do one of the following:
    • Manual Brightness Control: Changes the duty cycle of the PWM output to adjust LED brightness.
    • Auto Brightness Mode: Reads input from photoresistor to determine amount of ambient light. Then, increases the LED brightness if it is dark in the room and vice versa.

Software Dependencies

  • Wiring Pi library: git clone git://git.drogon.net/wiringPi
  • Apache server + PHP5 extension: install apache2 php5 libapache2-mod-php5

Hardware Components

  • Raspberry Pi 3
  • Photoresistor
  • LED Bulb (12 V)
  • 12V Battery Pack
  • Transistor (12V MOSFET)
  • 300Ω Resistor (Used with the transistor)
  • 1µF Capacitor (Used as an analog to digital converter between the photoresistor and the Raspberry Pi)

Disclaimer

I have included the code used in this project "as is", meaning that it is a quickly hacked together solution that allowed our project to work in time for our final class presentation. Despite this not being an elegant solution, I enjoyed bringing together both the hardware and software aspects of this project and creating a working prototype.

References

For more details on this project, visit my website here.

You can’t perform that action at this time.