LibrePilot Forum

Development => GCS General => Topic started by: stepansonsky on November 20, 2015, 02:45:40 pm

Title: RGB LED control
Post by: stepansonsky on November 20, 2015, 02:45:40 pm
Hi, are you planning some kind of LED strip control like CleanFlight has? It would be great, I like it, but I want to stay with LibrePilot.

Thanks for your good work!
Title: Re: RGB LED control
Post by: TheOtherCliff on November 20, 2015, 08:12:57 pm
LP already has WS2811 control.  Easiest setup is attach a single (or strip) WS2811 to an unused ESC output.  It gives you information about the current state of the FC.  Errors, arming, etc.

It is turned on in System->Settings->HwSettings->somethingAboutWs2811 (at the bottom of HwSettings)

:)
Title: Re: RGB LED control
Post by: stepansonsky on November 21, 2015, 07:29:41 pm
Nice, thanks, will be there some custom programmable effects in the future? For emaple I like changing color depending on throttle, it would be cool :)
Title: Re: RGB LED control
Post by: TheOtherCliff on November 21, 2015, 08:07:01 pm
It can certainly happen, but it would need a developer.  I would think it would be very easy for a firmware dev, considering the blinking status code is already written.
There are a lot of ideas that just need someone to work on them.  :)  (and provide a little convincing ...)

I think TL has something where the color is based on what direction it is pointed and that would be very useful when it is a long way away.
Title: Re: RGB LED control
Post by: stepansonsky on November 21, 2015, 08:32:05 pm
Great, I'm looking forward to LibrePilot future progress, thumbs up!
Title: Re: RGB LED control
Post by: V4z on January 10, 2016, 09:15:33 pm
Hi folks, I would like to know which option I should select via the Configuration>Hardware>Flexi Port.

I have already wired a WS2812 via Flexi Port (pin: 1, 2, 3) and saved the output preference (FlexiIOPin3) on System>HwSettings>WS2811LED_Out, but nothing happens..
Title: Re: RGB LED control
Post by: f5soh on January 10, 2016, 09:35:18 pm
FlexiIOpin3 or 4 refers to FlexiIO port, the receiver port.

Pin3 and 4 are unused pins, you need to add a wire on receiver connector and connect this wire do the "data" pin on WS2812 Led

This assumes you are using a Revolution board


Title: Re: RGB LED control
Post by: V4z on January 10, 2016, 09:49:42 pm
Ok I was wrong. I'm using a OpenFlight CC3D, pretty similar to Revolution Board but I am not sure.

So the best way is to use an ESC output. I would try that!

Thanks!
Title: Re: RGB LED control
Post by: liftbag on January 10, 2016, 10:40:18 pm
As far as I know, RGB LED cannot work on CC target, so your board should be a revolution or a revonano, or maybe a Sparky2.
Title: Re: RGB LED control
Post by: f5soh on January 10, 2016, 10:41:48 pm
CC3D or Atom boards do not support WS281x leds, only Revolution and Revolution Nano.

Added some info for Led support:
https://librepilot.atlassian.net/wiki/display/LPDOC/Setup+WS281x+Led
Title: Re: RGB LED control
Post by: V4z on January 10, 2016, 11:00:21 pm
Ok, tested ServoOut6 with the WS2812 wired but still nothing. As far as you said, there is no way to have an external RGB LED showing the arming status on CC3D. Really sad.

I will use the SMD pad of the LED, to trigger a standard external LED.. But that's creepy..
Title: Re: RGB LED control
Post by: mazevx on January 12, 2016, 07:16:48 pm
Hello,  can i adress more than 1 led as status led?
Wiki says nothing about that
Title: Re: RGB LED control
Post by: f5soh on January 12, 2016, 07:28:49 pm
You can share the same signal 'data' to one led or more, serially. 
Title: Re: RGB LED control
Post by: mazevx on January 12, 2016, 07:35:48 pm
Ok, its just im a bit lazy... ;-)
Title: Re: RGB LED control
Post by: TheOtherCliff on January 13, 2016, 12:24:10 am
I thought I recalled that you can leave the WS2811 LED's daisy chained like they come pre-wired, and up to some number...  Just glanced at the source code.  Looks like 10 will work? all the same color.
Title: Re: RGB LED control
Post by: mazevx on January 13, 2016, 09:11:57 am
If you have one of those strips thats right, but i use single LEDs wich called "breadboard friendly"
So I have to wire them, there was a discription about the use of them but i cant find that anymore, think that was in the OP Forums...
Title: Re: RGB LED control
Post by: hwh on January 13, 2016, 05:12:06 pm
The ws2811 leds normally have 6 connections, 3 running down each edge of the board.

Power in and ground connect to the corresponding pins on the "in" side, and the input from the FC goes to the "in" pin.   Power and ground on the other edge go to power in and ground on the next led in the chain.  "Out" on the first led goes to "in" on the second one.  The same pattern continues for the additional leds.

The wiki https://librepilot.atlassian.net/wiki/display/LPDOC/Setup+WS281x+Led shows one of the strip versions.  On the left the pins next to each other are connected together (DO to DIN, +5 to +5, GND to GND) when it's manufactured.  To make a single led module they just cut them apart between DO and DIN.
Title: Re: RGB LED control
Post by: fyoory on February 07, 2016, 04:02:31 pm
Yea I was only able to get leds working in cleanflight on a cc3d evo on my quad multicopter.    If your hard up to get them going on non revos then this is probably the way to go.    I was able to get it to light like 1 led on my evo but it took 5 minutes and just stayed yellow.  Not much use there other than a night light lol.
Title: Re: RGB LED control
Post by: zukenj on March 15, 2016, 08:06:40 pm
I use the ServoOut6 and It light up fine, but then it will blink only one color (Light Blue) I think. It will not show any variant.

I haven't tested with the NEXT compilation. I will tonight and post back.
Title: Re: RGB LED control
Post by: hwh on March 15, 2016, 08:50:41 pm
The ws2811 led support isn't related to the next branch, it's in the last release.

When you followed https://librepilot.atlassian.net/wiki/display/LPDOC/Setup+WS281x+Led and changed the WS2811LED_Out setting to ServoOut6 did you save it?  At the top left of the screen there is a green arrow pointing upward, that sends it to the revo temporarily but doesn't save it so it will stay over a power cycle.  The one that looks like a hard drive with a red arrow pointing up saves it so it will persist over a power cycle.  When I save settings on a board I usually check it by disconnecting the board, reconnecting, and see if the setting I changed is still changed.

The ws2811 support is only for the revo and revo nano boards, it doesn't work on cc3d boards.
Title: Re: RGB LED control
Post by: Lazaros on March 17, 2016, 02:29:49 pm
I thought I recalled that you can leave the WS2811 LED's daisy chained like they come pre-wired, and up to some number...  Just glanced at the source code.  Looks like 10 will work? all the same color.

Indeed...it's 10...I had connected two strips in series (8 each) and at the beginning I though one strip was "damaged"  ::)
put them in parralel and...all lit up... :D
Title: Re: RGB LED control
Post by: zukenj on March 18, 2016, 02:01:13 pm
The ws2811 led support isn't related to the next branch, it's in the last release.

When you followed https://librepilot.atlassian.net/wiki/display/LPDOC/Setup+WS281x+Led and changed the WS2811LED_Out setting to ServoOut6 did you save it?  At the top left of the screen there is a green arrow pointing upward, that sends it to the revo temporarily but doesn't save it so it will stay over a power cycle.  The one that looks like a hard drive with a red arrow pointing up saves it so it will persist over a power cycle.  When I save settings on a board I usually check it by disconnecting the board, reconnecting, and see if the setting I changed is still changed.

The ws2811 support is only for the revo and revo nano boards, it doesn't work on cc3d boards.

hwh

Thanks for your reply.

You are right, it is always a good idea to double check. but I am sure I save it because, I turned the Quad off and took it outside, turn it back on, and the LEDs showed different colors when the board was booting, then one blinking color.

I will do a small video today, and post the link.

Thanks
Title: Re: RGB LED control
Post by: hwh on March 18, 2016, 03:18:41 pm
... the LEDs showed different colors when the board was booting, then one blinking color...

Blinking changing colors during boot up and then blinking one color would be normal.  The color pattern should change when you arm and when you change flight modes according to the chart in the wiki https://librepilot.atlassian.net/wiki/display/LPDOC/Setup+WS281x+Led#SetupWS281xLed-Ledbehavior

The blinking blue you described sounds like idle.  Try forcing an error like unplugging power to the receiver an see if the pattern changes to receiver error, the orange flash is pretty noticable  :)
Title: Re: RGB LED control
Post by: zukenj on March 18, 2016, 03:20:39 pm
That is a good test. I'll post results
Title: Re: RGB LED control
Post by: zukenj on March 19, 2016, 05:04:41 am
Here is a link to the video, LEDs light Yellow when Radio Disconnected and Blue when after boot.

https://www.youtube.com/watch?v=dUdMqV27ZEk (https://www.youtube.com/watch?v=dUdMqV27ZEk)
Title: Re: RGB LED control
Post by: Dark-Hawk on March 20, 2016, 01:22:25 am
I thought I recalled that you can leave the WS2811 LED's daisy chained like they come pre-wired, and up to some number...  Just glanced at the source code.  Looks like 10 will work? all the same color.

Could you point me to the codeline for this? I was looking for that, but somehow i didnt found it. I'm using an adafruit neopixel ring, but since just 10 leds are called, nearly half the ring stays dark.
Title: Re: RGB LED control
Post by: hwh on March 20, 2016, 01:45:15 am
It's in flight/pios/inc/pios_ws2811.h

#define PIOS_WS2811_NUMLEDS 10
Title: Re: RGB LED control
Post by: hwh on March 21, 2016, 12:19:40 am
Here is a link to the video, LEDs light Yellow when Radio Disconnected and Blue when after boot.

You're right, in your video it doesn't look like the flight mode is flashing in the led strip. I can't check this right now because I don't have a ws281x connected to a running quad.  Toward the end of this week I'll be up again and I'll check this out.
Title: Re: RGB LED control
Post by: zukenj on March 21, 2016, 12:20:58 am
Thanks hwh
Title: Re: RGB LED control
Post by: Torsten on July 20, 2016, 01:19:13 pm
hi can i do this without cleanflight
i use librepilot but i don`t will change to cleanflight
can you help me


(http://www.aerobot.ch/led-board-rgb5050-ws2812b,-kompatibel-mit-cc3d-naze32.html)