antonpup / Aurora

Unified lighting effects across multiple brands and various games.
http://www.project-aurora.com/
MIT License
1.83k stars 368 forks source link

[Question] Anybody interested in a analog RGB light stripe implementation for Arduino + Aurora? #473

Open rkkoszewski opened 7 years ago

rkkoszewski commented 7 years ago

Hi, yesterday I got myself an Arduino and decided to convert an old decoration LED stripe as a ambi-light for my PC.

Please note that there are two kind of RGB LED stripes. The digital (that support different colors for different areas) and the analog one that has only one global color.

This implementation is for the second one (analogue). Powered by an Arduino and its serial port connection.

I already have implemented the code running in the Arduino, and the integration with Aurora , and its working very nicely so far. Works even better than my Clevo implementation that requires Admin privileges. I even implemented color transitions and fading to be computed on the Arduino, for perfect smooth transitions.

I implemented it on an older version of Aurora, but there should be no issues upgrading it to the latest version. I could do that when I find a free moment.

So I would just like to know if anybody would be interested in this, or if it would be even something worth to integrate into the main Aurora app.

Greetings.

andyman1222 commented 7 years ago

I will look into this once I get the H-bridges or mosfets connected and working with the Arduino. Do you think you can make something like this but for the Raspberry Pi so it can run alongside digital LEDs? If I had the time I would try doing this myself.

rkkoszewski commented 7 years ago

Hi @andyman1222. I don't have a Raspberry Pi nor digital LEDs to implement and test it. If I'm not wrong there is a RPi implementation here that should be working already: https://github.com/antonpup/Aurora/tree/pi-lighting

If @antonpup decides to merge the pi implementation to main then it should be able to work together with the digital RPi and the analog RGB using Arduino.

rkkoszewski commented 7 years ago

Here goes the Arduino sketch: https://github.com/rkkoszewski/ArduinoRGBLedDriver And my implementation in an older version of Aurora: https://github.com/rkkoszewski/Aurora/tree/dev

Ghanigan commented 7 years ago

Would this work with V0.6.0b? I am very interested in this.

antonpup commented 7 years ago

@rkkoszewski Umm... the RPi implementation doesn't need to be merged with main. I just wanted to have it on a separate branch so it's easier for people to download and install. My RPi implementation is a script addon, so it will work regardless.

There are two ways to go about your implementation: 1. Merge your Ardino device as part of Aurora and give users options to define the device (ip or whatever you use to connect). 2. You could convert your implementation into a script and PR it to the RPi branch.

But I don't have an arduino not analog lights to test with. So... up to you.

rkkoszewski commented 7 years ago

Nice!! Thats good news!!

So I finally managed to upgrade the Arduino light script to work with the lateat Aurora implementation (the latest dev beta version). I'll commit it tomorrow if I won't forget it. The only bad thing is that my commits got all mixed in my local dev branch, so my Mirage ambient light test implementation and other minor stuff is there too.

I really like that the latest version is showing the latency of the device, in the Arduino implementation I've never seen it going over 0ms. But my clevo implemwntation loves to spike to sometimes over 50ms. So I'm wondering how Aurora is handling the calls to the different devices? Is it happening in parallel or one after another? Is it blocking or non blocking? In other words, if one device has high latency, does it affect the other devices? If yes I could optimize my Clevo implementation to make it asynchronous as I did in my C++ implementation, that way it should have near zero latency and the lights will be updated when they are ready to do so. I just need to know if this is even needed or if Aurora already handles it asynchronously?

Greetings.

Ghanigan commented 7 years ago

I cannot get Aurora to recognise the arduino with the version you have made. Is there anything I am missing? I have changed all the COM4 instances to COM5, but can't get any response, despite aurora saying 0ms delay.

rkkoszewski commented 7 years ago

Hi, its probably because I updated the Arduino sketch to support custom configuration commands from Aurora, and some IDs have changed. Tomorrow I'll push both my latest update to Aurora and the new Sketch.

Now it is possible to set the com port from within Aurora, and also custom white points (R,G,B), enable gamma correction, enable smooth transitions, and some more stuff which will be automatically configured on the Arduino on connect.

Ghanigan commented 7 years ago

Cool. I'll test it as soon as I can.

rkkoszewski commented 7 years ago

Hi, so I finally updated my Aurora build and the Arduino Sketch. Took a bit longer than expected (health stuff). Here are the links to the repos: https://github.com/rkkoszewski/Aurora https://github.com/rkkoszewski/ArduinoRGBLedDriver

You can set the COM port and sevarl setting from withing Aurora. Only max-brightness is still not working. Let me know if it Works for you @Ghanigan .

Here is a compiled version of Aurora: https://github.com/rkkoszewski/Aurora/releases/tag/AnalogRGB.1.0

MikeUNtested commented 7 years ago

I have just a single color led strip connected with my arduino. I loaded your sketch and activated your Aurora version but the leds are only white, after activating the serial Arduino in settings. From what should it use the color?

Do I have to make a specific layer?

rkkoszewski commented 7 years ago

I'm using the "PeriphericDevice" as color source, the same as the Clevo Touchpad. I've set the "Preferred Mouse" to "Clevo - Touchpad" and use that one. I haven't tested other configurations, but I guess that any Peripheric Device color is the same.

MikeUNtested commented 7 years ago

Ah ok thanks. It works. <3 Goodjob @rkkoszewski .

Ghanigan commented 7 years ago

This works! But my strip is common cathode, so all the colours are inverted. What's the best way to swap this? edit- I have just inserted "255 - " for filter brightness, this seems to work perfectly for the time being. Thank you so much for all of this! edit2 - Using this version of Aurora stops keyboard illumination? It can be fixed by using the released beta version however. Any Idea @rkkoszewski?

UnCanard14 commented 7 years ago

Hello I have a RGB strip same as https://www.adafruit.com/product/1138 I use it as Ambilight with https://gitlab.com/UnCanard14/Ambient And I was interested by Pi Backlighting but my strip is not compatible with https://github.com/rkkoszewski/ArduinoRGBLedDriver and I ask you if somebody can do something for me ? =)

antonpup commented 7 years ago

@UnCanard14 I have same if not exact strip. I use it with a Raspberry Pi. A device script for it can be found on this branch: https://github.com/antonpup/Aurora/tree/pi-lighting

UnCanard14 commented 7 years ago

@antonpup Thank you very much for your answer, I will look at it

UnCanard14 commented 6 years ago

Hi @simon-wh It will be great if you can merge the part of the code of @rkkoszewski in the v0.7.0 about the arduino in the layer Devices & Wrappers =). Cordially https://github.com/rkkoszewski/Aurora/releases/tag/AnalogRGB.1.0

samwell1 commented 6 years ago

Hello everyone. Very cool and interesting this idea of ​​integration with arduino. I have a question, is there any way to integrate with Digital RGB Led Strip? Like the ws2811 / ws2812b? Thank you.

rkkoszewski commented 6 years ago

I don't remember the code I wrote for this project. But I actually ported ws2811 Arduino scripts to regular analogue RGB strips. There are plenty very easy to use libraries that allows to control the colours very easily. Though my script only supports one region, so you won't be able to take advantage of the full sectorial features that the ws strips have. I may look into it once I'm done writing my master thesis.

samwell1 commented 6 years ago

Oh! Cool! I am looking for various ways to integrate with Arduino and Digital RGB Strip. I even found some links with this idea, like this:

https://github.com/antonpup/Aurora/issues/846

I'm really excited about all this. In raspberry pi is very cool synced effects. Thank you for your support.

duythvn commented 6 years ago

hey @rkkoszewski I'm exploring the possibility to sync Aurora effects to a wireless adruino LED setup I'm considering the esp32, do you think this can be done (just asking before I go source for the parts)

cheers

rkkoszewski commented 6 years ago

Hi @duythvn. I made a ESP8266 ESP-01S version for myself way back in time. I can see if I can find it somewhere. It was TCP based, which made it very crappy (FPS wise). I'm reverse engineering the DreamScreen protocol which uses UDP and promises 60fps updates for LED lights. Once I've reverse engineered the protocol I can implement a similar o a compatible protocol for the device.

P.D: sorry for kind of abandoning on the project. I've finally finished my master's degree, and now I'm looking for work, there is always something to be busy with. :D

duythvn commented 6 years ago

@rkkoszewski thanks for sharing your insights. I know we all have other responsibilities to take care of :) good luck with the job hunt and hope to hear from you if you have any chances with that cool reverse engineering project