Brightness auto adjusting to ambient light level

This is general talk area for things that NOT RELATED WITH TV! Instead, about internal works like web site, forum, wiki, or talking, etc...

tom_van
Official SamyGO Developer
Posts: 147
Joined: Tue Jan 19, 2010 10:44 am

Re: Brightness auto adjusting to ambient light level

Post by tom_van »

erdem_ua wrote:It's configurable on V-USB approach. :D
I don't know if it's same on hardware based MCUs.
Configurable on atmega usb too.
sbav1
Official SamyGO Developer
Posts: 374
Joined: Fri Jan 15, 2010 10:20 am

Re: Brightness auto adjusting to ambient light level

Post by sbav1 »

For comparison purposes, Samsung's own solution (from C-Series service manual ; chassis N96A ):

Code: Select all

In our product, light sensor operates only "Standard" mode.

Eco Sensor
step1 : Read the Lux five times as the unit of 400ms.
step2 : Transfrom the taken Lux to 20 level.
step3 : Get the most frequent grade, them set up the current level.
step4 : If |current level| - |previous level| > 1 , change the level
step5 : Refresh the Backlight set-up as the 200ms.

            Lux       > 200    190    ...   10   0  
  Sensor Backlight       20     19   ....    1   0
In our product, light sensor operates only "Standard" mode (???) - is it actually true in C-Series?
edit: apparently no; eco sensor operation is not restricted to Standard mode only..
tom_van
Official SamyGO Developer
Posts: 147
Joined: Tue Jan 19, 2010 10:44 am

Re: Brightness auto adjusting to ambient light level

Post by tom_van »

sbav, does service manual show where is the sensor located?

Code: Select all

step2 : Transfrom the taken Lux to 20 level.
Hmm, 10 levels were very very rough. 20 is little bit better but why to impose unnecessary leveling at all?
sbav1 wrote: In our product, light sensor operates only "Standard" mode (???) - is it actually true in C-Series?
edit: apparently no; eco sensor operation is not restricted to Standard mode only..
But it makes sense to use sensor only in "Standard" mode. If you set "film" mode you should darken the room
and if you select "dynamic", you're probably blind and no sensor can help you.
sbav1
Official SamyGO Developer
Posts: 374
Joined: Fri Jan 15, 2010 10:20 am

Re: Brightness auto adjusting to ambient light level

Post by sbav1 »

erdem_ua wrote: @sbav1 I think this as command line program... Easier to run/debug :)
Well, in theory we can read configuration settings from I2C EEPROM..
Alas, I think this will be very unreliable method for checking model code:
1) it's guaranteed to work for specific model only (LE*B650). Catch-22 :)
3) it may be dangerous on different firmware/hardware versions
2) using it while exeDSP is running is not 100% predictable (AT24C256B is not stateless device).

Note: sdp_i2c_io.h is from kernel sources (I2C driver code for Chelsea is actually open).

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include "sdp_i2c_io.h"
  
#define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \
  __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0)
  
#define SADDR_ID_PANEL_TYPE      0x6911
#define SADDR_ID_MODEL           0x6912
#define SADDR_ID_PANELTIME       0x691c

int i2c_eeprom_comb_read(int fd, unsigned short subaddr, unsigned short len, unsigned char *buf) {
   struct sdp_i2c_packet_t iicp;
   unsigned char pSA[2];

   pSA[0]=(unsigned char)((subaddr >> 8) & 0xff);
   pSA[1]=(unsigned char)(subaddr & 0xff);
   printf("### i2c_eeprom_comb_read(): SA[0]=0x%02x SA[1]=0x%02x len=%d\n", pSA[0], pSA[1], len);
   iicp.slaveAddr=0xa0;
   iicp.subAddrSize=2;
   iicp.udelay=50;
   iicp.speedKhz=400;
   iicp.dataSize=len;
   iicp.pSubAddr=pSA;
   iicp.pDataBuffer=buf;
   iicp.reserve[0]=iicp.reserve[1]=iicp.reserve[2]=iicp.reserve[3]=0;
   
   return(ioctl(fd, I2C_CMD_COMBINED_READ, &iicp));
}

int main(int argc, char **argv) {
   int fd;
   unsigned char buf[64];
   
   // AT24C256B: I2C bus 1; slave 0xA0; 32kB
   if ((fd=open("/dev/sdp_i2c1", 0x1002)) == -1) FATAL;

   memset(buf, 0, sizeof(buf));
   int res=i2c_eeprom_comb_read(fd, SADDR_ID_MODEL, 1, buf);
   printf("### ioctl result=%d; ID_MODEL setting: %d (0x%02x)\n", res, buf[0], buf[0]);
   
   unsigned utmp=0;
   res=i2c_eeprom_comb_read(fd, SADDR_ID_PANELTIME, 4, (unsigned char *)&utmp);
   printf("### ioctl result=%d; ID_PANELTIME setting: %d (0x%08x) == %d (?) hours\n", res, utmp, utmp, utmp/6);

   close(fd);
   return 0;
} 
Not very good idea for checking model ID form command line, but perhaps useful for making EEPROM backups or something.
sbav1
Official SamyGO Developer
Posts: 374
Joined: Fri Jan 15, 2010 10:20 am

Re: Brightness auto adjusting to ambient light level

Post by sbav1 »

tom_van wrote:sbav, does service manual show where is the sensor located?
Can't find an exact location in SM; I guess it's on "Function & IR" board (panel keys + IR sensor).
There is service setting in factory menu for "Front Color" (NONE, W-Milky, T-M-Brn, T-W-Brn, T-W-Gray, W-D-Gray, W-M-Whit W-Violet, T-C-Gray, T-R-BLK, S-BLK, S-C-Gray)
which AFAIRC affects eco-sensor calculations. If there is semi-transparent/semi-colored front bezel element in given C-Series model, sensor is probably located behind this element.
But it makes sense to use sensor only in "Standard" mode. If you set "film" mode you should darken the room
Well, I'm mostly using "Movie" (decent color rendition, nearly no banding), even in broad daylight ;). "Movie" is significantly better than "Standard" & "Normal" in my LE37B650 (CMO panel).
sbav1
Official SamyGO Developer
Posts: 374
Joined: Fri Jan 15, 2010 10:20 am

Re: Brightness auto adjusting to ambient light level

Post by sbav1 »

BTW (hardware-wise), I wonder if some "el cheapo" USB webcams (3 EUR or so) can be used as light sensors. I dismantled one of those couple of months ago,
and there was photoresistor inside (for auto adjusting LED lights level, I guess). But is that sensor value readable via USB?

Well, if not: with a little effort (V4L drivers, etc.) we can probably use webcam itself (with lens removed) as a sophisticated light sensor (sort of).
After all, it has at least 320x240 built-in photodiodes ;).
tom_van
Official SamyGO Developer
Posts: 147
Joined: Tue Jan 19, 2010 10:44 am

Re: Brightness auto adjusting to ambient light level

Post by tom_van »

I'm sure that typical webcam has exposure auto setting, so the overall light level is intentionally removed from output. There might be some special readings but I doubt if on "el cheapo".
User avatar
erdem_ua
SamyGO Admin
Posts: 3126
Joined: Thu Oct 01, 2009 6:02 am
Location: Istanbul, Turkey
Contact:

Re: Brightness auto adjusting to ambient light level

Post by erdem_ua »

Ahahaha. :lol:
3$ web cam :D over kill & cheaper :)
I think I needed to hurry to publish things...
Placed tapatalk plugin to forum, piwik scripts...
Needed to setup gravatar and some other minor things.
Than I think I could turn back to this again :)
sbav1
Official SamyGO Developer
Posts: 374
Joined: Fri Jan 15, 2010 10:20 am

Re: Brightness auto adjusting to ambient light level

Post by sbav1 »

tom_van wrote:I'm sure that typical webcam has exposure auto setting, so the overall light level is intentionally removed from output.
Aye, to prevent AE/AWB from working we will need some reference light source (small white LED ?) shining on the 2/3 of the sensor and read the ambient light from the remaining 1/3 or so.
Also in theory we can compute standard deviation/SNR, should be (roughly) reverse proportional to ambient light level.
But, seriously, I know this is not very practical solution :). Anyway, getting UVC drivers working for 2.6.18 kernel will probably require a lot of backporting.
There might be some special readings but I doubt if on "el cheapo".
I looked into this webcam (TC102 Titanum ???) again; photoresistor is most probably just a part of (very simple) circuit for backlight LED[s] driver. It's not readable from USB, unless I'm very much mistaken :(
tom_van
Official SamyGO Developer
Posts: 147
Joined: Tue Jan 19, 2010 10:44 am

Re: Brightness auto adjusting to ambient light level

Post by tom_van »

I released Autobright app for A-series SH - see viewtopic.php?f=8&t=2068
Works with both serial and USB (atmega32u4 dongle) and also should work with erdem's attiny/V-USB based sensor.
It includes programmers exercise - graphic setup screen - I hope it is usable for B series as well.

Post Reply

Return to “General”