Hi,
recently I bought some cheap LiPo batteries sold at a german online shop for sale of remnants. I did some research and found that the battery packs are normally used in the Kindl Fire. With the battery pack I got also a light sensor used in the Kindle to adjust the display to ambient light. (-> http://www.ifixit.com/Guide/Installing+Kindle+Fire+LCD/7929/2).
Investigation on the internet I found that the sensor CM3217 from CAPELLA Microsystems is used. The communication with the sensor is I2C based. With the I2C scanner i found two adresses for the sensor. Based on this site rk3066-kernel/cm3217.c at master · AndrewDB/rk3066-kernel · GitHub I was able to read out the sensor but I did not understand all the protocol options.
Unfortunately the company does not offer a datasheet, so I wrote a mail to them. I got an answer with questions about "my project". I described my interests but it seems that the Arduino community is not interresting for Capella Microsystems.
I think the sensor is very useful and easy to use with the Arduino because it can also be found as a cheap repair part in the internet Kindle Fire Parts for Repair.
Is there somebody in the community who has a datasheet with the full I2C protocol of the sensor ?
Or can somebody re-engineer the protocol from the above driver?
Here my code to read the sensor:
// I2C Scanner
// Written by Nick Gammon
// Date: 20th April 2011
#define CM3217_ADDR_DATA_MSB 0x10
#define CM3217_ADDR_DATA_LSB 0x11
#include <Wire.h>
byte lsb, msb;
unsigned int result;
void setup() {
Serial.begin (115200);
Serial.println ();
Serial.println ("I2C scanner. Scanning ...");
byte count = 0;
Wire.begin();
for (byte i = 1; i < 120; i++)
{
Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)
{
Serial.print ("Found address: ");
Serial.print (i, DEC);
Serial.print (" (0x");
Serial.print (i, HEX);
Serial.println (")");
count++;
delay (1); // maybe unneeded?
} // end of good response
} // end of for loop
Serial.println ("Done.");
Serial.print ("Found ");
Serial.print (count, DEC);
Serial.println (" device(s).");
Wire.beginTransmission(0x10);
Wire.write(0xA7 & 0xfe);
Wire.endTransmission();
} // end of setup
void loop() {
Wire.requestFrom(CM3217_ADDR_DATA_LSB, 1); // request 6 bytes from slave device #2
while(Wire.available()) // slave may send less than requested
{
lsb = Wire.read(); // receive a byte as character
Serial.print("LSB ");
Serial.print(lsb); // print the character
Serial.print(" ");
}
Wire.requestFrom(CM3217_ADDR_DATA_MSB, 1); // request 6 bytes from slave device #2
while(Wire.available()) // slave may send less than requested
{
msb = Wire.read(); // receive a byte as character
Serial.print("MSB ");
Serial.print(msb); // print the character
Serial.print(" ");
}
// unsigned int result = msb;
// result = (result <<8 )|lsb;
result = ((msb << 8) | lsb) & 0xffff;
Serial.print("RESULT ");
Serial.println(result);
delay(1000);
}
Regards
Reinhard