The author mentions:
Either the sensor is bad or your line level conversion is not working.
To figure out why, let's look at the library code. This is how the Arduino gets the raw data:
Note: I've taken a few liberties with the code to clarify and shorten it, but it is practically identical.
while(Wire.available() && i < 16) {
data_buf[i++] = Wire.receive();
}
As explained by the original hacker and emulated in the library, the data is in the following format:
[Top byte][Coordinate1][Coordinate2][Coordinate3][Coordinate4]
... where each coordinate block is 3 bytes, and the (X,Y) coordinates are calculated like this:
Blob1.X = (Byte3 & 0b00110000) <<4 + Byte1;
Blob1.Y = (Byte3 & 0b11000000) <<2 + Byte2;
Whether or not the IR spot is detected is determined by this code, which is repeated for 4 "Blobs":
Blob1.Size = (Byte3 & 0b00001111);
blobcount |= (Blob1.Size < 15)? 0x01 : 0; // Is Blob.Size less than 0x0F?
You are getting (0,0) for all of them, meaning all blobs are detected (blobcount
is 0x00001111
). This can result from all data being zero, as (0x00 < 15)
is TRUE
. To make a long story short, "Either the sensor is bad or your line level conversion is not working."
At this point you want to do these things:
- Check your oscillator circuit with an oscilloscope to verify its operation (don't measure crystal directly as 'scope capacitance will skew it, but inverter output).
- Ensure proper voltages are present.
- Make sure SDA and SCL are being pulled up to 3.3V with 30kΩ resistors on the sensor side and to 5V with 1.5kΩ resistors on the Arduino side of the level converter (LTC4301L).
- Try communicating with a different 3.3V I2C device to ensure it is working properly.
If all checks out, chances are the sensor is damaged from overheating, static electricity or overvoltage conditions.