I've got a Honeywell I2C flow sensor I'm trying to hook up. It's a HAFBLF0200C4AX3 that I've connected via a level shifter (3.3/5V) to an Arduino Uno. I'm pretty sure everything is hooked up correctly (tested w/ multimeter). I also got a software I2C library set up on the digital pins and was able to read from the standard I2C pins (A4 & A5) using the Wire library as a slave; so I think I'm using the Wire library correctly. When communicating with the sensor the software library just returns 255. The Wire library hangs on Wire.requestFrom(0x49) until I disconnect the sensor then it returns 0. I'm hoping there's some protocol issue that I've overlooked (since it seems that Wire is expecting something from the sensor), but it looks like pretty standard.
#include <Wire.h>
void setup() {
// put your setup code here, to run once:
Wire.begin();
Serial.begin(9600);
Serial.println("Initializing");
}
void loop() {
// put your main code here, to run repeatedly:
Wire.requestFrom(0x49, 2);
Serial.print(Wire.receive(), DEC);
Serial.print(" ");
Serial.println(Wire.receive(), DEC);
delay(2000);
}
There are 2 versions of the part, I am using the 3 v version. I have pullups to 3.3 v vdd coming off the sensor side. I think the 255 indicates no activity from the sensor.
Finally got something. Nick, at first your code would just hang on the first iteration of the loop. Another scanner(software based) would return every address. I replaced the 10kohm resistors in the level shifter with 3300s and now your code works perfectly. (Actually I tried many, many things, but that was the one that worked). I'm guessing the larger resistors (10K) caused too much transition time and messed up the signal?
Glad you got it working.
4.7K vs 10K, really depends on the signal runs, wire lengths.
My Bobuino uses 10Ks, with an RTC connected via traces & good ground planes, so the signals should be good & solid.
Breadboard & jumpers, lower resistors for faster switching times are probably better.