Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : HH10D humidity sensor
Author | Message | ||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1873 |
Anyone know how to access the OFFSET and SENS values from the eprom of this device using the MM. I have done a few calculations with various values and don't think they are all that critical but it is nice to be accurate. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
Keith @ Senior Member Joined: 19/06/2011 Location: AustraliaPosts: 167 |
Hi Paul I don't have a direct answer but I suggest you have a look at the Sparkfun web page http://www.sparkfun.com/products/10239 have a look at the forum info on the above page and the data sheet and the arduino article to see if they may help you. Keith The more we know, the more we know we don't know ! |
||||
seco61 Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 205 |
Hi Paul. The following code should read the data from the EEPROM (however I do not have one of these sensors so I am just working from the datasheet(s)). It will then calculate the the offset and sensitivity values and use these in the following loop which will calculate and print the relative humidity every 5 seconds (assuming the FOUT terminal from the sensor is connected to pin 11 on the maximite, the SDA terminal is connected to pin 12 and the SCL terminal is connected to pin 13 - a pullup will be required on the SDA and SCL pins (2.2K - 4.7K) and a common ground between the maximite and the sensor): 100 DIM hcal(4) 110 I2CEN 100,500 120 I2CRCV &h51,0,4,hcal(0),1,10 130 I2CDIS 140 IF mm.i2c <> 0 THEN 150 PRINT "Error during EEPROM read - error code: ";mm.i2c 160 END 170 ENDIF 180 hsens = hcal(0) * 256 + hcal(1):PRINT "Sensitivity: ";hsens 190 hoffset = hcal(2) * 256 + hcal(3):PRINT "Offset: ";hoffset 200 SETPIN 11,3 210 DO 220 PAUSE 5000 230 humidity = (hoffset - PIN(11)) * hsens / 4096 240 PRINT "Humidity: ";humidity;"%" 250 LOOP Regards Gerard (vk3cg/vk3grs) |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1873 |
Hi, Been in Darwin fishing but now back to trying to work this out. Ran the program with the SDA and SCL connected to pins 12 and 13 but keep getting error 2. I increased the time in line 110 but still the same. The program did run through once but both the values were zero. Thanks for the program, have you any ideas. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
Just a thought, see the quote below from the MM Basic Manual. seco61 said this earlier, do you have the resistors in place because the HH10D does not have them. When enabled the I2C function will take control of the external I/O pins 12 and 13 and override SETPIN and PIN() commands for these pins. Pin 12 becomes the I2C data line (SDA) and pin 13 the clock (SCL). Both of these pins should have external pullup resistors installed (typical values are 10Kohms for 100KHz or 2Kohms for 400kHz) |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1873 |
Thanks for that, I already had pull ups on these pins and disconnected them when I connected the HH10. Will reconnect and see what happens. Thanks Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1873 |
Connected 10K pullup resistors to the 3.3V line and all works well. Thanks to all who helped. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1873 |
Well I thought all was OK, I have three of these sensors, the first one worked first up and I got the values from the EPROM. So I then connected the next one and I got the time out error and the same with the third one. I have altered the value of the pull up resistor, changed the time and frequency for I2CEN, all to no avail. Somehow I think the EPROM in the sensors is a bit suspect the sensors work fine but I just can't calibrate them. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
crackerjack Senior Member Joined: 11/07/2011 Location: AustraliaPosts: 164 |
Paul, how are you addressing three of theses devices on the same I2C bus. I don't know the device but you would obviously have to configure them somehow for unique addressing on a single bus, right? EDIT: After rereading the thread I guess you are not using all three sensors at once, just trying to read the calibration data for each one at a time, so please ignore my ignorant post. |
||||
Print this page |