[SOLVED] Photon and HTU21D-F / I2C issue

I am trying to use the HTU21D-F from Adafruit with my new Photon.

I’ve wired the two as shown here:

PH VIN -> HTU VIN
PH GRD -> HTU Grd
PH D0 -> HTU SDA
PH D1 -> HTU SCL

I am using the HTU libraries found in the online Particle Build library.

I compile and flash and get no errors.

Some of the code is:

#include "HTU21D/HTU21D.h"

HTU21D htu = HTU21D();

void setup()
{
	Serial.begin(9600);

	Serial.println("HTU21D test");

	while(!htu.begin()){
	    Serial.println("Waiting for HTU21D to start.");
	    delay(1000);
	}

	Serial.println("HTU21D OK");
}

The only thing I see in the serial window is:
“Waiting for HTU21D to start.”

Can somebody help figure out where the issue is with my setup?

Thanks.
Eric

@EricBrian, I am having issues with I2C as well and I have pinged @BDub to get his comments. Stay tuned.

Hey guys! Please see this post with Mat’s instructions on how to fix the issue with these two pins: D0, D1 not working with Photon (suspected relay shield problem, was not)

Yes, that fix described there works for me. Thanks @BDub

Unfortunately the 0.4.3 update does not fix I2C problems with humidity and pressure sensors on the SparkFun Photon Weather Shield. After the update sensor output generates bogus data to serial monitor. I have a Photon from the latest shipment and two SparkFun Weather Shields both showing the same problems with I2C on the Photon but not Core (according to SparkFun Engineers).

I have some problems with https://learn.sparkfun.com/tutorials/htu21d-humidity-sensor-hookup-guide but not with the F version, but this is connected to Vin as opposed to 3v3. It (non-F) works on Arduino I tested, but not on Photon (tested power, pins and all no problems). I’m not sure where this problem arises from I’ll look if the problem is the pull up resistors.

But I had success in building locally using the development branch.

@FistOfTheNorthStar,

Did you try what @mdma suggests here:

No that's not the issue here. The Adafruit sensor you have in the picture works perfectly for me, but the one from SparkFun doesn't. I've tested the SparkFun ones on an Arduino Mega and they work even if powered by the Photon. I went over the library and compiled the library from SparkFun's github thinking that there could be some difference there, no this was not the issue. The Adafruit one works with this SparkFun library, but again the SparkFun-sensor doesn't. This means that the issue is deeper. Perhaps it is a similar issue that @wmjenk mentioned with the weather shield.

I don't have an oscilloscope here so I could see the output.

1 Like

Minor update, so it appears that after flashing code (SparkFun Weather Shield guide examples) to the Photon, the first one or two or three data outputs to serial provide correct temperature, humidity and pressure data and then go corrupt and stay corrupt. Very repeatable.

2 Likes