Sunday 8 March 2015

Reverse camera overlay hack (removal)

A while ago I purchased a reverse camera from ebay. It turned out to be NTSC and I got a refund because I needed a PAL one for a peculiar monitor. I got to keep the cam, so I was hoping to use it in some projects, but as it turns out it is mirrored and it also has a nasty overlay on it.


As such it was lost around my house for a while, until yesterday when I needed a camera so I plug it in and remember that the image is mirrored, and perhaps I should get rid of the mirroring and the overlay while I am at it.

(24c08) the mobile phone dvd lens magnifier was useful
Some searching revealed a single thread which showed the I2C chip can be disabled by shorting the SCL or SDA pin to ground. This will disable the eeprom and use whatever defaults the camera IC uses. That means mirror / pal/ntsc could change, and possible image corrections, too. Note this only works with I2C chips, some chips use SPI which will not like a pin shorted to ground( damage will occur). The SPI chips need disconnected power pin.



I tried this and it works on this camera chip, but the image is still mirrored, although the overlay is gone. As such I commenced searching for more info. I found the camera chip is PC1030K , and even found a datasheet for it on a strange site. Why does this not happen on all the other searches I do?

It turns out there is a hardware configuration using pull up/down resistors on 8 pins used for digital data output. Those could be set to for mirror / pal /ntsc/ flicker removal frequency. The settings are only read at reset. Details in the datasheet. http://download.csdn.net/detail/chelsea3q/7164049

Since I already got this far I decided to actually reprogram the EEPROM to make the camera more suitable for my needs. Also because it's fun, too. The datasheet has info about this, but due to the way the memory is read and switched between banks of registers I still needed a bit of time to find the right settings.

I interfaced an arduino UNO to the camera on the SCL, SDA lines, which (seem to?)use the standard I2C protocol ( named SCCB in the datasheet) . Reading the 24C08 memory was not very hard and I did it while the camera is on since I2C can have multiple devices on one line. ( technically not 2 masters, however). My arduino uses 3.3V , it is possible that the camera's 2.8V is too low for a 5V arduino to trigger a HIGH level read.

I changed a number of settings in the last couple of days, and there are no real issues programming the EEPROM. I disabled edge enhancement, after which the camera's real image quality can be seen (a lot softer , but less noisy) . Of course the overlay , mirror , gamma and some others, but there are a lot of other settings I still want to try out. Compared with other CMOS image sensors, this one has probably a minimal set of registers. The EEPROM contains about 300 values, but the chip itself about 700 registers.

I was unable to access the main IC directly, it appears that perhaps it does not listen on i2c if an eeprom is present, or perhaps an undocumented pullup like the PC6030 chip uses ( by the same company PixelPlus ) on the vsinc pin can set i2c master/slave mode. I tried every address / register combination just to make sure.

I am still to disable the auto white balance (AWB) compensation and tweak some auto exposure (AE) parameters, but apart from this I am finished with this project since a new, lighter camera will arrive soon.

The PC1030 sensor device is one of many camera ICs commonly used , some other are in the image below:


Another PC1030N ( this time) datasheet :http://wenku.baidu.com/view/a44f0a13a216147917112877.html?pn=51 ( seems identical)