The progress on the thermal camera marches on! Today was a busy day in the lab and in the city, but I spent a few minutes in a coffee shop writing assembly code into my notebook. A paper notebook- it is surprising what you can get done with a pencil and paper in assembly. The syntax is very friendly to handwriting, since there are no brackets or strange characters. I took that home, typed it up, and it almost, almost worked. I gave it about 1/100 chance of compiling without an error, and about one in a million that it would work on the first try. It didn’t, but its about 50% there. To mix metaphors- I didn’t win the lottery, but I am winning the war.
The code does technically work. I put my hand over the sensor, and LEDs light up. In the video, they appear to get brighter because the led on/off decision is made by basically taking the image and converting it to on/off based on a threshold. The threshold is very close to the ambient temperature of the room, so it flickers on and off. Putting my hand over it makes it more likely to be on, so the display gets brighter.
However, there is some work to be done. The first thing to do is add ambient temperature compensation. The grid-eye has an internal temperature register that can provide a baseline value for what pixels are actually at ambient temperature. This could be sampled on boot or reset. Ideally, the brightness of each pixel would be proportional to the temperature (to some extent), instead of just thresholded.
The last problem is in hardware. Right now, the LEDs are sucking up a lot of power. This is dragging down the voltage a tiny bit when there is a big demand for current. The result is that the clock speed of the mcu slows down, since it is running off the internal oscillator (with no clock divider). This causes a hiccup in the I2C transmission, which sends the processor to an infinite loop. You can tell this is happening from the logic analyzer capture above- check out the top line, SCL. It goes from tightly packed, 400khz clocks to a 40khz clock and finally slips into a 10khz clock, and then stops transmitting.
The fix for this is to add some decoupling caps and current limiting resistors. That should fix it right up. I might take this opportunity to re-wire everything, since it is getting a little ugly.