Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device Temp Sensor (Req.) #30

Closed
pauledd opened this issue Jun 21, 2018 · 17 comments
Closed

Device Temp Sensor (Req.) #30

pauledd opened this issue Jun 21, 2018 · 17 comments

Comments

@pauledd
Copy link

pauledd commented Jun 21, 2018

Hi
I know from joe-c and his windows thermovison software that there is somewhere a temperature sensor in the Seek Compact (Pro) devices. It would be really nice if one could read this value out. I asked him where the value can be read out and the referred to his dll source code. His uint16 "DevTemp" variable gets read out from two bytes from his raw stream data array data[11] and data[12] (for the Compact Pro)...

The corresponding part can be found in "ClassThermalFrame.cs"(*):

 internal ThermalFrame(byte[] data, int Width, int Height) {

...
            if (_isSeekPro) {
                StatusByte = data[4];
                DevTemp = (ushort)(data[11] << 8 | data[10]);
                FrameCnt = (ushort)(data[9] << 8 | data[8]);
            }
            else {
                StatusByte = data[20];
                DevTemp = (ushort)(data[3] << 8 | data[2]);
                FrameCnt = (ushort)(data[81] << 8 | data[80]);
            }
...

I tried to look through libseek-thermal to understand where I could tap the temperature value but
I dont get behind the code or dont know what part of "m_raw_data" contains the value.

Any ideas anyone?

(*)http://joe-c.de/pages/posts/version_1.8.0.0_tcamdll_207.php

@Achref-Dachraoui
Copy link

Hi,

Did you find any solution for this?

@pauledd
Copy link
Author

pauledd commented Jun 27, 2018

Not yet, but I am still on it. I currently try to talk to my cam via python to better understand all the stuff, I am to dumb for that C++ code :-)

@pauledd
Copy link
Author

pauledd commented Jul 1, 2018

Ok, that was quite easy, just add this code to the SeekThermalPro.cpp

int SeekThermalPro::device_temp()
{
    return m_raw_data[5];
}

and this in public SeekThermalPro.h

virtual int device_temp();

Then you can simply get the raw integer temperature value from the camera, but don't be surprised, the value goes down as the device gets hotter... at 24° room temperature mine starts at about ~6400.

The same should work with the non-Pro cams but then you have to try m_raw_data[1], I am not sure

@Achref-Dachraoui
Copy link

Thank you for your asnwer.

I also got values around 6400 and it remain stable over time (it dosen't go down even when the device gets hotter). Did you make some additional transformation on this value?

@pauledd
Copy link
Author

pauledd commented Jul 2, 2018

no, just reading it... Mine does always go down, but I doing some more tests with different environmental temperatures. Here is some data that I just took from a 24.5°C wall at 23°C room temp. over 45min:
seek_devtemp

@pauledd
Copy link
Author

pauledd commented Jul 2, 2018

Do you have a Compact or Pro?

@Achref-Dachraoui
Copy link

I have the Pro one.

I've got roughly the sames curve. But i'm still curious to know if your method worked out as well with different environmental temperatures and if matchs with real world temperatures.

@pauledd
Copy link
Author

pauledd commented Jul 2, 2018

I've no "method" so far ;) just reading raw values... But with the devTemp we have something we can maybe correlate to and it seems to match quite good the pixel values drop over time. Next thing would be to test how the curve looks in extrem envirom. situations. ~~ I think about putting the cam into my fridge (~8°C) and record the values again...~~ No good idea, fridge is quite unstable regarding temp. during active cooling phases...

@maartenvds
Copy link
Collaborator

Hi guys, thanks for the nice work and finding the hidden temperature sensor! I unfortunately have not much time to work on this so this is great you are contributing. If you have a stable way to calculate the temperature taking into account the ambient temperature sensor, I will be fixing the driver with this nice feature. Keep up the good work!

@ccskoba
Copy link

ccskoba commented Jul 9, 2018

Hi guys. DevTemp is very interesting. I also tried to record DevTemp and room temperature every 10 minutes with my seek compact (not pro).

devtemp_roomtemp

I believe that DevTemp represents the sensor temperature. And by using this you will surely get good accuracy.

@pauledd
Copy link
Author

pauledd commented Jul 11, 2018

I think I would close this since we now know how to get the dev temp, its not on me to decide whether to implement only the "device_temp()" function in the code or an complete algorithm to correct the display temperatur values... I think this more more up to the implementer who uses this lib and writes his own application.. But ideas can be put in here: #29

@pauledd pauledd closed this as completed Jul 11, 2018
@undera
Copy link

undera commented Jul 19, 2018

THe method of getting dev temp value, as offered by @pauledd is incorrect, IMO.
Applying what original ClassThermalFrame.cs has, gives completely different values of dev temp...

@pauledd
Copy link
Author

pauledd commented Jul 19, 2018

Why? What values do you get? I get the same values as with joe-c's thermovision app under windows...

@undera
Copy link

undera commented Jul 19, 2018

If I copy exactly what in joe's app, I get values that are cycle from quite low to quite high:

selection_007

One more thing I noticed with the way of simply getting m_raw_data[5]; is that value "resets" each time I restart cam. So it's definitely not temperature. And I wonder how m_raw_data[5]; correspond to (ushort)(data[11] << 8 | data[10]); from C#, how did you conclude that?

@pauledd
Copy link
Author

pauledd commented Jul 19, 2018

my understanding of
(ushort)(data[11] << 8 | data[10]);
is that joe-c data array is ushort little-endian, so you need two byte to form a 16bit value and this is done with this bit-shift <<. The data array in libseek-thermal is already 16bit, so you need also to half the data arrays address if you want to access the corresponding values in a 16bit array, and this is data(5) (16bit) or (10/11) 8bit. You cant simply copy joe-c's code because the array format differs and thus my guess you get that weird values. Then you doing a bitshift on 16bit values...

@undera
Copy link

undera commented Jul 19, 2018

I have brute-force printed first 20 items if m_raw_data and indeed only item 5 behaves as potential sensor. But I fail to understand the meaning of it, because it goes down with the temperature...

@pauledd
Copy link
Author

pauledd commented Jul 19, 2018

Maybe its a thermistor, they tend to decrease values as temperature rises...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants