Hi All,
I have an adafruit DS1307 breakout board that I've wired up to an Arduino Rev 2 and I can't get it to print anything on the serial monitor. I am running the ds1307 code from adafruits RTClib.h library (attached), and it should print the date and time, but the serial monitor is blank. I've checked the baud settings and new line option is selected.
I am trying to replicate a build that I inherited (and works fine), so have replicated the layout so that I would be sure all the wiring was in the right place. On the original build, ground from the DS1307 board is connected to gnd, 5v to 5v, SDA to digital 2 pin, SCL to digital 3. I've replicated this for the Arduino yun rev 2, and have switiched out the yun on the original build with a rev 2 to check the wiring and it worked fine.
If I unplug the wires to the digital pins the serial monitor then reads "Couldn't find RTC" (understandably), so appears to be a hardware/communication issue. I am a complete newbie with arduino and electronics and all I can think of is that I've likely messed up the soldering/wiring and managed to short something (although the wiring/soldering looks OK to me). In the same set-up, I have a DS18B20 temperature sensor, and this works fine and prints to the serial monitor, so figure it is most likely a hardware issue to do with the DS1307 breakout board.
I'd really appreciate any suggestions you might have to troubleshoot the issue in case it is a programming or communication issue or to confirm its a hardware problem. Can also provide pictures of the board layout to help confirm whether I bodged it.
Thanks in advance
ds1307.ino (2.19 KB)
You could try running the I2C scanner to see if your DS1307 is detected, and at what address it was found.
markd833:
You could try running the I2C scanner to see if your DS1307 is detected, and at what address it was found.
Sorry for the delay, had some stuff come up the last couple of weeks. Thanks for the suggestion, when I run the I2cBusScan, the serial monitor prints "addr: 0x0" and nothing else, so it is definitely not finding it.
when I run the I2cBusScan, the serial monitor prints "addr: 0x0" and nothing else, so it is definitely not finding it.
I'm not certain what code you ran, but this Wire library address scan example code for does not have any print outs which look like that. Whether or not the test sketch hangs up or what it reports is important. Try this scanner, and report what it prints.
// --------------------------------------
// i2c_scanner
//
// Version 1
// This program (or code that looks like it)
// can be found in many places.
// For example on the Arduino.cc forum.
// The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
// Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26 2013
// V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
// by Arduino.cc user Krodal.
// Changes by louarnold removed.
// Scanning addresses changed from 0...127 to 1...119,
// according to the i2c scanner by Nick Gammon
// https://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
// As version 4, but address scans now to 127.
// A sensor seems to use address 120.
// Version 6, November 27, 2015.
// Added waiting for the Leonardo serial communication.
//
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\nI2C Scanner");
}
void loop() {
int nDevices = 0;
Serial.println("Scanning...");
for (byte address = 1; address < 127; ++address) {
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
byte error = Wire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address < 16) {
Serial.print("0");
}
Serial.print(address, HEX);
Serial.println(" !");
++nDevices;
} else if (error == 4) {
Serial.print("Unknown error at address 0x");
if (address < 16) {
Serial.print("0");
}
Serial.println(address, HEX);
}
}
if (nDevices == 0) {
Serial.println("No I2C devices found\n");
} else {
Serial.println("done\n");
}
delay(5000); // Wait 5 seconds for next scan
}