Sensirion EK-H5 interfacing

This is the English forum for all topics related to IO-Warrior. Please post in English only

Moderator: Guido Körber

SteveKinder
Beiträge: 8
Registriert: Mo Apr 15, 2013 11:39 am

Sensirion EK-H5 interfacing

Beitragvon SteveKinder » Mo Apr 15, 2013 2:46 pm

I have a Sensirion EK-H5 evaluation kit for the Sensirion SHT21 humidity-temperature sensor. This is connected by what I believe is a customized IO-Warrior USB interface. Sensirion have given me customized dll that should give me what I need to interface from C. They also distribute an executable GUI that allows interfacing to the SHT21, based I am told on use of the dll. The GUI works fine and I have had some success with the library. Code like the following seems Ok:

Code: Alles auswählen

     uint pid = IowKitGetProductId(ioHandle);
     printf("Success, access devices pid = %u\n", pid);
     printf("%s\n",IowKitVersion());
     printf("Number of devices %d\n", IowKitGetNumDevs());


I would now like to get the temperature and humidity on a regular basis. I'm not sure how to do this. I wonder whether anyone has experience of, or source code for, the interfacing of this sensor? It isn't clear to me whether Code Mercenaries might have had something to do with creating the GUI interface? I have tried using IowKitWrite and IowKitRead calls. Some data seems to be returned but always exactly the same set of numbers and then zeros.

Thanks in advance

Steve
Guido Körber
Site Admin
Beiträge: 3137
Registriert: Di Nov 25, 2003 10:25 pm
Wohnort: Germany/Berlin
Kontaktdaten:

Re: Sensirion EK-H5 interfacing

Beitragvon Guido Körber » Di Apr 16, 2013 4:12 pm

We do have some sample code for the Sensirion sensor, though the developer who did that is currently not in the office.

What you describe sounds like you are trying to talk to interface 0, which is the simple IO of the IO-Warrior. You have to talk to interface 1, the special mode functions. There is an I2C example as part of our SDK, you may want to look at that.
SteveKinder
Beiträge: 8
Registriert: Mo Apr 15, 2013 11:39 am

Re: Sensirion EK-H5 interfacing

Beitragvon SteveKinder » Di Apr 16, 2013 5:52 pm

Many thanks for the help, I now have the sensor producing numbers.

The temperature and humidity seem higher than produced by the standard Sensirion GUI. Would the temperature and humidity calculations in the sample code be applicable to a SHT21 on the EK-H5 kit? Any other thoughts on why the values may be different?

Steve
Guido Körber
Site Admin
Beiträge: 3137
Registriert: Di Nov 25, 2003 10:25 pm
Wohnort: Germany/Berlin
Kontaktdaten:

Re: Sensirion EK-H5 interfacing

Beitragvon Guido Körber » Do Apr 18, 2013 12:56 am

Not sure, I did not do the programming. Christoph should be back next week, he did write some code for the sensor.
SteveKinder
Beiträge: 8
Registriert: Mo Apr 15, 2013 11:39 am

Re: Sensirion EK-H5 interfacing

Beitragvon SteveKinder » Do Apr 18, 2013 1:57 pm

Thanks again for your latest reply.

I have now determined what I think are the correct calculations to perform with the raw numbers that come out of the sensor. Based on the Sensirion datasheets I think the sample code is for an SHT71 sensor rather than and SHT21. Modifying the calculations I can now get the same numbers as produced by the Sensirion GUI.

I afraid I do have another difficulty. I am working on a 64 bit system and want to create a 64 executable. The 'customized' library that Sensirion have given me is 32 bit.

The Code Mercenaries sample program does work to interface to our SHT21 (with the proviso that the calculations need adjusting). I suspect the library with this sample program isn't 'customized', but I could be wrong. This does look to be 32 bit though.

The dll distributed with the sample program seems to be different from the dll available from http://www.codemercs.com/337/?L=1 under the software tab. Maybe the latter is just 64 bit, re-compiled with another compiler etc.

I'll try and condense my questions:

If I was to take the Code Mercenaries dll source code and build a 64 bit library should the sample program work with it? Or is a suitable 64 bit dll available?

Are there any significant differences between the sample code's dll and the dll at http://www.codemercs.com/337/?L=1

Did Code Mercenaries create the 'customized' dll? Is the source code or a 64 bit dll available?

Steve
Guido Körber
Site Admin
Beiträge: 3137
Registriert: Di Nov 25, 2003 10:25 pm
Wohnort: Germany/Berlin
Kontaktdaten:

Re: Sensirion EK-H5 interfacing

Beitragvon Guido Körber » Do Apr 18, 2013 2:14 pm

The ddiferences between the customized DLL and the standard DLL should only be the PID for the Sensirion custom chip. So building a 64 bit version with our source should be no problem.
SteveKinder
Beiträge: 8
Registriert: Mo Apr 15, 2013 11:39 am

Re: Sensirion EK-H5 interfacing

Beitragvon SteveKinder » Fr Apr 19, 2013 11:07 am

Any particular advice on building the library as 64 bit?
SteveKinder
Beiträge: 8
Registriert: Mo Apr 15, 2013 11:39 am

Re: Sensirion EK-H5 interfacing

Beitragvon SteveKinder » Fr Apr 19, 2013 1:19 pm

My initial attempts fail with errors as follows:

1> Creating library Release\iowkit.lib and object Release\iowkit.exp
1>openclos.obj : error LNK2001: unresolved external symbol HidD_SetNumInputBuffers
1>openclos.obj : error LNK2001: unresolved external symbol HidD_GetAttributes
1>openclos.obj : error LNK2001: unresolved external symbol HidD_GetIndexedString
1>openclos.obj : error LNK2001: unresolved external symbol HidD_GetSerialNumberString
1>openclos.obj : error LNK2001: unresolved external symbol HidD_FreePreparsedData
1>openclos.obj : error LNK2001: unresolved external symbol HidP_GetCaps
1>openclos.obj : error LNK2001: unresolved external symbol HidD_GetPreparsedData
1>openclos.obj : error LNK2001: unresolved external symbol HidD_GetHidGuid
1>Release\iowkit.dll : fatal error LNK1120: 8 unresolved externals

Building with Visual Studio 2010 Premium. So far just added just used the configuration manager to add and use an x64 platform. Probably more to it but failed at the first hurdle.

Steve
Christoph Jung
Beiträge: 555
Registriert: So Okt 08, 2006 3:43 pm
Wohnort: Germany / Berlin
Kontaktdaten:

Re: Sensirion EK-H5 interfacing

Beitragvon Christoph Jung » Mo Apr 22, 2013 3:34 pm

You have two diffenerent ways to solve the problem.

1). Create a 32 Bit application and use the 32 Bit iowkit.dll. They will work on a 64 Bit system and for those simple applications 64 Bit is non-essential.
2). Download the SDK for the IO-Warrior. There is a compiled 64Bit Dll available (folder: iowkit api).
Abteilung: Softwareentwicklung
Folge uns auf Twitter
Follow us on twitter
SteveKinder
Beiträge: 8
Registriert: Mo Apr 15, 2013 11:39 am

Re: Sensirion EK-H5 interfacing

Beitragvon SteveKinder » Mo Apr 22, 2013 5:54 pm

I do want to use this in a bigger application that requires 64 bit. I could create a stand alone 32 application and use some sort of inter-process communication. The latter is my fall back position.

I had seen that 64 bit library. However I tried the equivalent 32 bit version and using that the IowKitOpenDevice call returns 0. I assumed the 64 version would do the same. I have now tried that and it does. I assume this is an older version of the library? To do with Sensirion use?

I have used the dll that comes with the source code (1_5_3) successfully. I was trying to make that library as 64 bit. I have now managed to do that. I thought. Using this doesn't work yet! Do you have a dll for this version of the source if the one with the SDK is older?

Thanks

Steve
Christoph Jung
Beiträge: 555
Registriert: So Okt 08, 2006 3:43 pm
Wohnort: Germany / Berlin
Kontaktdaten:

Re: Sensirion EK-H5 interfacing

Beitragvon Christoph Jung » Di Apr 23, 2013 12:55 pm

I have check my projectfile and found some differences between the HID-Class of 32 bit an 64 bit.
I have compiled a 64 bit DLL with the Sensirion PID included (have a look into the iowkit.h)

You can download it here temporary : http://www.codemercs.com/temp/iowkit_x64_sensi.zip
Abteilung: Softwareentwicklung
Folge uns auf Twitter
Follow us on twitter
SteveKinder
Beiträge: 8
Registriert: Mo Apr 15, 2013 11:39 am

Re: Sensirion EK-H5 interfacing

Beitragvon SteveKinder » Di Apr 23, 2013 4:28 pm

Thanks for that. I have tried this library, initially with Qt and an MSVC 2010 compiler then directly with Visual Studio 2010. In both cases the IowKitOpenDevice call seems to fail:

Code: Alles auswählen

IOWKIT_HANDLE ioHandle;
ioHandle = IowKitOpenDevice();


Doubt this helps but with Visual Studio an error popup appears saying the application was unable to start correctly.
Christoph Jung
Beiträge: 555
Registriert: So Okt 08, 2006 3:43 pm
Wohnort: Germany / Berlin
Kontaktdaten:

Re: Sensirion EK-H5 interfacing

Beitragvon Christoph Jung » Di Apr 23, 2013 4:45 pm

Sounds confusing because I tested it with a simple test tool which I have created today for a test.
Please download the Visual Studio 2010 project (it's a MFC project): http://www.codemercs.com/temp/64bit_test.zip
and test it.

And if you have copied the iowkit.dll to the windows system folders, please delete them.
I prefer the solution to hold the iowkit.dll in the same folder like the application or in the project folder of Visual Studio.
Abteilung: Softwareentwicklung
Folge uns auf Twitter
Follow us on twitter
SteveKinder
Beiträge: 8
Registriert: Mo Apr 15, 2013 11:39 am

Re: Sensirion EK-H5 interfacing

Beitragvon SteveKinder » Fr Apr 26, 2013 1:32 pm

Just to let you know things are now working with the 64 bit library you let me have. I started my test programs from scratch again and things worked fine. I also suspect I may have had a process lying around that had the device connected but I'm not sure. I got access working from Visual Studio and a C++ project. Now have things going from Qt. Both 64 bit.

Many thanks for all your help.

Regards

Steve

preparat alveo http://www.alveo-akuna.pl

Zurück zu „IO-Warrior English“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast