I2C cable length versus keypad cable length
Ron Czapala
Posts: 2,418
I am working on an alarm system using a Parallax 4x4 keypad along with an I2C MCP23008 I/O expander chip (@ 3.3v) using a Propeller board.
I would like to position the keypad about 15-20 feet from the Propeller.
Would it be best to put the MCP23008 close to the keypad an have I2C signal travel 20 feet or
just extend the 8 keypad wires 20 feet and put the MCP23008 close to the propeller.
I read that I2C over Cat5 cable at speeds up to 10khz should work.
Not sure how fast the i2cObject code is running on a 80MHz propeller.
Any suggestions?
Thanks,
- Ron
I would like to position the keypad about 15-20 feet from the Propeller.
Would it be best to put the MCP23008 close to the keypad an have I2C signal travel 20 feet or
just extend the 8 keypad wires 20 feet and put the MCP23008 close to the propeller.
I read that I2C over Cat5 cable at speeds up to 10khz should work.
Not sure how fast the i2cObject code is running on a 80MHz propeller.
Any suggestions?
Thanks,
- Ron
Comments
Thanks for your feedback. I know there is no simple answer but I was hoping to hear from someone based on their experience. There will not be any heavy data transfers in my situation but since the keypad will be used to disarm the system, I need it to be reliable.
Guess I cut a 20 ft length off my spool and try it.
Were you using 5V or 3.3V? I wonder if using 5V for the MCP23008 and stick 1k resistors on the SDA and SCL lines would be better than 3.3 volts.
Thanks again. My first attempt using SDA/SCL as a pair at 3.3V and no pullups failed. I'll try your scenario or maybe just resort to putting everything in one box...
Interesting. I installed a wired DSC system with two keypads and an expansion board in my house. I wondered what protocol it used.
It is amazing how many parameters and settings there are.
I figured it was proprietary and embedded on a chip...
This is due to the faster than Spin I2C access during boot and the capacitance in the longer cable skewing the I2C signals.
I reduced the SDA pullup resistance to 1K to achieve 20 feet distance on typical 4 wire "alarm cable".
DSC had the most parameters for there systems. But what do you expect from a DSC 864. 8 zones out of the box, expandable to 64 zones. Each zone expander had 8 zones on it. That was 8 expander boards, on two wires (red and black are power). I don't remember what it used for a chip, but at the time everything was through hole.
Keeping the signal on the outside pair solved the problem completely. The outside pair is black/yellow and the inside pair is green/red. One more step: I ended up with some nice plenum cable with two individually shielded pairs, and ran it with one signal and one power on each shielded pair, shield to ground. That worked fine at 50 feet and I tested it out to 80 feet, running i2c from Spin at ~20kHz. If you are using unshielded CAT5 cable, try to use pairs that are far apart and ground any unused pairs.
I am using two drivers actually - Mike Green's for the EEPROM and the ic2Object for the MCP23008.
I might try using a different set of pins instead of 28 & 29 as William Chan mentioned and use pullup resistors.
I bought a 500ft roll of this cable from HomeDepot a couple of years back http://www.homedepot.com/p/Cerrowire-500-ft-22-4-Stranded-Overall-Shield-Security-Alarm-Wire-Grey-225-0024J2/202206432
It has 4 conductor 22 gauge stranded wire with a plastic/foil sort of shield along with an uninsulated ground wire. I could run two cables and with SDA in one and SCL in the other.
I can use the other wires for the LCD and piezo speaker.
This is Mike Green's http://obex.parallax.com/object/155 and this is i2cObject http://obex.parallax.com/object/26
It works great with 12" wires
Here is a video https://www.youtube.com/watch?v=plLQFZlsKHA
And a link to the Project Forum thread http://forums.parallax.com/showthread.php/155592-Alarm-System-video-Propeller-keypad-(w-MCP23008)-LCD
the 4 daya bus wires are 12VDC, ground, clock & data
I suspected it might be a RS485 variant but figured it would use encryption or something since it is utilized in security systems.
I'm sure someone has used a logic analyzer to check it out.
I did read something about pullups making I2C more reliable for longer distances - guess it has something to do with thresholds.
The schematic for the Propeller protoboards shows 10K pullups on pins 28 and 29 (for the EEPROM) so adding additional 4.7k resistors in parallel would actually lower the combined resistance, right?
Or is that the goal?
The MCP23008 detected buttons being pushed using the Interrupt-on-change method but it was almost always the same value regardless of which button I pressed.
Capacitance issue I assume.
Oh well.
I am surprised that no one has a I2C/RS485 converter available.
I tend to agree with you - I2C is not a long distance runner - sprints only!
I added 4.7k pullups to SDA and SCL, 5V to the MCP23008 (along with 1k inline resistors on SDA, SCL and INT pins). Also tried pins 14&15 for I2C.
Works great with 1 foot wires but no joy using 20ft of CAT5.
I have some MAX485 chips and even considered using a PICAXE to handle the I2C to RS485 but decided that was adding too much complexity.
Guess I'll put everything in one box along with the 12V gell cell and charger.
Thanks to all for your tips and suggestions.
- Ron
Hi.
The NXP P82B715 I2C extender chip is designed to allow transmission of I2C signals up to 50 metres.
Of course that means running the signal between the two extender chips at 12 volts.
I looked into those a little. T Chap mentioned extender chips in post #2 but said he did not see much benefit.
Have you used them and had satisfactory results? Supposedly they can use 3v to 12v.
Ah - I misunderstood. I wasn't able to get it working as I mentioned in post #22. I suppose it could be a difference in what I2C device you are using and what propeller driver code you use.
The last thing I want is to have an alarm system blaring and not be able to disarm it because the keypad won't respond...
And I agree - $3 a chip seems high. I saw them at Jameco so I might get some the next time I order from there.
I appreciate your help and suggestions but the whole CAT5 approach seems a little finicky. Since it is going in the garage, the easiest approach would be to move the alarm panel next to the door and put the keypad right on the alarm panel.
I may still order some I2C extender chips to study and play around with.
Thanks for your help. I'll chalk this up as a learning experience.