Digipicco I2C Humidity Sensor

Hi,

I've got a libelium waspmote and a digipicco I2C humidity sensor.

I' ve been reading a lot of posts and trying several to use programs but I couldn't received nothing from my sensor.

I feed it by the 5V power of the waspmote and read it by SDA and SCL I2C channels, but it stops when it arrives to "Wire.endTransmission()" instruction, or "Wire.requestFrom(address, quantity)".

I checked this with another sensor and another waspmote but it doesn't works neither.

Is there anybody who has used this sensor??
Can someone help me??

Hi,
I'm also using the same sensor from DigiPico, I'm also strugling to interface that ..

How to check that whether the sensor is up or not ..?

regards
cheth

Could you show us the code used and do you have the URl of the sensor?

but I couldn't received nothing from my sensor.

So what did you receive? If you couldn't receive nothing, then you must have received something!

Or are you saying you couldn't receive anything?

The first thing to check is what address you are using. Addresses come in two form one that includes the read / write bit as bit zero and the other that doesn't. The arduino requires the latter, if you use the wrong one you will not receive anything.

Ok, I'm going to tell you all the things I've been finding until now.

First of all, its website:

I talked with their engineers and they said me that we have to use address 0x78 (7 bit) plus one bit for read (1) or write (0).

I'm working with a waspmote from Libelium, and I'm using their libraries, but when I tried to use the 'requestFrom' or 'endTransmission' instructions the system halts.

Asking for this to the Libelium staff, they told me that i have to switch on the RTC (it uses the I2C bus too), but when I do that, my system halts too when it arrives to the 'RTC.begin' instruction.

Also I don't know how to read the humidity correctly.

After a lot of test, I have a code that seems to work sometimes.

uint8_t ADDRESS = B1111000; //0x78;
uint8_t ADDRESS_2 = B11110000; //0xF0;
uint8_t ADDRESS_3 = B11110001; //0xF1;
uint16_t MASK = B01111111;
uint8_t REG = 0x00;

uint8_t quantity=4;
uint8_t info[4];
uint16_t temperature=0;
uint16_t humidity=0;
int i=0;

void setup()
{
USB.begin();
RTC.begin();

pinMode(SENS_PW_5V,OUTPUT);
PWR.setSensorPower(SENS_5V,SENS_ON);

if( !Wire.I2C_ON ) Wire.begin();
}

void loop()
{
USB.println("\tHumidity & Temperature:\n");

// Wire.requestFrom(ADDRESS_3, quantity);
Wire.beginTransmission(ADDRESS_3);

for (i=0;i<quantity;i++)
{
if (Wire.available())
{
info*=Wire.receive();*

  • delayMicroseconds(0.65);*
  • }*
  • }*
    // Wire.endTransmission();
  • for(i=0;i<quantity;i++)*
  • { *
  • if (i==0 || i==2)*
  • {*
    info = info & MASK;
    * }*
    * }*

* humidity = (info[0] << 8) + info[1];*
* USB.print("Humidity: ");*
* USB.println(humidity,DEC);*
* temperature = (info[2] << 8) + info[3];*
* USB.print("Temperature: ");*
* USB.println(temperature,DEC);*
* delay(2000);*
}

That code won't even begin to compile on my computer. You seem to have left out a lot of include files.

Where are RTC, USB, and PWR defined? Where are they initialized?

What data does the humidity sensor need from the RTC? If there is no interaction, remove the RTC and the code for it, until you know how to read from the humidity sensor.

 for (i=0;i<quantity;i++)
 {
   if (Wire.available())
   {
     info[i]=Wire.receive();
     delayMicroseconds(0.65);
   }
 }

You make several passes through the loop. What happens if no data is available on one pass, but there is data on the next pass.

Ok, I had to tell you several things before writing all this.

I don't need to include the libraries because the compiler already knows it has to include them.

The sensor doesn't need nothing from the RTC but the arduino seller recommends me that I switched it on for avoiding bus interferences.

And the sensor starts send data after its initialization, it send 4 following bytes. They are 2 for humidty (15 bits) and other 2 for temeprature (15 bits).

Digipicco I2C from data sheet:

First of all the external microcontroller (master) sends the start condition to the slave (DigiPicco). Then the master transmits the standard 7 Bit address (0x78) or a factory customizable address. The eight bit (LSB) determines the direction of data flow and has to be set during this operation. Following, the slave (DigiPicco) acknowledges the receipt of data with the acknowledge condition (SDA kept low during a positive clock cycle). After that, the slave (DigiPicco) outputs the data values. After each data byte the master has to acknowledge the receipt of the data values by the acknowledge condition, except before the stop condition has been sent by the master itself.

The humidity and the temperature values exist of two bytes each. The first two bytes are the humidity values and the second two bytes are the temperature values, 15 bit each. This sequence is repeated indefinitely until the stop condition has been sent (also refer to diagram below).

Start Condition:
SDA changes from high to low during SCL is in high condition.

Stop Condition:
SDA changes from low to high during SCL is in high condition.

PD: I have to say that I'm new with arduino, so I'm trying to do this the better I can. Thanks

I don't need to include the libraries because the compiler already knows it has to include them.

Not in my world, but OK.

The sensor doesn't need nothing from the RTC but the arduino seller recommends me that I switched it on for avoiding bus interferences.

Less interference if you simply remove it and all code that deals with it when you are trying to debug a problem, but, it's up to you.

The sensor doesn't need nothing from the RTC but the arduino seller recommends me that I switched it on for avoiding bus interferences.

OK. Lets play a game. You have 4 baseballs and I have a glove and 4 buckets. Each time I am ready to catch a ball, I will toss the ball I catch in the next bucket. If you haven't thrown the ball by the time I am ready, I'll just kick the next bucket over, instead. It takes you much longer to toss the ball than it takes my to be ready to catch it. You get $1.00 for each ball that gets in a bucket, and I get $10 for each bucket I kick over empty. Ready. Go.

How many buckets have balls in them?

Ok, I'm trying to search any help, but you're too clever.

The first I said it is I'm using a libelium arduino, if you want to help me you have to know that their compiler already includes by itself all the libraries which the code needs.

And the RTC is hooked to the arduino so if I remove it I break the arduino.

So if you don't know how to use the sensor... ok!! it doesn't matter but don't mess with the people who are trying to develop their hobbies.

Ah!! Baseball sucks!!