Can anyone see why my code is throwing up DS1307 errors??? Its been fine until I added the new dosing functions from line 893 to 941. I am using the Blynk app on my tablet and overtime I press either dose1prime or dose2prime which will turn the respective variable from 0 to 1, I get read errors on the serial monitor in relation to the RTC.
It says it has stopped, circuitry needs to be checked, etc, however the clock on the front screen of my Blynk app which reads the time every second from the arduino/RTC is working fine. I just don't know why these errors are being called.
I've tried changing the setup of my arduino power supply to the RTC (its in a big box with lots of things going to it and from and has a 5v rail and a 12v rail so tried running it from an independent power supply)
I tried it running on 3.3v, I tried looking to see if anything else is running on the SDA or SCA pins to do with the loser but can;t see anything that would cause an issue. I just can't see why it was working fine until I added that last bit of code. I have tried taking bits out and moving it around but it still happens.
It would be easier if you provide an excerpt containing the lines you are talking about. When I load the sketch, the lines starting at 893 look like
{
pwr7off();
}
which doesn't sound like what you're talking about...
Also I can find no references to the RTC beyond the library include, and no references to "dose1prime" in your code. If we can only see the "respective variable" then you should tell us which one it is.
Lastly, have you loaded a simple RTC example sketch to verify that the RTC is working?
You alluded to some known lines that caused trouble when you added them. So we don't have to wade through your 200 pages of code blindly, could you please excerpt those lines in a separate post, inside code tags?
Aarg I added it all because I didn't know if it was pulling something or conflicting with something from elsewhere in the sketch and that the few new lines of code was linking to it.
Johnwasser yes I used the set time and read sketches and all works fine. Even though it's coming up with the errors the RTC is still working because it is writing the correct time and seconds on the front page of my app which is pulling it directly from the RTC.
the error is only listed in your code once so start there and work backwards.
DS1307 read error! Please check the circuitry.
if (RTC.read(tm))
{
// Serial.println(bufTime);
}
else
{
if (RTC.chipPresent()) {
Serial.println("The DS1307 is stopped. Please run the SetTime");
Serial.println("example to initialize the time and begin running.");
Serial.println();
}
else
{
Serial.println("DS1307 read error! Please check the circuitry.");
Serial.println();
}
}
Exactly, so for some reason whenever dose1prime or dose2prime == 1, the RTC is not being read AND is not showing as present. I also sometimes get the other error though as in "if (RTC.chippresent) so will it really does seem to have a conflict but can't understand why. And it's only if dose(x)prime is == 1!
Been a bit busy with work lately so not been able to have a play. I have stumbled across something intresting which MAY be causing the issue.
This is for a fish tank dosing unit. I have a 4 way 5v relay board attached to 4 peristaltic motors. I am using pins D38-D40 as the data, an independent 5v VCC and a common ground. This is run from my Arduino housing through a Cat 5 cable to the dosing unit housing where it is then plugged into the relay board.
The motors/pumps are 12v and so I have a separate 12v DC power supply going into the doser housing with the +'ve running to each of the relay common terminals and the -'ve connected to the -'ve of all 4 motors. The relay NO terminals are then wired to each relating +'ve of each motor/pump.
WHAT I HAVE FOUND is that when the 12v supply is NOT connected (and baring in mind that this is only connected to the relays themselves and not part of the arduino circuitry) I do not get the RTC error. But as soon as I plug in the 12v supply, the error comes up!?!?!?
Any ideas? I'm going to keep playing with it now but if anyone can think of anything, please throw me a bone.
Yes, thats it, its the damn 12v supply. Whenever it is plugged in it is giving me the error. If I leave it disconnected so its only the relays clicking open and shut with NO 12v going through them, its fine!
Why the hell is that even effecting the Arduino side, it should be independent!
Cheers for your reply. No I found that jumper when I was playing around and had to google what it was.
No the jumper is connected and the board is powered from 5v at the arduino end. (I need quite a few 5v requirements so have a separate 5v input in my arduino housing which powers most of the relays via a breadboard. I have ensured that it shares a common ground with the arduino ground though. I have however connected the RTC and my temp sensors direct to the 5v supply on the arduino just because they are more important.)
The relays themselves are having a 12v DC supply going through them to power the pumps. But as I said the relay BOARD is 5v from the Arduino box.
Have you tried with the jumper removed, and the 5v side of the relay powered by a supply which is not shared with the Arduino except for a common ground?
FFS. I really thought that was going to be it. I just put 5v straight to it and its still doing it. I also ran a very basic sketch with just the relays flicking on and off and the RTC running and it happened then too so I think its safe to say its something with the board.
I really don't understand it though as a I have a 2way relay board switching 240v mains supply into plug sockets and it don't do it with that.
I might change the wiring around so that the negative of the 12v is switched through the relays instead of the positive.
Right, I have just tried switching the polarity around so now the relays are switching the negative leg of the independent 12v supply... still get the error! I don't understand it, I thought maybe the 12v was shorting back into the Arduino but now its just the ground in the relay and its still happening!!! arrrrgggghhhhh!!!!