new thermopile sensor.

fernando_g

Senior Member
Please have a look at this very interesting remote thermal sensor:

http://media.digikey.com/pdf/Data Sheets/Omron PDFs/D6T44L_8L_Appl_Note.pdf

It transmits data via a straightforward I2C protocol.
The only problem I see, from a Picaxe point of view, is that the data packet consists of 17 words (16 individual thermopile values plus a temp reference value) which would exhaust most, if not all available Picaxe variables.
What could be done here?

Note...this is only a what if scenario. Technical curiosity. A mind bender. I'm not buying a sensor yet, its almost US$50 price is a little too rich for me.
 

hippy

Technical Support
Staff member
Current PICAXE have at least 128 bytes of RAM which can be accessed using @bptr and @bptrinc so it wouldn't be too hard to grab 17 words / 34 bytes of data, store them, then process them.
 

fernando_g

Senior Member
Let me see if I understand.
So I would start by first downloading all the thermopile values with something like:

readi2c 0,(b0,b1,b2,b3,..........,b32,b33)

And then proceed with something similar to:

poke 80, word w0
poke 82, word w1
.
.
.
.
poke 96, word w16
poke 97, word w17


Which would free up all the variables for any other tasks at hand?

Now, since the reference thermopile value -per the datasheet- is w17, all I would have to do next, is to peek into the different registers to retrieve the individual words, compare each to w17, and if different take action?
For instance:

peek 80, word compare_value
if compare value <> w17 then take_action
peek 82, word compare_value
if compare value <> w17 then take_action
.
.
.
.
.
.
peek 96, word compare_value
if compare value <> w17 then take_action


Am I understanding correctly?
 

Goeytex

Senior Member
Maybe you could use:

BPTR = 60
HI2CIN 0,(bptrinc,bptrinc, .......... ,bptr)

This avoids having to use B0 - b55 when reading the device.
 
Last edited:

hippy

Technical Support
Staff member
Yes, as per Goeytex. With missing @ added ..

HI2CIN 0, ( @bptrinc, @bptrinc, ... , @bptr )

You could also just capture the MSB of the words, discard the LSB, if that proves to be useful. You can do that by reading all LSB into a dummy variable, MSB into variables. Data is sent LSB first so ...

HI2CIN 0, ( dummy, b0, dummy, b1, ... , dummy, b16 )

Or replace the b0-b16 variables with @bptrinc.
 

fernando_g

Senior Member
Thanks both for explaining the @bptr function. It is clear now.

However, since I would like to keep the first 20 variables (b0 thru b19) for general purpose tasks, and use from b20 thru b54 for the thermopile data, then my command would have to be written the following way?:

BPTR = 20
HI2CIN 0, ( @bptrinc, @bptrinc, ... , @bptr )

or would it be this other way:

HI2CIN 20, ( @bptrinc, @bptrinc, ... , @bptr )

Am I understanding correctly?
 

BESQUEUT

Senior Member
However, since I would like to keep the first 20 variables (b0 thru b19) for general purpose tasks, and use from b20 thru b54 for the thermopile data, then my command would have to be written the following way?:
BPTR = 20
HI2CIN 0, ( @bptrinc, @bptrinc, ... , @bptr )

or would it be this other way:
HI2CIN 20, ( @bptrinc, @bptrinc, ... , @bptr )
Am I understanding correctly?
First way is OK.
 
Top