Go Down

Topic: DS1307 read error! (Read 1 time) previous topic - next topic

stevelondon2

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.

Serial monitor below.

Code: [Select]
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.7 on Arduino Mega

[18271] Connecting to blynk-cloud.com:8442
[18464] Ready (ping: 43ms).
dose1prime - 1
DS1307 read error!  Please check the circuitry.

DS1307 read error!  Please check the circuitry.

dose1prime - 0
dose2prime - 1
DS1307 read error!  Please check the circuitry.

DS1307 read error!  Please check the circuitry.

dose2prime - 0


Ive tried troubleshooting it but can't seem to find it.  >:(

Thanks, Steve

aarg

What troubleshooting have you tried?
  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

stevelondon2

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.

Can you see it and just testing me or???

aarg

#3
Jul 30, 2017, 03:54 am Last Edit: Jul 30, 2017, 04:28 am by aarg
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
Code: [Select]
  {
    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?
  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

stevelondon2

Oh I'm sorry aarg, the whole code couldn't have copied and pasted into the file that I uploaded. I'll do it again shortly in a mo when in on my comp.

Yes sorry I have run set time and read time and all working fine every time. Then I reupload my main code and start getting the errors again.

stevelondon2

I don't know what has happened but that file isn't the complete thing. I have attached the correct one below.

Sorry.

aarg

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?
  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

johnwasser

"DS1307 read error!  Please check the circuitry."

Did you check the circuitry?

Did you try the DS1307RTC library ReadTest example to see that your DS1307RTC was working?

Did you use the DS1307RTC library SetTime example to set the RTC?
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

stevelondon2

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.

gpop1

the error is only listed in your code once so start there and work backwards.

DS1307 read error!  Please check the circuitry.



Code: [Select]
  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();
    }
  }



stevelondon2

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!

gpop1

what would happen if you moved

tmElements_t tm;


stevelondon2

#12
Aug 03, 2017, 05:11 pm Last Edit: Aug 03, 2017, 05:18 pm by stevelondon2 Reason: Add photo
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.

Cheers.


stevelondon2

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!

cattledog

Is the JD-VCC jumper removed, and  a separate 5v supply to the relay?

https://arduino-info.wikispaces.com/RelayIsolation

Go Up