Settings Ambilight effect with Raspberry Pi «Soloelectronicos

in a previous post saw how to emulate a system “ambiligt” using only a 2 or 3 Raspberry Pi equipped with a compatible distribution (Openelec) and the control software Hyperion leds, with which we can get all done thanks to the Lightberry distribution.» 
In addition to controlling the leds, the combination of Raspberry IP along with Kodi is an excellent Media Center capable of playing all kinds of audio, video and image content, play our multimedia collection stored on the PC or an external drive, and even play online directly content if you have the subscription at home and certainly has enough bandwidth connection as for example with ftth.

the proposal is complete with a TV tuner video that will allow that emulation not only works with the multimedia content reproduced from the Raspberry Pi, also economic will respond to the external video signal that we will introduce coming from an external source video as you can for example be the signal of video from a decoder of Imagenio.

unfortunately sometimes the response of the Hypercon produced in the strip of leds ws2801 does not match the captured image, signal that the file obtained by the Wizard (hypercon.config.son) should improve it but how?

as thanks to the java HyperCon program can indicate the exact position of our leds in the case that the setting made from the menu of Hyperion Config Creator has not offered an expected result.

this software allows among other things to establish the number of leds that check, the first led position, orientation, chipset, etc. enabling a setting very precise behavior of each led in a way individual

before continuing, I want to clarify that HyperCon.jar to work, you must have installed the latest version of Java , so that if you do not have it installed you can download it here

remember with the menu Hyperion Config Creator basic can define the installation of our Lightberry in our TV defining just 5 parameters:

  • type of led Strip: in our you will almost be able to choose Lightberry HD for Rasperry pi (ws2801)
  • number of horizontal leds (must be identical number of leds on both sides)
  • number vertical LEDs (must be identical number of leds on both sides)
  • where begins the first led ( Right/button corner and goes up )
  • confirmation that we have a capture of TV connected

can occur that Although we see the Rainbow, with the obtained settings does not correspond the colours of leds with the image , indicate that must adjust settings manually in a way more accurate using the file hyperion.config.json generated by the wizard in a way more comprehensive using java HyperCon program or so manual.

Obviammente to run this application, as mentioned, must be installed on our computer java

Once unzipped the package of Hypercon, simply run the HyperCon_Sssj.jar file (this file is for example on the route C:UsersxxDownloadshypercon-masterhypercon-masterdebug)

 hypercon

once launched the hypercon will see the graphical interface with a configuration by default that we customize regarding our installation.)

must remember where to put the first led (which is next to the female connector with the jumpwires).

 display

in this personal example, the first led has been in the bottom right corner when viewing the TV from the front (or left) down if you see behind, so the tour of the leds will from the bottom right corner to the left (clockwise).

set up in this way:

  • Direction: clockwise
  • Led top corner: false
  • Led bottom corner: false
  • Horizontal #: 28
  • Vertical #: 14
  • Bottom Gap: 0
  • 1st Led offset: – 42

in our case have to leave a Led count = 84 (or the number of leds you have installed).

Yes in your configuration started for the other corner, change the drop down direction.

in the case of the example not are have placed leds in corners, so you must specify top/bottom to false.

bottom gap must be the same number of leds which at the top, so can leave it “empty”.

very important: in the drop-down 1st Led offset have to be increasing or decreasing until led number 0 is the starting corner (in this example in the lower right corner).

 pantalla.png

once configured according to the led’s have, go to the tab External and in the section Effects Engine Directory type the following: / storage/hyperion/effects which will make that hyperion is the directory of the effects.

can also adjust the time in ms that remains the effect to start in Length (by defetco 9000ms)

 rain

once configured click on the button Create Hyperion Configuration to create the configuration file hyperion.config.json that must be copied in the Raspberry PI directory /storage/.config (do not confuse with the path /storage/hyperion/configuration /)

 hyperion .]

Once copied the file hyperion.config.json in storage/.config restart the RPI and if all goes well you should see a rainbow effect.

Setup initial

the configuration of the device contains the following fields:

  • name’: device user name (used for display purposes only)
  • ‘type’: the type of device or leds (known by now types are ‘ws2801’, ‘ldp8806’, ‘ ‘lpd6803’, ‘sedu’, ‘adalight’, ‘lightpack’, ‘test’ and ‘none’)
  • output : The specification of output depends on the selected device. This can be, for example, the specifier of device, serial number of the device, or the name of the output file
  • rate’: the baudrate of the output to the device
  • colorOrder’: the order of the bytes of color (‘rgb’, ‘rbg’, ‘bgr’, etc.). It is very important to note that if we do not adjust this value the edge of colors can be changed. For example many pull are the t type BGR, which means that if we dial default RGB Red will change in all displays by blue and biceversa

example of configuration of the device section corresponding to the previous post:

“device”: {
“colorOrder”: “bgr”,
“rate”} {: 500000,
“type”: “ws2801”,
“name”: “MyPi”,
“output”: “/dev/spidev0.0”
},

Color

can manipulate the configuration of color manipulation used to adjust output colors to a specific environment.
The configuration contains a list of transformations of color. Each transform contains the following fields:

  • ‘id’: the unique identifier of the transformation of color (e.g.. ‘Device_1’)
  • ‘leds’: the index (or indexes) of leds that applies this transformation of color (for example, ‘ 0 – 5, 9, 11, 12-17’). Rates are based on zero.
  • ‘hsv’: handling in the domain of colours Valor-saturacion – value with the following settings:
    • ‘saturationGain’ the gain adjustment of saturation
    • ‘valueGain’ setting of the gain
  • ‘red’ / ‘green’ / ‘blue’: manipulation in the domain of red-green – blue color with the following parameters for each channel tuning:
    • ‘threshold’ the minimum value of input required to be on the channel
      (más cero)
    • ‘ gamma’ the correction factor of the gamma curve
    • ‘blacklevel’ the lowest possible value (when the channel is black)
    • ‘whitelevel’ the highest possible value (when the channel is white)

to the side list with color transformations, there is also an option of smoothing.
‘Smoothing ‘: smoothing of the colors in the domain of time with the following tuning parameters:

  • ‘type’ type of algorithm of smoothing (‘linear’ or ‘none’)
  • ‘time_ms’ constant time for the algorithm of smoothing in milliseconds
  • ‘updateFrequency’ leds in Hz refresh rate

example of configuration of the color section corresponding to the previous post

“color” : {
“transform”: [
{
“blue”: {
‘threshold’: 0.050000000000000003,
“blacklevel”: 0.0,
“whitelevel”: 0.84999999999999998,
‘gamma’: 2.0
},
“leds”: “0-81”,
“hsv”: {
“saturationGain”: 1.0,
“valueGain”: 1.0
},
“green”: {
‘threshold’: 0.050000000000000003,
“blacklevel”: 0.0,
“whitelevel”: 0.84999999999999998,
“gamma”: 2.0
},
“id”: “leds”,
“network”: {
‘threshold’: 0.050000000000000003,
“blacklevel”: 0.0,
“whitelevel”: 1.0,
“gamma”}}]} {{: 2.0
}
},
{
“blue”: {
‘threshold’: 0.050000000000000003,
“blacklevel”: 0,
“whitelevel”: 0,
“gamma”: 2.0
},
“leds”: “82-149,”
“hsv”: {
“saturationGain”: 0,
“valueGain”: 0
},
“green”: {
‘threshold’: 0.050000000000000003,
“blacklevel”: 0,
“whitelevel”: 0,
“gamma”: 2.0
},
“id”: “ledsOff”,
“network”: {
‘threshold’: 0.050000000000000003,
“blacklevel’: 0,
“whitelevel”: 0,
“gamma”}} [{{:22000000000000002
}
}
]Leds

the settings for each individual led. It contains the specification of the area averaged an input for each led image to determine its color. Each item in the list contains the following fields:

  • index: the index of the led. This determines its location in the chain of leds. zero
    being the first led.
  • hscan: the fractional part of the image along the horizontal used for the average (minimum and maximum inclusive)
  • vscan: the fractional part of the image along the vertical used to average (minimum and maximum inclusive)
  • ‘updateFrequency’ the update frequency of the leds in Hz


“leds” :
[
{
‘index’: 0,
“hscan”: {“minimum”: 0.0000, “maximum”: 0.0500},
“vscan”: {“minimum”: 0.0000, “maximum”: 0.0800}
}
{
‘index’: 1,
“hscan”: {“minimum”: 0.0000, “maximum”: 0.0357},
“vscan”: {“minimum”: 0.0000, “maximum”: 0.0800}
},

… []]

{
‘index’: 87,
“hscan”: {“minimum”: 0.0000, “maximum”: 0.0500},
“vscan”: {“minimum”: 0.0000, “maximum”: 0.0714}
}
]

configuration edges

the black edge configuration, contains the following elements:

  • enable: true if the detector has to be activated
  • threshold: value below which a pixel is considered black (value between 0.0 and 1.0)
    “Blackborderdetector” :

example of configuration of the section blackborderdetector corresponding to the previous post

“blackborderdetector”: {
‘threshold’: 0.10000000000000001,
“enable”: true
}, effects

the effects engine configuration, contains the following elements:

  • path: an array with absolute locations of directories with effects
  • bootsequence : The effect selected as ‘boot sequence’. It is important to change its value in OpenElec “/ storage/hyperion/effects”

example configuration section effects corresponding to the previous post:

“effects”: {
“paths”: [
“/ storage/hyperion/effects”
]
}, recorder

configuration sensor frame, contains the following elements :

  • width: the width of recorded frames [pixels]
  • height: the height of recorded frames [pixels]
  • frequency_Hz: the frequency of the decision framework [Hz]

configuration of the XBMC connection used to enable and disable the sensor frame. It contains the following fields:

  • xbmcAddress : the IP address of the host XBMC
  • xbmcTcpPort: the TCP port of XBMC Server
  • grabVideo : Flag indicating that the collector frame is enabled (true) during video playback
  • grabPictures: Flag indicating that the collector frame is enabled (true) during the presentation of images
  • grabAudio : Flag indicating that the collector frame is enabled (true) during audio playback
  • grabMenu : Flag indicating that the collector frame is enabled (true) in the XBMC menu
  • grabScreensaver: Flag indicating that the collector frame is enabled (true) when XBMC is in the screen saver
  • enable3DDetection : indicator that indicates that the sensor frame should be changed to a module 3D-compatible if playing a video in 3D

example configuration section effects corresponding to the previous post:

“framegrabber”: {
“width”: 64,
“frequency_Hz”: 10.0,
“height”: 64
} ,
“xbmcVideoChecker”: {
“grabVideo”: true,
“grabPictures”: true,
“xbmcTcpPort”: 9090,
“grabAudio”: true,
“grabMenu”: false,
“enable3DDetection”: true,
“xbmcAddress”: “127.0.0.1”,
“grabScreensaver”: true Notes

If you do not want to restart lar RPI whenever you modify the hyperion.config.json configuration file} , you can restart only the service with the following command: killall

hyperiond
/storage/hyperion/bin/hyperiond.sh /storage/.config/hyperion.config.json/dev/null 2 > & 1 &

Add the following line dtparam = spi = on to file config.txt by editing the file or through with the following commands:

mount – or remount , rw/Flash
nano /flash/config.txt (se abrirá el archivo, añadimos la línea y guardamos con Ctrl+X)

reboot test

to check the correct functioning of the system for Android, there is an app that allows you to control the leds by setting a color or applying quite showy effects. It can be downloaded here

 hype

another way to test is by running the following command which will make that all leds are illuminated in red for 5 seconds, you can test various colors, green, blue and others.

/storage/hyperion/bin/hyperion-remote.sh – 50 – color network priority – duration 5000

or this another showing an effect of Rainbow

/storage/hyperion/bin/hyperion-remote.sh – effect “Rainbow swirl fast”-duration 3000

ultuio on youtube can find videos of test to prove that the colors correspond to the image.]]

Be the first to comment

Leave a Reply