i2c overhead is a lot per request of data from mlx90640 sensor
here is i2c protocol
![](https://cdn.hackaday.io/images/original/5124241544968770971.gif)
from what i understand, is that after address is sent to sensor, and read mode sent, as long as no stop command is issued, each data space is read back one byte at a time and increments the address after each data byte transferred.
this means that requesting more than one byte at a time is how i can make more efficient use of the i2c bus, also it will work up to 800khz on arduino.
examples of efficiency are here
i need to request at least 10 memory addresses of data for each thermal pixel
overhead with no bytes is 3140 microseconds. i will work on reducing this. but it shows over head for requests
requesting 1 at a time is with total processing time of 4900-3140= 1760 microseconds per cell read
requesting 8 at a time is with total processing time of 9448-3140=6408/8= 801 microseconds
requesting 32 at a time is 28132-3140 =25092/32= 784 microseconds per cell read time
time of return diminishes after about 8 bytes at a time,
for example using an atmega chip with 8k of ram,
and reading all 768 cells for thermal data at a time
requesting 768 604568-3040=601528/768=783 microseconds
so reading up to 32 at a time for connivence is best, but 8 at a time is reasonable as well with reading only taking 801 microseconds.
there are several tricks to improve performance, this just shows that optimum reading of data peaks at about 32 sensors reading at a time. this is about 640 bytes of data and does not include calculations time, you can see that that overhead has been removed from calculations.
there are some efficiencies in the fact that at least 70% of calculations are applied to all sensor, and 20% are applied to at least 2 or 4 cells for calibration. leaving only 10% of math that needs to truly be done independently, and some of that is for noise and hysteresis.
i guess what im getting at is that 5000 microseconds read time per cell will be quickly reduced to at least half that, or more. it could be as low as 500microseconds per cell.
and the big kicker, we only need 3-5 cell reads to a tempurature, rest of data can be raw values without the To calculations to show color changes, we only need 3-5 temp readings for a reference so we can figure out color range for displaying images, and show temp values of high, low, and center.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.