Giter Club home page Giter Club logo

leds's Introduction

Français

Libre Connect
Download Leds / LibreConnect /Source

What is Leds

Photo LEDs
leds is a device to control 1 or more leds (ws2812b) using USB.
You can animate each leds independently, and change the color using hsv colors.

Applications

By default , leds are available at ws://localhost:42001

Control your leds using a webpage
Photo LEDs

Tasker
Be notified when someone calls you, using tasker and some easy to use JavaScript. You can trigger leds for any events that happens on your phone!

You can also use Power Toggles to make buttons on your notification bar.

Power Toggles

Here is a script I use to turn off leds.

  • Create a task
  • Import your code using Code/Javascript
  • Remove auto exit
  • Delay set to 1 seconds.
ip="192.168.0.140";
port=42001;


bluepulse = "load;255;160;255;143;2;0;0;160;255;116;2;0;0;";
police = "load;255;0;255;255;4;0;1;160;255;255;4;1;70;";
fire = "load;123;32;255;41;2;0;0;32;255;129;2;0;0;";
off = "/off";

leds = new WebSocket("ws://"+ip+":"+port);
leds.onopen = send;

function send(){
	leds.send(off);
}

apps/thunderbird

Be notified when someone sends you an email, using filters and mail alerts plugin.

You can use ws-send to control leds.

"c:\libreconnect\ws-send.exe" -u "ws://localhost:42001" -m "/on"

How to build leds

leds

Arduino

First we need to copy the code on an arduino,

  • Copy arduino/leds and arduino/library into your arduino sketchbook
  • Upload leds/leds.ino

Components

Here is the list of components, you will need you can easily find it using these keywords on ebay/aliexpress etc...

led2

  • RobotDyn Nano V3 (micro-usb): 2€

led5

  • Arduino nano clone CH340G (mini-usb): 2€

Strip WS2812B

  • 30 leds WS2812B : 4.50€ ( 5 leds :0.75€)
  • Resistor pack 400pcs (3€) (1 resistor: 0.0071€)
  • Total : 9.5€ (2.75€)

Wiring

Wiring_leds Inside Led2

  • D6 --> RESISTOR (470Ω) DI
  • +5V --> 5V
  • GND --> GND

Warning

Do not used more than 5 LEDs without a dedicated power supply or this can damage the LEDs, Each led can draw up to 60ma at full brightness
Arduino can provide up to 500ma (on 5v/Gnd pin)
5 LEDs = 5x60ma = 300ma
Source: https://learn.adafruit.com/adafruit-neopixel-uberguide/basic-connections

3D printing

You will have a more uniform light, if you put the case inside another semi-transparent case.
Wiring_leds Wiring_leds
Models

Commands

Here are the commands available, you can send it using Arduino at baudrate 115200.

Global commands

  • /info -------> Give name of device (name:port) (leds:42001)
  • /off --> Turn off all leds
  • /on --> Turn on all leds
  • /status --> Display state of all leds as general_brightness;led0;hue;saturation;value;type_animation;arg1;arg2 etc...
  • /load;[status] --> Load the state of leds/animation specified (warning this won't works with 5 leds as the string is too long for serial buffer)
  • /save --> Save current state to eeprom
  • /reset --> Reset state to eeprom state
  • /sync --> Change all value to 255 (max brightness), this will synchronize blink/pulse animation for all leds
  • /clear --> Remove settings in eeprom

Load example

 Fire: load;123;32;255;41;2;0;0;32;255;129;2;0;0;

Leds specific commands

color;led;Hue;Saturation;Value ---> Change color for a specific led using hsv
animation;led;type;arg1;arg2 ---> Change animation for a specific led

Color (hue)

Color is hsv have three parameters: hue(color),saturation(more or less white~),value(brightness) The most important value in hsv is the hue which define the color, you can pretty much always use 255;255 for saturation/value (with the exception of the white color which use 0 as saturation).

  • red = 0
  • orange = 32
  • yellow = 64
  • green = 96
  • aqua = 128
  • blue = 160
  • purple = 192
  • pink = 224

led0 in red

color;0;0;255;255

Animation

Photo LEDs

  • 0: No animation
  • 1: Blinking (param1:speed in ms)
  • 2: Pulsing
  • 3: Rainbow mode
  • 4: Alternative Blink (param1:0:master/1:slave, param2:second led/speed in ms)
  • 5: Progressive Change (Change color progressively)

led 0 pulsing

animation;2;0;0

led 1 blinking at 25ms

animation;1;25;0

led 2 rainbow mode (hue change)

animation;3;0;0

Licences

leds.ino

  • Author: Rémi Sarrailh (madnerd.org)
  • Licence: MIT

FastLed

Cases (stl)

  • Author: Olivier Sarrailh
  • Licence: CC-by

leds's People

Contributors

maditnerd avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

darckfast

leds's Issues

Save last state into eeprom

Led1
Hue
Saturation
Value
Animation
Anim - Param1
Anim - Param2

Led2
Hue
Saturation
Value
Animation
Anim - Param1
Anim - Param2

EEPROM save state

Current animation/color for leds should be saved on eeprom so you could use the led box as decoration and reprogram it easily.

Landing Page

Emphasis on:

  • Applications : Decorative led OR/AND notifications
  • How to use it for decorative leds
  • How to use it with tasker/libreconnect.

Animation

Basic animation should be available.

  • Blink
    --> 1:blink:30 (led1 blink 30ms)
    --> 1:blink (led1 blink default speed)
  • Pulse (value change)
    --> 1:pulse (led1 pulse)
    --> 1:pulse:30 (led1 pulse 30ms)
  • Colorswap (hue change)
    --> 1:colorswap
    --> 1:colorswap:hue1:hue2

Test file with one html file (pug/jade compiled)

Pug (previously know has jade) is an easy way to build modular html files which can be contains in one file.
It makes it easy to share interface between users and to reuse elements.

I'll try to build a page without using any css/js libraries so that the page are light and it can be used to build other interface.

Arguments possibles for pug:
-- Number of leds to control
-- Port/IP
-- Language (fr/en)

Led Box

New led case, will be smaller and won't require to add hot glue to block the arduino.
There will only be two leds.
I'm using a robotdyn nano ch340g (with micro usb)
http://robotdyn.com/catalog/boards/nano_v3_ch340g_compatible_with_arduino_nano_v3/
image

The case is modular so you can add plastic parts to customize the form of the led box.
By using other plastic parts we can give the impression the box produce the light by hiding the leds a little bit.
Using layers of plastic parts will make it less and less bright on each parts creating a shade effects.

HSV controls

I wanted a basic examples to showcase leds but WS2812B can do a lot more than this.

  • Colors from hex
  • Brightness controls.

We could also manage basic animation with simple commands or go the other way to be able to control the led as fast as possible.

Test a prototype that takes hsv value but hsv value on a web page doesn't render well on a rgb led strip as mentionned by fastled here:
https://github.com/FastLED/FastLED/wiki/Pixel-reference

Please note - these predefined colors are defined using the W3C RGB definitions. These definitions are designed with RGB monitors in mind, not RGB leds, and so the colors that you get on LED strips may be a bit different than you're expecting. In our experience, the colors are often too pale, or washed out (overly-desaturated).

Screen Pixel to leds (HUD for game)

A cool thing to do with leds, is to scan pixel on a screen in a game to make a custom HUD.
Here is an example that grabs the health of a player and display it on leds.
(that probably doesn't works since there was a lot of changes in the GUI for heroes of the storm that doesn't use websocket)
https://github.com/pigetArduino/uled/tree/master/apps/hotsHUD

We could make a client, that would scan specific pixels on the screen, and use this information to make a led change color depending on what happens in game.
We can't do this with fullscreen game, but windowed fullscreen game works.

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.