FrozenPickle / Afterglow

A plugin framework to perform image capturing, colour extraction, post processing and colour output - primarily for use with lighting systems such as for ambient lighting.
GNU Lesser General Public License v3.0
14 stars 8 forks source link

Support for WS2812B #25

Open pigers opened 10 years ago

pigers commented 10 years ago

Support for those LEDs would be very nice, as they are getting more more at market. I have one strand to test ;)

mrjono1 commented 10 years ago

Hi pigers I have not tested other LED types yet but it should work for many different LED types. In the Afterglow.ino file there is a section to change the LED type, below is the list of currently available options.

If you change the option in the method setLEDChipSet() to WE2801 this might work for WS2812B, then upload this new version to the arduino.

We are using a library called fast spi to handle different LED types it is documented here https://code.google.com/p/fastspi/ and here https://github.com/FastLED/FastLED we are probably a few versions behind, if this option does not work for you we can look into updating to the latest version.

pigers commented 10 years ago

Hey Jono I have tested attached .ino file with my 2812B leds and it won't work, leds are not showing what they are supposed to.

Yesterday I worked with newer version of FastLED and acheived blinking in blue&white rythm instead working correctly - looks like communication is working but there's problem with data received (at least I think).

Here's code I used for Arduino: http://pastebin.com/nByXRXWM

Maybe there's something wrong with it.

mrjono1 commented 10 years ago

Your example is using 'A', 'd', 'a' as the 'prefix' it is currently expecting 'G', 'l', 'o' you can either change it to 'Glo' or change the Afterglow settings in the web interface to 'Ada'. This prefix is to ensure that the communication being received is intended for this the correct software. This means communication is being received but disregarded.

It sounds like I should update Afterglow to use FastLED

pigers commented 10 years ago

Im using "Ada" value in both AfterGlow and Ardunio code, so that's not an issue.

Yep, update is quite good, but I remember that newer fastLED wont work with older LEDs version, so it'd nice to have an copy for older ones.

mrjono1 commented 10 years ago

@pigers I have an old version of lights SPI_LPD6803 so if you are able to update to FastLED that would be great and I could create an Arduino release that for old lights like mine.

I think you need to add a buffer to the data being received, @spazzarama and I had issues so we added it. Without it we were getting strange colours, as the data was being received to fast and bits were being skipped causing incorrect colours.

pigers commented 10 years ago

@mrjono1 - could You post your code used for Arduino with that buffer ? Im playing with code for few hours without results.

After some code modifications I have get rid of frustrating blinking , I have spotted another problem, as for me there's no change in colour of LEDs despite changing background of my desktop. I have switched to DirectX grab from XBMC, sadly didn't show any changes on LEDs.

Is there any chance to show what's AfterGlow pushing to COM port ?

mrjono1 commented 10 years ago

Opps I have not have documented that the Arduino code is also in this repo https://github.com/FrozenPickle/Afterglow/tree/master/Arduino

Afterglow is transmitting this to the COM port on each light change serialData[0] = 'G' serialData[1] = 'l' serialData[2] = 'o' serialData[3] = (byte)((50) >> 8); // LED count high byte serialData[4] = (byte)((50) & 0xff); // LED count low byte serialData[5] = (byte)(serialData[3] ^ serialData[4] ^ 0x55); // Checksum

lightData[0] = //light 1 R lightData[1] = //light 1 G lightData[2] = //light 1 B lightData[3] = //light 2 R lightData[4] = //light 2 G lightData[5] = //light 2 B lightData[6] = //light 3 R lightData[7] = //light 3 G lightData[8] = //light 3 B

//lightData can have a lot of data so we built the buffer to capture it as it is transmitted serialData[6] = lightData;

When selecting a Capture Plugin it is good to know that only one or the other will work because of the way graphics processing is done. Most games and some media players use DirectX, windowed applications like browsers and most media players use the .Net Copy Screen. If you are able to run afterglow on your network and open it on your phone or tablet the preview will show if it works or not.

pigers commented 10 years ago

How do I purge settings of AfterGlow ? I extracted ZIP package but it read settings from somewhere and I cannot find this place.

mrjono1 commented 10 years ago

Settings are stored in "Environment.SpecialFolder.CommonApplicationData" / Afterglow / Afterglow.xml on windows 7 and this is C:/ProgramData/Afterglow/Afterglow.xml, to reset the settings either delete it and the one in the application folder will automatically get moved to ProgramData or manually replace the xml file with one from the zip package or your own backup.

pigers commented 10 years ago

Back there

I have updated my Arduino code with FastLED to look similiar to your but it's not working now. Grab code here: pigers.republika.pl/_backup/WS2812_static.zip I have spotted one issue: when I update in Afterglow number of leds (to 30) after shutting down AG preview is not visible.

mrjono1 commented 10 years ago

I had a look at your code for while and it looks good to me, I haven't found any obvious issues.

Maybe call FastLED.Clear() in MODE_HEADER https://github.com/FastLED/FastLED/wiki/Basic-usage#bringing-in-external-controls this loop does it?

Most change that you do to the settings while running Afterglow will require that you start and stop the preview to make sure it gets the new settings. Also if you navigate away from the preview it should stop but afterglow should still be sending to the arduino.

pigers commented 9 years ago

I can confirm it's working nice with Win 7 : https://www.dropbox.com/s/de9h588qvdb15hz/WP_20150219_195811Z.mp4?dl=0

Now trying to cooperate with Windows 10. Keeps fingers crossed !

mrjono1 commented 9 years ago

pigers your vid looks great!

justinstenning commented 9 years ago

Yeh that's looking great! Now I want to get mine up and running again :)

pigers commented 9 years ago

Unfortunetly on WIndows 10 it's not running correctly. I see some output on screen diagnostic (right screen) but no effect on LEDs. I see that led on Arduino is blinking (one responsible for data activity) but what's going on ... it requires more work to check.

Vid from Win 10 tests: https://www.dropbox.com/s/ism3g5hdetnuizb/WP_20150804_182646Z.mp4?dl=0

mrjono1 commented 9 years ago

It could be the arduino driver for windows 10? I noticed that windows 10 auto installs divers but it didnt get the correct one for my video card maybe you need to update it?

On Wed, Aug 5, 2015 at 4:45 AM, M0C notifications@github.com wrote:

Unfortunetly on WIndows 10 it's not running correctly. I see some output on screen diagnostic (right screen) but no effect on LEDs. I see that led on Arduino is blinking (one responsible for data activity) but what's going on ... it requires more work to check.

Vid from Win 10 tests: https://www.dropbox.com/s/ism3g5hdetnuizb/WP_20150804_182646Z.mp4?dl=0

— Reply to this email directly or view it on GitHub https://github.com/FrozenPickle/Afterglow/issues/25#issuecomment-127708714 .

pigers commented 9 years ago

nope - i can program my arduino under Win 10 for example: https://www.dropbox.com/s/tfgytl18l7673v0/WP_20150806_192236Z.mp4?dl=0

pigers commented 9 years ago

Rolled back to Windows 7 - anyone got issue with Afterglow not showing settings in browser? Example http://prntscr.com/8c9ta1 or better one with adress bar http://prntscr.com/8c9tnq