Shop OBEX P1 Docs P2 Docs Learn Events
Can someone help me guess how to read three bytes from an eeprom on an HH10D hu — Parallax Forums

Can someone help me guess how to read three bytes from an eeprom on an HH10D hu

metron9metron9 Posts: 1,100
edited 2007-12-13 16:39 in General Discussion
Looks like they ommited any reference how to read the three bytes from the eeprom needed to calculate the RH% humidity value on this humidity sensor. google turns up more questions but no answers. The device works and gives me 7.2khz in the room i am in. frequency output is from 5khz to 10khz for 1% to 99% humidity.· That would make the reading 44% with no calibration. I have a fluke humidity sensor I can test it with but it would be nice to be able to read the eeprom.

There are SDA and SCL pins to read the eeprom but nothing that says what signals it is expecting.

Any guesses?


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-12-11 06:57
    metron9 -

    A Google search produces the fact that the EEPROM (M24C01) is a product of ST Micro. ST Micro shows that EEPROM here:
    http://www.st.com/stonline/stappl/productcatalog/app?path=/comp/stcom/PcStComOnLineQuery.showresult&querytype=view=table$$type=product$$Parametric=N&querycriteria=RNP139=112

    The data sheet is found at the link above as well.

    The "trick" is that this is an I2C device, and thus can only be directly addressed by Stamp BS2P? devices. It can be addressed by other Stamps as well, but not as directly. For Stamps other than the BS2P? series, refer to the Nuts and Volts Columns on the Parallax web site for applications information. For the BS2P? series one would use the I2CIN command to access the necessary calibration data.

    Regards,

    Bruce Bates

    Post Edited (Bruce Bates) : 12/11/2007 7:06:07 AM GMT
  • metron9metron9 Posts: 1,100
    edited 2007-12-11 07:19
    Ahhh silly me, I did not even think about looking at the schematic for the eeprom to access it directly, I ***-u-me-d the eeprom memory was in the main processor chip and I needed to know the protocol and now I see it's not even a processor but just a timer chip and the logic is all analog. Perhaps I have been testing the alcohol sensor tonight for too long, that thing is working though I kid you not.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
  • metron9metron9 Posts: 1,100
    edited 2007-12-13 07:19
    I did my own program to bit bang the calibration data (program listed below, note device when first powered on a read will read location 0 so I skip 10 bytes and read in the data. But now·I really dont understand the calculation.
    My numbers are
    Sensitivity· = 356
    Offset······ = 7453
    TCS········· = 65535 ( not used I guess)

    The pulsin reads 35 using a BS2

    so its 1,000,000/((35*2)*2) = Frequency = 7,142khz

    Now I know the humidity is somewhere around 30%·to 40% in the room it is in so I know the frequency will be larger than the offset at higher humidity levels and that would give me negative numbers for the (offset-Soh) part of the calculation.

    Since·I do not know what the little upsidedown V is between the 2 and 12 I am also lost.

    Could someone help me out with a sample calculation with the data I have?


    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    ' {$PORT COM1}
    SCL     PIN 1
    SDA     PIN 2
    sen     VAR Word
    off     VAR Word
    tcs     VAR Word
    memloc  VAR Byte
    x       VAR Byte
    y       VAR Byte
    width   VAR Word
    i2cbyte VAR Byte
    
    INPUT   scl
    INPUT   sda
    PAUSE 1000
    
    FOR memloc=0 TO 9
    GOSUB i2cin
    NEXT
    
    GOSUB i2cin
    sen=i2cbyte
    memloc=memloc+1
    GOSUB i2cin
    sen=sen*256+i2cbyte
    DEBUG "Sensitivity =",DEC sen,CR
    memloc=memloc+1
    GOSUB i2cin
    off=i2cbyte
    memloc=memloc+1
    GOSUB i2cin
    off=off*256+off
    DEBUG "Offset      =",DEC off,CR
    memloc=memloc+1
    GOSUB i2cin
    tcs=i2cbyte
    memloc=memloc+1
    GOSUB i2cin
    tcs=tcs*256+tcs
    DEBUG "TCS         =",DEC tcs,CR
    main:
      PULSIN 0,0,width
      DEBUG DEC width,CR
      PAUSE 1000
    GOTO main
    
    i2cin:
    i2cbyte = %10100011
    OUTPUT sda
    OUTPUT scl
    GOSUB DEVSEL
    GOSUB getbyte
    INPUT scl
    INPUT sda
    RETURN
     
    DEVSEL:
    x=128
    FOR y = 0 TO 7
    IF (i2cbyte & x) > 0 THEN
       INPUT sda
       INPUT scl
       OUTPUT scl
    ELSE
       OUTPUT sda
       INPUT scl
       OUTPUT scl
    ENDIF
    x=x/2
    NEXT
    INPUT scl
    OUTPUT scl
    RETURN
    getbyte:
    i2cbyte=0
    INPUT scl
    IF sda = 1 THEN i2cbyte.BIT7 = 1
    OUTPUT scl
    INPUT scl
    IF sda = 1 THEN i2cbyte.BIT6 = 1
    OUTPUT scl
     INPUT scl
    IF sda = 1 THEN i2cbyte.BIT5 = 1
    OUTPUT scl
     INPUT scl
    IF sda = 1 THEN i2cbyte.BIT4 = 1
    OUTPUT scl
      INPUT scl
    IF sda = 1 THEN i2cbyte.BIT3 = 1
    OUTPUT scl
     INPUT scl
    IF sda = 1 THEN i2cbyte.BIT2 = 1
    OUTPUT scl
     INPUT scl
    IF sda = 1 THEN i2cbyte.BIT1 = 1
    OUTPUT scl
    INPUT scl
    IF sda = 1 THEN i2cbyte.BIT0 = 1
    OUTPUT scl
    INPUT scl
    OUTPUT scl
    
    DEBUG DEC memloc," = ",DEC i2cbyte,CR
    RETURN
     
     
     
     
    
    




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
    699 x 740 - 89K
    135 x 271 - 4K
  • kjennejohnkjennejohn Posts: 171
    edited 2007-12-13 08:22
    Hi.
    The upside-down V is the caret, the symbol above the 6 on your keyboard. It means "raised to the power of", so 2^12 is 2 raised to the 12th power, which is 4096. I can only think this means to multiply the SENS value times 4096 to arrive at the frequency? Or divide the frequency by 4096 to get the RH(%), or somethin' like that, don't know how this all works. No doubt someone else will step in and supply the answer.

    Happy holidays!
    kenjj
  • metron9metron9 Posts: 1,100
    edited 2007-12-13 16:19
    I don't think this thing is working right. For example I get a pulsin of 35 when I turn it on, then I put a tube around it and breathe air on it, it only goes up to 39

    so that's 7142 khz at 35 and goes down to 6410 (pulsin 39) when humidity is higher. From the chart i am looking at it looks like a frequency of 5000 is 1% and 10,000 is 99% so it seems to be opposit of what it should be, I should see higher frequency at higher humidity. So I really need help to figure this one out, i am at a dead end.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
  • metron9metron9 Posts: 1,100
    edited 2007-12-13 16:39
    Ahhh i got it

    Sensitivity = 356
    Offset = 7453

    It outputs a frequency of 7000

    The formula says RH% = (offset-Soh)*sens/2^12

    So (7453-7000)*356/2^12

    7453-7000 = 453
    453 * 356 = 161,268

    161,268/4096 = 39

    rounding the numbers
    minimum frequency 7441 as 7453 - 7441 = 12 and 12 * 356 = 4272 and 4272 / 4096 = 1%
    minimum frequency 6314 as 7453 - 6314 = 1139 and 1139 * 356 = 405,484 and 405,484 / 4096 = 99%

    Now I will have to figure out how to best calculate these using the stamp and maximum values of a word



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
Sign In or Register to comment.