Page 1 of 16

[App] libAmbiLight E/F/H (MST-only)

Posted: Mon Jul 09, 2018 12:33 am
by adonis
AmbiLight for your Samsung TV
Image

Version 3.0
Features:
- Added black-border detection
Fixes:
- Fixed crashing with H_LEDS and V_LEDS
- Fixed mapping with H_LEDS and V_LEDS


The lib uses partly code of zoelechat's libScreenShot, except that it sends the data via UDP to an ESP8266 controller. So, without zoelechat, this project wouldn't be able - thx man! ;-)

Demo
https://www.youtube.com/watch?v=mOQVHFVH3VQ
Due to the fact that the script does not grab the data exactly from the edges but with some padding (to avoid black borders), therefore it looks like they're a bit offset.

Requirements
  • adressable LED-Controller (WS28x, anything that's supported by FastLED)
  • ESP8266-12E (the one with the USB-port, less headache :D )
  • PSU (power-supply for LED-strip)

Installation
  • Get your LED light mounted and connected correctly and verify that it works with FastLED (use the Blink example)
  • Modify the attached app.ino, especially the LEDS and WiFi-settings
  • upload app.ino to the ESP8266
  • Copy libAmbilight.so to the libSo directory (usually /mnt/opt/privateer/usr/libso
  • Modify 99_100_AmbiLight.init to your needs (see section "Settings")
  • Copy 99_100_AmbiLight.init to /mnt/etc/init.d (CAUTION!!! Test first that everything works fine, before you procede to this step)
If you experience strange color, try setting the FastLED color-ordering, to a different one (like RGB, BGR, etc...).

Code: Select all

FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, BGR>(leds, NUM_LEDS);
Settings

H_LEDS amount of your horizontal leds (only on one side, top or bottom)
V_LEDS amount of vertical leds (only on one side, left or right)
SERVER_IP IP of the ESP8266
SERVER_PORT Port on which the ESP8266 operates (default 5050)
OFFSET Shift the LED data by this number (positive numbers only, max size of led-strip), generally the led-data starts at the bottom right corner (if you stand in front of your TV)
SLEEP (default: 1) the higher the value, the slower LED-change - increase this to 2 or 3 if you experience crashes
REVERSE set this option if LEDs are in reversing order

Testing
The log-output can be found under /dtv/AmbiLight.log (this is only populated in testing mode)
Use the example image, attachted here and cast it to your TV.
Modify and execute the following command.

Code: Select all

samyGOso -d -T -B -l /mnt/opt/privateer/usr/libso/libAmbiLight.so H_LEDS:36 V_LEDS:18 SERVER_IP:192.168.1.32 SERVER_PORT:5050 OFFSET:17 REVERSE TEST
You may need to delete REVERSE and/or COLOR.
If all is set up, you should at least see some lights :D

or with ALT
not working yetShow

Code: Select all

samyGOso -d -T -B -l /mnt/opt/privateer/usr/libso/libAmbiLight.so H_LEDS:36 V_LEDS:18 SERVER_IP:192.168.1.32 SERVER_PORT:5050 OFFSET:17 REVERSE TEST ALT

Limitations
  • Currently only MST-devices supported
  • Currently no support for "gap" on the bottom of the TV
Donation
Since I do stuff like this as a hobby - feel free to donate :-)


ToDo
- Modify ESP8266 firmware to be controllable via smartphone

Source code
https://gitlab.com/ad-on-is/samsung-ambilight

Re: [App] libAmbiLight E/F/H

Posted: Fri Jul 13, 2018 10:21 pm
by adonis
Added optimized version.

Re: [App] libAmbiLight E/F/H

Posted: Fri Jul 13, 2018 10:33 pm
by fluffi444
Even if I do not use this right now I want to leave a thanks for your work! Sounds promissing!
Thanks for your work and even more for sharing it!

Do you have an experience if the 0.3 sec injecting will put to much load on the system?

Re: [App] libAmbiLight E/F/H

Posted: Fri Jul 13, 2018 10:42 pm
by zoelechat
adonis wrote: Mon Jul 09, 2018 12:33 am Right now I'm using a bash-script to inject with samyGOso every 0.3 seconds. Is there a better way to use a loop in the code itself? I tried doing so, but It only sends the data of the first screen captured.
You can make a resident lib, even if you "hook nothing" :)

Re: [App] libAmbiLight E/F/H

Posted: Sat Jul 14, 2018 8:17 pm
by asiersan
I must try, i would bougth leds etc... . Thanks



Enviado desde mi iPhone utilizando Tapatalk

Re: [App] libAmbiLight E/F/H

Posted: Sun Jul 15, 2018 12:15 pm
by adonis
Updated version. Now officially v1.0 :P
- Added support vor clockwise and counter-clockwise mount
- Optimized code for better performance
- Runs now at 0.2s with no overload after some time, TV hangs, so use 0.3s instead
- Added demo-video

Re: [App] libAmbiLight E/F/H

Posted: Sun Jul 15, 2018 12:17 pm
by adonis
fluffi444 wrote: Fri Jul 13, 2018 10:33 pm Even if I do not use this right now I want to leave a thanks for your work! Sounds promissing!
Thanks for your work and even more for sharing it!

Do you have an experience if the 0.3 sec injecting will put to much load on the system?
I've optimized the code now, and I'm injecting with 0.2s
0.3 doesn't put to much load, although 0.2 does, so it crashes after a while (2-3 hours). Need to investigate further.
Also, I've measured the FastLED script and it takes 0.24s for the LEDs to fade from one state to another, so IMHO no need to go lower here.

Re: [App] libAmbiLight E/F/H

Posted: Sun Jul 15, 2018 12:34 pm
by adonis
zoelechat wrote: Fri Jul 13, 2018 10:42 pm
adonis wrote: Mon Jul 09, 2018 12:33 am Right now I'm using a bash-script to inject with samyGOso every 0.3 seconds. Is there a better way to use a loop in the code itself? I tried doing so, but It only sends the data of the first screen captured.
You can make a resident lib, even if you "hook nothing" :)
I will give it a try, when I find some spare-time again :-D
But as of now, with optimised code, it works better than expected ;-)

Do you think there's an advantage when injecting as resident compared to the current in- and deject script?

Re: [App] libAmbiLight E/F/H

Posted: Sun Jul 15, 2018 12:50 pm
by zoelechat
You'd save init and deinit time of each injection, not easy to quantify but probably noticeable when so often (in addition to avoid possible unstability cause).
Nothing more than inject -r and a loop inside lib needed, it's almost ready I'd say :)

Re: [App] libAmbiLight E/F/H

Posted: Sun Jul 15, 2018 12:59 pm
by adonis
zoelechat wrote: Sun Jul 15, 2018 12:50 pm You'd save init and deinit time of each injection, not easy to quantify but probably noticeable when so often (in addition to avoid possible unstability cause).
Nothing more than inject -r and a loop inside lib needed, it's almost ready I'd say :)
At the very first beginning, I tried the loop, but it only received the frameBuffer that it grabbed on injection... it did not update. Therefore I wrote the bash-script.
Although, I must admit, that I did not inject with "-r", so I don't know if that was the problem, or not.
Nothing more than inject -r and a loop inside lib needed
So, I don't need all these "hooks" and I also don't need to check if already hooked "_hooked=1" ... etc?