Giter Site home page Giter Site logo

bobataylor / rpy-led-controller Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 40 KB

A Raspberry Pi and Python based RGB LED strip controller. Includes easy integration with the Google Assistant and a gentle fade-in alarm clock.

Home Page: https://bobataylor.com/projects/RPy-LED-Controller

Python 100.00%

rpy-led-controller's Introduction

Raspberry PY LED Controller

Waking up in the morning is hard. Especially when it's still dark outside. This project started as a python alarm clock designed to gently fade in an LED strip, and became more of an easy way to control RGB LEDs with a Rasberry Pi and the Google Assistant.

Features

  • Easy RGB LED controll
    • All the complicated bits, like PWM and duty cycles, are abstracted away into the leds and channels classes. An experienced user can modify these to add functionality as they please, but a more basic user can controll color and brightness with a predifend set of colors, or by passing in their own RGB values (0-255).

  • Google Assistant integration
    • RGB LED strips are cheap and fun, but their controllers and IR remotes are rather, well... bad. Here the controller is replaced by GPIO on a Rasberry Pi and the remote is replaced by integration with the Google Assistant. Custom commands can be added to g_socket.py and itgration is run through IFTTT.

  • Customizable
    • New LED lighting sequences and features can be easily created using the methods provided in the leds class. There is no need to worry about threading, PWM, the various color channels, or any low level control over the leds. For example, a stobe could be implemented as follows.
import leds, time, colors
R, G, B = 22, 27, 25                #define pins
freq = 300                          #define a frequency in Hz for the pwm to run at
wait = 20                           #20ms wait time for strobing

led_strip = leds.(R, G, B, freq)    #create and setup an led object
led_Strip.set_color(colors.white)

while True:                         #loop forever turning the lights on and off to create a strobe
  led_strip.on()
  time.sleep(wait)
  led_strip.off()
  time.sleep(wait)

Alarm

  • For now the alarm has to be set inside run_me.py. Set the hour out of 24, the minute, and your timezone's difference from UTC. You would think calling time.localtime() would return your local time, but for me it didn't. Whoops...

Dependencies

  • This repository should be used with a driving circuit to deliver power to the LEDs and not to power the LEDs directly from the Raspbery Pi. In it's simplest form the curcuit can be 3 transistors, a power supply, and the Raspberry Pi wired to the bases of the transistors.
  • This repository is designed with a common anode RGB LED strip, but the code should work with common cathode RGB LEDs as well. This only stipulation is that the driving circuit will need to be reversed.

Issues

  • Some flickering is seen in the LED strip for certain colors.

rpy-led-controller's People

Contributors

bobataylor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.