Kepler Lima

Humidity sensor with ZYBO

4 posts in this topic

Hello everyone,

I am having some issues with my last purchase, the humidity and temperature sensor HONEYWELL HIH7120-021-001.

It's working with an I2C protocol, and what I do is I connect it to a PMOD of the zybo. I built a circuit with two resistors of 2.2k and one capacitor, like it is written in the datasheet.

I have thought about using the IP pmod tmp3, to configure this sensor, and I added some methods to PMODTMP3.c

double TMP3_getHumidity(PmodTMP3 *InstancePtr) {
    double humidityResult;
    u16 uhResult = 0;
    int whResult = 0;
    u8 buf[4];

    //Read humidity register into buf.
    TMP3_ReadIIC(InstancePtr, TMP3_REG_TEMP, buf, 2);
    

    uhResult = (buf[0] << 8) + buf[1];
    whResult = (int)uhResult;
    
    
    
    //9 bit resolution has 0.5 *C resolution, stored in the uppermost 9 bits of the buffer.
    humidityResult = (double)whResult / 16382.0 * 100.0;

    

    return humidityResult;
}


double TMP3_getTemperature(PmodTMP3 *InstancePtr) {
    
    double temperatureResult;

    u16 utResult = 0;
    int wtResult = 0;
    u8 buf[4];

    //Read temperature register into buf.
    TMP3_ReadIIC(InstancePtr, TMP3_REG_TEMP, buf, 2);
    
    utResult = (buf[2] << 6) + (buf[3] >> 2);
    wtResult = (int)utResult;
    
    
    //9 bit resolution has 0.5 *C resolution, stored in the uppermost 9 bits of the buffer.
    
    temperatureResult = (double)wtResult / 16382.0 * 165.0 - 40;
    

    return temperatureResult;
}
 

Actually I don't really care about the temperature in this sensor because I already have the pmodtmp3, but I need the humidity. I followed this link. I thought about modifying the TMP3.c because the pmod tmp3 uses the same communication protocol.

It seemed to work, but actually its is not working, it always get the same value : 75 % of humidity.

I put this lines in my main code : 

void DemoRun()
{
    double humidity = 0.0;
    double temperature = 0.0;
    while(1) {
        humidity = TMP3_getHumidity(&myDevice);
        temperature = TMP3_getTemperature(&myDevice);
        xil_printf("\x1B[3;0H");//Move Terminal Cursor to beginning of current row(3)
        xil_printf("\x1B[1K");//Clear Terminal
        xil_printf("Humidity: %d % \n\r", humidity);//print float as in %.2f
        xil_printf("Temperature: %d % \n\r", temperature);
        TMP3_delay(2000000);//wait for a half second
        xil_printf("wait");
    }
}

I don't know if someone ever used this kind of sensor for zybo. Hope you understand my problem.

Thanks a lot to this website, you have helped me a lot with my project.

Best regards,

Kepler Lima

Edited by Kepler Lima

Share this post


Link to post
Share on other sites

Hi Kepler Lima,

If you haven't found the datasheet for the sensor you are using Here is a link to the HONEYWELL HIH7120-021-001 technical information like this and this. The set up configuration of the HONEYWELL HIH7120-021-001 will be different that the PmodTMP3.  We just added the PmodHYGO with the IP core here that uses I2C and does both Temperature and Humidity. This might be a better IP to refer to. Typically when I am setting up an IP the first thing i do is get the communication going. I verify it using an O-scope. Then I go through the datasheet and set up the configuration of the IC. Then I get data (read/write) depending on what I'm doing. Then I manipulate the data to get it in the form i need it in and then output the data based on the IC. I added a generic I2C IP that has I2C set up but nothing for your specific sensor.  Hope this helps!

cheers,

Jon

PmodHoneywell_sensor_v1_0.zip

Share this post


Link to post
Share on other sites

Hello Jon,

I have tried your PmodHoneywell IP, and I have the same value : 75 %

The i2c is working because, I get that value.

I think the problem must be in the configuration, maybe I chose the wrong registers to get the humidity.

Maybe I should change the following command:


    Honeywell_sensor_begin(&myDevice,XPAR_PMODHONEYWELL_SENSOR_0_AXI_LITE_IIC_BASEADDR,0x18);

Or maybe, it is that I don´t "wake up" the sensor...

I don´t know how to do this last part. Should I take the main code that comes with PmodHoneywell and add some lines or?

Im a bit lost as you can see.

Thank you,

Best regards

 

Share this post


Link to post
Share on other sites

Hi Kepler Lima,

The PmodHoneywell IP only has the I2c communications set up. You will need to read the pdf's here and here to configure the sensor. I would look at  2.1 Sensor Address in the I2C Communication with the Honeywell HumidIcon™ Digital Humidity/Temperature Sensors pdf for the different registers to use. I did find an adruino project that appears to use a slightly different model Honeywell humidity and temperature senor here. I attached the arduino library and example. It might help with setting up and getting data from your sensor.  I would look through the different Pmod IP's here to see how we have configured and used the different IC's. When you are looking through the different IP's I would also suggest to find the data sheets for the IC's so you can see how we extrapolated the configuration and usage information. It would also be a good idea to have an o-scope available to help with setting up the configuration and useage. If you are not stuck with using the Honeywell sensor another option is the PmodHYGO that gets humidity and temperature and has an IP alsready made for it. 

cheers,

Jon

HIH.zip

Edited by jpeyron

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now