Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

I2C bus length

Status
Not open for further replies.

marxmax

New Member
I programmed a PIC16F877A chip to read temperature using a Texas Instruments TMP75. I successfully displayed data on a 7-segment. But the problem is in practice i have to keep the sensor around 60 feet away from the PIC. I am using 100kHz as bus frequency. How can i achieve this?
 
I'm not certain that this is even possible?

I2C is a single ended, 5V signaling protocol with pullup resistors. With a cable that long, circuits designed for communicating on a board or a backplane are going to have trouble. A first level answer is that you need a transceiver of some type on both ends. It is not that simple, since there may be other requirements, of the I2C protocol that will be violated by the addition of transceivers. They add delay and change the characteristics of the open collector type I2C bus.

In most systems SCL can be unidirectional from the master to the peripheral. SDA must be bidirectional and there must be some logic that tells the transceivers(plural) to turn around. If the processor has I2C hardware this might be a problem. If you are bit banging the I2C protocol then this might be an easier requirement to meet.

Unless there is some kind of support for this in the I2C protocol I think you're pretty much on your own. If it works -- great. If it doesn't then you'll get no sympathy from the folks who invented I2C or pretty much anyone else either. Sorry 'bout that.
 
Yes. This chip is the ticket. Get yourself a pair quickly. Good catch BeeBop!
 
Thanks guys. That philips I2C expander is a good one. But as Nigel said it will be cheaper if i use one more PIC and use RS232.
 
another option, since changing parts is on the table

DS18B20 is $3.97 from Randy at Glitchbuster.com ... (compare to $5.04 from digikey)

1-wire digital thermostat (you can program high/low alarms into it), it even contains a little nvram to stash an easter egg in.

I guess it's kinda pricey (pic 12f is $1.19 from Randy), but it's a "microlan" (Dallas's word), so you can pile a bunch of sensors on a single pin, if expandibility is a concern?
 
I agree that DS18B20/DS18S20 is a good part. I use it everywhere I need to measure temperature.
The only disadvantage is, perhaps, tha you have to write your own 1wire software routine, which can be hard for beginners...
 
marxmax said:
Thanks guys. That philips I2C expander is a good one. But as Nigel said it will be cheaper if i use one more PIC and use RS232.

Or reduce I2C bus frequency to 1KHz, which should be quite OK for reading temperature?
 
Can you or Nigel explain why RS-232 at 60' is a reasonable thing to do, since the original specification limits the length of a cable to 25 feet?
 
eblc1388 said:
marxmax said:
Thanks guys. That philips I2C expander is a good one. But as Nigel said it will be cheaper if i use one more PIC and use RS232.

Or reduce I2C bus frequency to 1KHz, which should be quite OK for reading temperature?


Are you saying that at 1KHz 60 feet bus length will be ok??
 
Papabravo said:
Can you or Nigel explain why RS-232 at 60' is a reasonable thing to do, since the original specification limits the length of a cable to 25 feet?

I think the maximum cable distance depend on cable quality, RS232 voltage level and drive current. A voltage of +/-12V and >10mA drive current and a good cable will give a range of 50 meters.
 
I'm surprised at that claim, 50M single ended. What baudrate are we talking about and what kind of cable?
 
the building I work in is wired for rs232, as part of an old client-server application ... there are still a few terminals and printers scattered about, fully functional

we easily have cables in excess of 50m, with no boosters. The baud rate is 19200 I believe.
 
So...I am wondering why I am standing here beside myself.

LOL
 
Wow,
This thread has me wanting to start a project, just to see how far apart a couple of players could get with I2C! The link to the maximum length info, was an eye opener. 100m at 500Hz, OMG!!
 
Physical layer and media research is indeed and interesting subject. Pushing a technology to it's limits is quite satisfying.
 
I checked it with a I2C bus frequency of 8 KHz and a 30 feet twisted cable with ground path, and it works fine. If ground is removed from twisted cable the signal fails. I used a computer network cable for this. Unfortunately right now i dont have a 60 feet cable to check this for 60 feet.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top