Hi all . First of all excuse my english ,it is not my mother language.
I have an rtc ds1307 connected to a breadboard and then to the mega . Sda,scl with 4.7k resistors and another sensor in the I2C. Powering from an ATX PS 5V to the 5V line (In this case works better than the Vin,I don´t know why ) .
I was facing problems in sda line when the RTC isn't connected staright on the arduino. Plugging it in the breadboard was failing and sending 165:165, or just nothing .
I connected before the capacitor in the Vcc line ,but it didn't change anything . But it starts working when I connect the oscilloscope !!
I always follow Nick Gammon 's advices and tips , but this time I couldn't make the RTC works until I put and 1M pulldown resistor and 1uF electrolytic capacitor from SDA to GND.
Do I am making something wrong ? Are there another better solution that I should try?
A capacitor from SDA to ground should kill the signal completely. There's also no reason for a pulldown as that's what the logic switching does, if it's working correctly. I use 2K2 pullups for a typical layout as it shows a good clean waveform.
The DS1307 is very flaky on the I2C line. It does not work at all when used with the Wifi101 shield. Remove the shield, the DS1307 works. Put the shield in place, the DS1307 fails. The DS3231 is much more robust.
Like you, I also found that some communication with the DS1307 worked when an oscilloscope was used to read SDA. Presumably, the probe capacitance was an influence.
CrossRoads:
I have looked at I2C signals on oscilloscope, rise time with 10K pullup is terrible. 4.7K is much better.
The rise time spec for I2C on the DS1307 is 1000 ns. A 10K resistor will allow 45 pf on the line and still meet the spec. I know this because I recently went through the exercise when my DS1307 was failing. More than 45 pf on the line would be unusual. Just sayin'.