I have two UNO boards with motor sheilds and want to use I2C (TWI) to comm b/t the UNO boards. The comm works intermittently. I take off the motor shield and connect the I2C wires directly to the UNO board and the comm works great. I’ve ordered NO-OX-ID conductive paste to put on the male pins of the motor sheild and onto the male pins I put into the motor shield, and expect this will fix the problem. Just wanted to share an easy fix to an annoying problem!
Are you sure it's not electrical noise? Did you add pullup resistors to the I2C wires or are you relying on the built-in ones (I don't think they're low enough in value so I always add external 1.5k pullups)?
Is the comm intermmittent even when the motor shield is completely off? That would tell you whether or not it's an electrical noise issue.
Beat707: MIDI drum machine / sequencer / groove-box for Arduino
Yeah, I'm sure: the problem follows the motor shield. I ran w/o the shield for 3 hours and never missed a byte, which, with an intermittent is not definitive, but strongly indicative.
The system has 2.2K pullups: the 40K internal pullups deform the square wave into a sawtooth and make reliability unlikely (dsscircuits.com is for sale | HugeDomains).
Hey, its a cheap fix once the problem is identified! And the profanity I was aiming at the system wasn't helping at all (though the cat thought it was amusing).
The conductive grease (no-ox-id) did not fix the problem.
Remove motor shield, I2C works. Add motor shield, I2C doesn't work. There is nothing to the motor shield connection except a square peg and a square hole...not rocket science. Yet a solution eludes me.
Anyone out there have an idea on this?
Which motor shield is this?
By "running with the motor shield off" I really meant running with the motor shield mechanically attached but not doing anything: no motor connection, no power to the shield, etc.
My thinking is that it's electrical noise. If you can eliminate all other variables than actual current going through the motor shield and to the motors then that will support my theory.
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons
In 'running w/ shield off', I did as you described, and had no electrical connections to the shield but TWI and VCC->pullupResistors.
I'm inclined to agree...it is a noise issue: on power-up from cold, TWI works for about a minute, then decays rapidly to nothing.
The bug follows a particular instance of Adafruit's motor shield (Adafruit Motor/Stepper/Servo Shield for Arduino kit [v1.2] : ID 81 : $19.50 : Adafruit Industries, Unique & fun DIY electronics and kits). I have four UNO boards and four motor shields, and this problem follows a particular board.
I have had occasional TWI data fallout from other boards, which inclines me to the belief the problem is systemic to the shield but particularly prevalent to this single shield. The solution seems to be to implement a CRC to verify data and resend on faults. And trash the faulty board.
If you are curious, in debugging this I reflowed the faulty board's solder joints entirely under the thesis a cold||faulty joint might be causing it, but the connections between Analog 4 and 5 (TWI) through the motor shield are minimal...there are just no active components to mess things up, no use of VCC or ground (except through the pullup resistors), nothing but male/female plugs. Gremlins.
Thank you for your insights.