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

Have USB device TEMPerHumM12V1.3 working #38

Open
dabido31 opened this issue Jan 16, 2016 · 6 comments
Open

Have USB device TEMPerHumM12V1.3 working #38

dabido31 opened this issue Jan 16, 2016 · 6 comments

Comments

@dabido31
Copy link

Hello,
I'm trying to make the device work with this code however I have failed so far as I get an error that TEMPerHumM12V1.3 subtype is not supported.

Do you see how I could solve this so that the device is recognized ?

Thanks!
David

@nanderson77
Copy link

I have the same sensor. TEMPerHum12V1.3 I'm trying to get temps to read into my Raspberry PI -
I put on the prerequisite software you list in the release notes but after that I'm such a newbie I have no idea what the next step is to update my application. I didn't do the original programming, I just downloaded an image that the temperhum's were supposed to work with and I get the message
/dev/hidraw4: Could not open device: Unknown device subtype string: TEMPerHum12V1.3

@kevinchow
Copy link

I am working on the same issue, replacing the 1.0 with 1.3 in "libtempered/temper_type.c" make it runnable.

.subtype_strings = (char *[]){ "TEMPerHumV1.0rHu", "TEMPerHumM12V1.3", NULL }
Result: Showing the wrong number, so still need some work.

/dev/hidraw1 0: temperature 834.75 °C, relative humidity 16275.3%, dew point -4075.0 °C

@kevinchow
Copy link

Here is a solution that will make it work for v1.3. I copy most of this from the v1.2 branch, all credit go to that creator.

Change device id/name

[root@localhost libtempered]# git diff temper_type.c
diff --git a/libtempered/temper_type.c b/libtempered/temper_type.c
index 1b00b20..86ec659 100644
--- a/libtempered/temper_type.c
+++ b/libtempered/temper_type.c
@@ -36,7 +36,7 @@ struct temper_type known_temper_types[]={
                        .response_count = 2,
                        .subtype_strings = (char *[]){
                                "TEMPerHumV1.0rHu",
-                               "TEMPerHumM12V1.0",
+                               "TEMPerHumM12V1.3",
                                NULL
                        }
                },
@@ -75,7 +75,7 @@ struct temper_type known_temper_types[]={
                        (struct temper_subtype*)&(struct temper_subtype_hid){
                                .base = {
                                        .id = 1,
-                                       .name = "TEMPerHumM12V1.0",
+                                       .name = "TEMPerHumM12V1.3",
                                        .open = tempered_type_hid_subtype_open,
                                        .read_sensors = tempered_type_hid_read_sensors,
                                        .get_temperature = tempered_type_hid_get_temperature,

Change equation

[root@localhost libtempered]# git diff type_hid/si7005.c
diff --git a/libtempered/type_hid/si7005.c b/libtempered/type_hid/si7005.c
index 11745da..369c34b 100644
--- a/libtempered/type_hid/si7005.c
+++ b/libtempered/type_hid/si7005.c
@@ -28,7 +28,8 @@ bool tempered_type_hid_get_temperature_si7005(

        // According to the Silicon Labs Si7005 datasheet, there's 32 codes per ℃
        // with 0x0000 = -50℃.
-       *tempC = ((float)temp) / 32 - 50;
+       //*tempC = ((float)temp) / 32 - 50;
+       *tempC = 175.72*temp/65536 - 46.85;

        return true;
 }
@@ -74,7 +75,8 @@ bool tempered_type_hid_get_humidity_si7005(
        // Temperature compensation
        relhum += ( tempC - 30 ) * ( 0.00237 * relhum + 0.1973 );

-       *rel_hum = relhum;
+       //*rel_hum = relhum;
+       *rel_hum = 125.*rh/65536 - 6;

        return true;
 }

Rebuild

make clean
make
make install 

Run

[root@localhost libtempered]# tempered
/dev/hidraw1 0: temperature 27.81 °C, relative humidity 26.3%, dew point 6.7 °C

@jamcole
Copy link

jamcole commented Feb 22, 2016

Great work @kevinchow, these changes work perfectly for me as well.

@normanr
Copy link

normanr commented Mar 29, 2016

Note: nmenon/TEMPered@eccb950 is a commit for TEMPerHumM12V1.3.

@normanr
Copy link

normanr commented Mar 31, 2016

and #40 is the PR for both V1.2 and V1.3

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