OUR NETWORK: TechLore Explore3DTV MyOpenRouter MediaSmart home TiVoCommunity See all... About UsAdvertiseContact Us

 
Learn about scoring Forum's Raw Score: 9896010.0
April 13, 2010 11:36 AM

Categories: Rovio

Rating (1 votes)
  • 1
  • 2
  • 3
  • 4
  • 5
Rate This!

Member Avatar

Gandalf

Member
Joined: 02/10/2010

I think I have figured out the issue of Rovio camera brightness control and have a fix. I achieved this by digging into the source code just released, and diassemble and compare to the BIN file. After the fix, you will find the brightness control will have more remarkable effection than before. IE, when you set the brightness to highest, the brightness is much brighter than before!!!

Seems that the camera contrast is still not enough. I will try to see if any other hack improvement can be found.

Instructions (only work for Firmware v5.03....)

Invoke the following URLs one by one, then re-adjust your Rovio brightness. (replace ... with the right address)

http://.../debug.cgi?action=write_mem&address=0x0009fb9c&value=0x03a0107f
http://.../debug.cgi?action=write_mem&address=0x0009fb9d&value=0x0ae3a010
http://.../debug.cgi?action=write_mem&address=0x0009fba4&value=0x03a010af
http://.../debug.cgi?action=write_mem&address=0x0009fba5&value=0x08e3a010
http://.../debug.cgi?action=write_mem&address=0x0009fbac&value=0x03a010cf
http://.../debug.cgi?action=write_mem&address=0x0009fbad&value=0x06e3a010
http://.../debug.cgi?action=write_mem&address=0x0009fbb4&value=0x03a01000
http://.../debug.cgi?action=write_mem&address=0x0009fbb5&value=0x04e3a010
http://.../debug.cgi?action=write_mem&address=0x0009fbbc&value=0x03a01025
http://.../debug.cgi?action=write_mem&address=0x0009fbbd&value=0x02e3a010
http://.../debug.cgi?action=write_mem&address=0x0009fbc4&value=0x03a0104a
http://.../debug.cgi?action=write_mem&address=0x0009fbc5&value=0x00e3a010
http://.../debug.cgi?action=write_mem&address=0x0009fbcc&value=0x03a0107f
http://.../debug.cgi?action=write_mem&address=0x0009fbcd&value=0x55e3a010

=================

Some update on the solution:

Figured out by Chris75, another more simple command can be used instead.

IE, to set the brightness, use URL like

http://..../debug.cgi?action=write_i2c&address=0x55&value=0xnn

where  nn is a hex value from 0x00 ~ 0xff.

The trend of the value is

0xff (darkness)  ->  0x80 ,  0x00 (middle brightness)  -> 0x7f (brightest)

To set the contrast, use URL like

http://.../debug.cgi?action=write_i2c&address=0x56&value=0xnn

where nn is a hex value from 0x00~0xff.   0x00 is with the least contrast, while 0xff is with the most contrast.

[Thanks Chris75 for figouring out the write_i2c debug fucntion.]

Two other useful options to get better poor-light performance:

a) Minimum frame rate during night mode. When the light is low, the night mode will automatically reduce the frame rate by multi-sampling. The more the frame rate is reduced, the more brightness it will get.

address: 0x3b. 

Bits 7: 0 - disable night mode. 1- enable night mode (default for Rovio)

Bits 6~5

00 (default for Rovio): same as normal rate (means no use of night mode at all!)

01: 1/2 of normal mode frame rate

10: 1/4 of normal mode frame rate

11: 1/8 of normal mode frame rate

It needs to disable then reenable night mode to make it effective, so two commands are requird:

http://.../debug.cgi?action=write_i2c&address=0x3b&value=0x02

http://.../debug.cgi?action=write_i2c&address=0x3b&value=0xe2 (or, 82,a2,c2,e2)

b) The Auto Gain Control has a ceiling option, from 1x to 128x. Default is just 2x, in darkness it is not enough.  When using higher AGC ceiling, the brightness will be improved while in extra darkness, however the noise of the image will increase as well. Compared to option a, the pros is that it does not reduce framerate.

Address: 0x14

bit 6-4: 000, 2x; 001, 4x;....;110:128x

SO use the command:

http://.../debug.cgi?action=write_i2c&address=0x14&value=0xn8

where n = 0,1,2,....,6

Please see http://www.robocommunity.com/download/17526/RovioBrighter/ for a stand-alone web page called RovioBrighter for setting the brightness/contrast quickly, no matter what client software you are using.

Once this is incorporated in the Rovio client software, you can dump the RovioBrighter as you will. ^  ^

Gandalf

RovioBrighter - brighter your Rovio!
http://www.robocommunity.com/download/17526/RovioBrighter/

Discussion:    Add a Comment | Comments 1-15 of 53 | Latest Comment | 1 2 3 4 Next »

April 13, 2010 11:43 AM

The piece of code is in dsplib.c:

void dspSetBrightnessContrast_ov7670 (int nContrast, int nBrightness, int nAdjMode)
{
/* Contrast not set */
switch (nBrightness)
{
case 0:
i2cWriteI2C (0x55, 0xFF);
break;
case 1:
i2cWriteI2C (0x55, 0xE9);
break;
case 2:
i2cWriteI2C (0x55, 0xD4);
break;
case 3:
i2cWriteI2C (0x55, 0xBF);
break;
case 4:
i2cWriteI2C (0x55, 0xAA);
break;
case 5:
i2cWriteI2C (0x55, 0x95);
break;
case 6:
i2cWriteI2C (0x55, 0x80);
break;
default:
;
}
}

By looking into the datasheet of OV7670 (the camera CMOS chip), the range of the brightness should be around 00~FF. Someone told me that it translates to signed byte, ie, -128~127. So I conclude that the original code does not set the brightness to even beyond zero.

If my finding is right, I am so confused why this was not figured out by Woewee team.

RovioBrighter - brighter your Rovio!
http://www.robocommunity.com/download/17526/RovioBrighter/

April 13, 2010 12:12 PM

To set the contrast, I can hack the number 0x55 to 0x56, then the brightness control API would turn to be the contrast control instead.

Will post a web HTML file for it to be easier to be done some time.

RovioBrighter - brighter your Rovio!
http://www.robocommunity.com/download/17526/RovioBrighter/

April 14, 2010 1:23 AM

Hello Gandalf, Great job in discovering this birghtness and contrast control, I'll be looking forward to th HTML file.
What else have you found!?

Freddy

April 14, 2010 4:39 AM

I did not have chance to find other things, yet. Because the camera brightness is the bitter for me, and I did compare the Rovio with normal PC cam and even mobile cam, so I believe the performance should not be that worse.

Freddy, did you try the hack and does it work fine?

RovioBrighter - brighter your Rovio!
http://www.robocommunity.com/download/17526/RovioBrighter/

April 14, 2010 6:04 PM

I havent tried it, I was going to wait for the HTML file you mentioned above. I will try it out but first calarify for me this; should I connect to rovio webpage an then begin pasting one by one the url and should I use the port number too in the ip address?

April 14, 2010 9:47 PM updated: April 14, 2010 9:53 PM

Hello Gandalf

Very good work! I was waiting for a solution like this to gain the camera picture brightness directly by the source. With this mod it's first time possible to see more details in darker rooms. This night I added the new version 1.2 of RovioDirect with a new "hacks & mods" section in the config file. Your commands are good to combine with this new feature.

To turn up the brightness by your way in RovioDirect, do the follow:
- use the new version 1.2
- open the configuration file of RovioDirect
- replace or add the following code in the "hacks & mods" section:

RobotBeforeInitCommand=ChangeResolution.cgi?ResType=0
RobotBeforeInitCommand=ChangeBrightness.cgi?Brightness=0
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fb9c&value=0x03a0107f
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fb9d&value=0x0ae3a010
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fba4&value=0x03a010af
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fba5&value=0x08e3a010
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fbac&value=0x03a010cf
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fbad&value=0x06e3a010
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fbb4&value=0x03a01000
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fbb5&value=0x04e3a010
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fbbc&value=0x03a01025
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fbbd&value=0x02e3a010
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fbc4&value=0x03a0104a
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fbc5&value=0x00e3a010
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fbcc&value=0x03a0107f
RobotBeforeInitCommand=debug.cgi?action=write_mem&address=0x0009fbcd&value=0x55e3a010
RobotAfterInitCommand=ChangeBrightness.cgi?Brightness=6 'new brightness value (1-6)

- (re)start RovioDirect and see the new much brighter pictures
- if its to bright, modify the last line to ...Brightness=4… and restart RovioDirect again

Hope it's usefull.

Kind regards

April 14, 2010 10:59 PM updated: April 14, 2010 10:59 PM

Andreas said: Hello Gandalf Very good work! I was waiting for a solution like this to gain the camera picture brightness directly by the source. With this mod it's first time possible to see more details in darker rooms. This night I added the new version 1.2 of RovioDirect with a new "hacks & mods" section in the config file. Your commands are good to combine with this new feature. To turn up the brightness by your way in RovioDirect, do the follow: - use the new version 1.2 - open the configuration file of RovioDirect - replace or add the following code in the "hacks & mods" section: RobotBeforeInitCommand=ChangeResolution.cgi?ResType=0 ........RobotAfterInitCommand=ChangeBrightness.cgi?Brightness=6 'new brightness value (1-6) - (re)start RovioDirect and see the new much brighter pictures - if its to bright, modify the last line to ...Brightness=4… and restart RovioDirect again Hope it's usefull. Kind regards

Hei,

Glad to see that my finding and fix also works for you and others. Excellent!  Please feel free to incorporate to any client software if you like.

However I found I thought it wrong about the brightness value when it is over 0x80. The right trend of the value should be:

0xff - most darkness.    0x80 , or 0x00 - medium       0x7f   - most brightness

My previous commands are also a little bit redundant. I will optimize them and let you know.

Another thing is, I have figure out the way to set the contrast as well. I will post it later.

I still work on a HTML file that can open locally and make the change. Then the control can be used by all but not limited to any client software.

RovioBrighter - brighter your Rovio!
http://www.robocommunity.com/download/17526/RovioBrighter/

April 14, 2010 11:02 PM

FreddyA said: I havent tried it, I was going to wait for the HTML file you mentioned above. I will try it out but first calarify for me this; should I connect to rovio webpage an then begin pasting one by one the url and should I use the port number too in the ip address?
You may or may not connect to Rovio webpage first, I think.  You can directly input the URLs above, and the first URL may prompt you for the user name and password. You can then use other client software or the original web to adjust the brightness to see the effection.

RovioBrighter - brighter your Rovio!
http://www.robocommunity.com/download/17526/RovioBrighter/

April 14, 2010 11:31 PM

I have released the first version of HTML file to do the hack of brightness/contrast control.

Please see
http://www.robocommunity.com/download/17526/RovioBrighter

Enjoy it and don't hesitate to let me know your comment.

RovioBrighter - brighter your Rovio!
http://www.robocommunity.com/download/17526/RovioBrighter/

April 15, 2010 7:37 AM

Gandalf,
this is just excellent! and probably first Rovio FW evolution based on release sources.
In case anyone needs it, i used this shell script to apply change to mine:

#!/bin/sh
# Use your settings for IP / Login / PWd
USER=admin
PASSWD=password
IP=192.168.0.1

POKES="0x0009fb9c&value=0x03a0107f 0x0009fb9d&value=0x0ae3a010 \
0x0009fba4&value=0x03a010af 0x0009fba5&value=0x08e3a010 \
0x0009fbac&value=0x03a010cf 0x0009fbad&value=0x06e3a010 \
0x0009fbb4&value=0x03a01000 0x0009fbb5&value=0x04e3a010 \
0x0009fbbc&value=0x03a01025 0x0009fbbd&value=0x02e3a010 \
0x0009fbc4&value=0x03a0104a 0x0009fbc5&value=0x00e3a010 \
0x0009fbcc&value=0x03a0107f 0x0009fbcd&value=0x55e3a010 "

echo "Going to poke with : " $POKES

for i in $POKES; do wget --user $USER --password $PASSWD "http://$IP/debug.cgi?action=write_mem&address=$i" ;done
wget --user $USER --password $PASSWD "http://$IP/ChangeBrightness.cgi?Brightness=6"

April 15, 2010 8:56 AM

Gandalf said: I have released the first version of HTML file to do the hack of brightness/contrast control. Please see http://www.robocommunity.com/download/17526/RovioBrighter Enjoy it and don't hesitate to let me know your comment.
Thanks for doing this, Gandalf! Unfortunately, I get an "access denied" error with this link.

April 15, 2010 9:17 AM

DaveL said:
Gandalf said: I have released the first version of HTML file to do the hack of brightness/contrast control. Please see http://www.robocommunity.com/download/17526/RovioBrighter Enjoy it and don't hesitate to let me know your comment.
Thanks for doing this, Gandalf! Unfortunately, I get an "access denied" error with this link.

Oh I am not sure what happened.  I just submitted the new download, and I can get to it from the direct link. However, I do notice that the thing I submitted does not show up in the list of Downloads at all.

I have sent out a mail to administrator to ask.

RovioBrighter - brighter your Rovio!
http://www.robocommunity.com/download/17526/RovioBrighter/

April 15, 2010 9:19 AM

chris75 said: Gandalf, this is just excellent! and probably first Rovio FW evolution based on release sources. In case anyone needs it, i used this shell script to apply change to mine: #!/bin/sh # Use your settings for IP / Login / PWd USER=admin PASSWD=password IP=192.168.0.1 POKES="0x0009fb9c&value=0x03a0107f 0x0009fb9d&value=0x0ae3a010 \ 0x0009fba4&value=0x03a010af 0x0009fba5&value=0x08e3a010 \ 0x0009fbac&value=0x03a010cf 0x0009fbad&value=0x06e3a010 \ 0x0009fbb4&value=0x03a01000 0x0009fbb5&value=0x04e3a010 \ 0x0009fbbc&value=0x03a01025 0x0009fbbd&value=0x02e3a010 \ 0x0009fbc4&value=0x03a0104a 0x0009fbc5&value=0x00e3a010 \ 0x0009fbcc&value=0x03a0107f 0x0009fbcd&value=0x55e3a010 " echo "Going to poke with : " $POKES for i in $POKES; do wget --user $USER --password $PASSWD "http://$IP/debug.cgi?action=write_mem&address=$i" ;done wget --user $USER --password $PASSWD "http://$IP/ChangeBrightness.cgi?Brightness=6"
This is great.  Maybe I will just release the tech detail of the hack and finding, so that you guys can use the finding in different way freely.

RovioBrighter - brighter your Rovio!
http://www.robocommunity.com/download/17526/RovioBrighter/

April 15, 2010 9:45 AM

Gandalf said:
DaveL said:
Gandalf said: I have released the first version of HTML file to do the hack of brightness/contrast control. Please see http://www.robocommunity.com/download/17526/RovioBrighter Enjoy it and don't hesitate to let me know your comment.
Thanks for doing this, Gandalf! Unfortunately, I get an "access denied" error with this link.
Oh I am not sure what happened.  I just submitted the new download, and I can get to it from the direct link. However, I do notice that the thing I submitted does not show up in the list of Downloads at all. I have sent out a mail to administrator to ask.

Yes it is now fixed as the administrator (Peter) has helped me to post it so that everybody can see and download now.

RovioBrighter - brighter your Rovio!
http://www.robocommunity.com/download/17526/RovioBrighter/

April 15, 2010 11:27 AM

Works perfectly! Thanks!

Discussion:    Add a Comment | Back to Top | Comments 1-15 of 53 | Latest Comment | 1 2 3 4 Next »

Add Your Reply

(will not be displayed)

Email me when comments are added to this thread

 
 

Please log in or register to participate in this community!

Log In

Remember

Not a member? Sign up!

Did you forget your password?

You can also log in using OpenID.

close this window
close this window