Go Down

Topic: I2C Digital gauge indicator logic level shift (Read 1 time) previous topic - next topic

mlinka

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...
=(

Nick Gammon


  • 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?

Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

mlinka



  • Why are you connecting SDA and SCL to pins 2 and 4?
--->> I tried to connect to SDA and SCL, but in the code Im using CLOCK is connected to interrupt on pin 2, and digital pin 4 for data.
  • Why are you not supplying power to the device?
--->> The device is using 1.5V battery.
  • Why are you using a LM339? That's a "Low-power quad voltage comparator", not an I2C level shifter.
--->> Im never did level shifting
  • Why are you not connecting Gnd from the gauge to the LM339?
--->> Where should I connect GND?, I tried to GND on Arduino??
  • What is the part number of the "Digital Dial Indicator Gauge"?
--->> http://www.ebay.com/itm/DIGITAL-DIAL-INDICATOR-GAUGE-25-4MM-1-LONG-TRAVEL-MEASURING-SETUP-TOOL-H16-/150795623876?pt=LH_DefaultDomain_0&hash=item231c1e9dc4#ht_3924wt_1163
  • What is your code?
Thats the code --->> http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1288396532
[/list]

Nick Gammon


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?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

dhunt

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.

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?


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??

Nick Gammon


Im Trying to use everything that I have.


You have given new meaning to the phase:

Quote
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:

http://www.sparkfun.com/products/8745

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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

mlinka

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 :)
Im going craaazzyyyyyy already.....

Go Up