Jump to content
sendiptangshu

HDC1080 with MSP430G2553

Recommended Posts

I had a HDC1080 EVM. I read that the back end of the evm can be broken off from the perforation and used as a standalone sensor on a micro-controller. I tried to interface it with the MSP430G2553. I have done the following with no avail:

1) the jumper on P1.6 has been removed(no interference of led with SCL line)

2) I have tried using pullup resistors on both the SCL and SDA lines. I have tried out with the standard 4.7k resistors and also with 10k resistors.

3) I always get a temperature value of -40 degree C and humidity of 0%, which means that the MSP is not able to get the readings through.

4) I am using the Wire library on Energia1.6.10E18 and I followed TI's tutorial video on how to implement HDC1080 on Arduino. Here's the link (

)

 

Here's my code:

?

#include <Wire.h>

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
 
Wire.begin();
//Wire.setModule();
Wire.beginTransmission(0x40);
Wire.write(0x02);
Wire.write(0x90);
Wire.write(0x00);
Wire.endTransmission();
delay(20);
}

void loop() {
  // put your main code here, to run repeatedly:
double temperature;
double humidity;

humidity = readSensor(&temperature);
Serial.println(temperature);
Serial.println(humidity);
delay(1000);
}

double readSensor(double* temperature){
 uint8_t Byte[4];
 int value;
 uint16_t temp;
 uint16_t humidity;

  Wire.beginTransmission(0x40);
  Wire.write(0x00);
  Wire.endTransmission();

  delay(20);
  Wire.requestFrom(0x40,4);

  if(4<=Wire.available())
  {
   Byte[0]=Wire.read();
   Byte[1]=Wire.read();
   Byte[3]=Wire.read();
   Byte[4]=Wire.read();

   temp = (((unsigned int)Byte[0] <<8 | Byte[1]));
   *temperature = (double)(temp)/(65536)*165-40;
   humidity = (((unsigned int)Byte[3] <<8 | Byte[4])); 
   return (double)(humidity)/(65536)*100;
   }
}

 

 

Where is it going wrong?

 

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

×