I2C Digital gauge indicator logic level shift

Hello I am having troubles with level shifting SCK and SDA from 1.5v to 5v, not sure if Im doing right. (I will include .jpg)
Has anyone some Arduino code and suggestions on how to connect Digital Dial Indicator Gauge to Arduino.
I tried to connect:

  1. SDA & SCL from gauge to Arduino SDA & SCL, and
  2. SDA & SCL from gauge to Arduino digital 4 & 2(0 interrupt).

I should get reading of the gauge on serial monitor on PC.
Why do I get some readings, if I Plug just a piece of wire in digital pin 2 ???
I tried this code: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1288396532

I doesnt work...
=(

  • Why are you connecting SDA and SCL to pins 2 and 4?
  • Why are you not supplying power to the device?
  • Why are you using a LM339? That's a "Low-power quad voltage comparator", not an I2C level shifter.
  • Why are you not connecting Gnd from the gauge to the LM339?
  • What is the part number of the "Digital Dial Indicator Gauge"?
  • What is your code?

mlinka:
Why are you using a LM339? That's a "Low-power quad voltage comparator", not an I2C level shifter.

--->> Im never did level shifting

So you reached into the box and just pulled out a chip, is that it?

For I2C level shifting this circuit from Philips is awesome: App note AN10441.pdf and an97055.pdf. I built one last weekend and it's working well. Two 5 cent mosfets, 4 resistors, done. I used 2N7002P mosfets, 3.3K pull-ups on the 3.3V side and 4.7K pull-ups on the 5V side.

Im Trying to use everything that I have.

I thought if I connect let say CLOCK signal (1.5V) to Voltage comparator Non-inverting Input1 (pin5), and connect GND to Inverting input1(pin4), VCC= to 5V, and Vcc- to GND -->
--> I thought that Output 1 should be Vcc+(5V) (for 1) and GND (for 0) of CLOCK signal, or?????

1.5V CLOCK SIGNAL --> 5V CLOCK SIGNAL??

mlinka:
Im Trying to use everything that I have.

You have given new meaning to the phase:

If all you have is a hammer, everything looks like a nail.

Don't just "use everything" ... find the part for the job at hand.

I2C has a special way of driving lines. You need a suitable part. I think this will do it:

Or search for I2C logic-level converter.

I think the Sparkfun part basically does what the quoted app note http://ics.nxp.com/support/documents/interface/pdf/an97055.pdf suggests.

So if you have the parts dhunt suggested, you can get it to work.

I tried to make I2C Logic level converter with 2 bss138 like frrom Sparkfun with no luck, I used schematic from here: http://www.instructables.com/id/A-bidirectional-logic-level-converter-for-I2C/
Can this work if I want to convert 1.5V logic to 5V?

One more question.
Can I connect Clock and Data from digital dial indicator to 2 Analog pins, and make a sketch to check when the voltage is let say above 1V to be logic 1, and below 1V to be logic 0?? And then put 2 digital pins HIGH or LOW depending of the Analog inputs of CLOCK and DATA of the indicator Gauge?, and connect thoose pins to interrupt pin for reading CLOCK and another digital pin for reading DATA? Or would that be too slow???
If even possible...

Thanks for help :slight_smile:
Im going craaazzyyyyyy already.....