DS1307 read error!

Sorry, wouldn't attach.

what loads do you have on the relays. Any solenoids or larger relays that are causing flyback (I think that's the correct term). Its a spike caused by a collapsing dc coil and due to the grounds being connected that could cause all sorts of problems. Or I might be completely wrong in which case just ignore me.

Excellent work on the wiring diagram. Everything seems in order as well. Is that common ground a terminal strip? Generally it is a good idea to have a common place for grounds, but in this case I recommend that you try bringing the ground from the RTC directly back to the controller instead. It is possible that the layout (which I can't fully see) has ground loops that induce a voltage in the RTC ground. At this point, the physical layout is "a person of interest" in the case. What powers the Arduino? Is it powered from Vin or the USB or from +5V somehow?

One thing that has Always worked for me is a star topology for all supplies and Really big suppression on any inductive load, as relay coils or solenoids are great sources of fast spikes that are hard to see on a fast O'scope...

It is always a good idea to add a .1 uF, a 220 to 1000 uF and a .001 nF cap at the star common points of the power supplies, not forgetting to use large wires, as the inductance of of smaller wires or thin pcb traces tend to decouple any bypassing, thus requiring bypassing ON each and every inductive load.
I cannot stress the grounding of each star ground enough as this is the easiest mistake to make with multiple power supplies and adequate bypassing. Caps are cheap, your time is not...

Doc

GPOP1 - the 8 way has 240v AC mains as it is running my bank of 8 plug sockets. The 2 way is also 240 volts. The 4 way is switching 12v going to 4x peristotic pumps.

AARG - 'excellent work'? I was waiting for a pasting because it wasn't a proper electrical diagram. Lol. Thanks.

The ground is not a terminal strip, it is multiple strips on a small breadboard that I have linked together to get more holes/ports.

The Arduino is currently powered by USB but I have tried plugging a power source in at the same time (so that I keep serial monitor) as I thought maybe it was running low on juice to send to the relays but the error just seemed to come up quicker. I'll have a fiddle with the grounds now.

DOCEDISOB - mate I'm sorry and I don't mean to sound rude but you lost me on the second line.

So I have tried a number of things now. I have moved the power for the RTC over to the 3.3v port which weren't being used before and put the RTC GND to its own arduino GND pin, still happening.

I have tried moving the grounds about so that they are all plugged in in different areas and to different Arduino GND ports but most likely they are all linked anyway so that probably didn't do much, never the less the problem is still there.

In have tried powering the RTC and the relay board both separately and together through the Arduino 5v instead of the independent 5v, still had the error.

I'm at a loss here and can't see what I can do to stop it happening. It can't be a faulty relay board because its happening with another different one that I have.

Has no-one ever come across this before? The error happens when the relays are closed AND has power going through them, and happens with both 12v and 240v (tried it with both relay modules.)

Is there anyway of using time on Arduino other than through an RTC. I have several functions that need to be triggered/monitored through time, i.e. start and end motors, time triggers to start fading lights, etc.

It's pretty much a guess, but you can try putting some stronger pullups on the sda and scl lines.

cattledog:
It's pretty much a guess, but you can try putting some stronger pullups on the sda and scl lines.

Right... and how the hell do I do that? lol/ Will that involve other components? Other than that, is there any other way of getting the time so that I can call by events when needed?

and how the hell do I do that? lol/ Will that involve other components?

Two resistors. Try read Nick Gammon's discussion on pullups. or some of the many postings found with forum search on "i2c pullup resistors".

I assume that there may be pullups on the rtc module already, probably 4.7K. If so, I'd start by adding another 4.7K resistor from both the SDA and SCL pins at the Arduino to 5v.

have you tried with the 12v power supply negative not being attached to the negative buss

gpop1:
have you tried with the 12v power supply negative not being attached to the negative buss

The 12v thats is connected to the working end of the relays (powering the motors and seems to trigger the error) is a separate plug altogether and not connected in any way to the Arduino.

stevelondon2:
AARG - 'excellent work'? I was waiting for a pasting because it wasn't a proper electrical diagram. Lol. Thanks.

It is. I used to work in telecom. The style you have there was very common. It isn't useful for component layouts, but it's the canonical way to draw a wiring interconnect.

stevelondon2:
The 12v thats is connected to the working end of the relays (powering the motors and seems to trigger the error) is a separate plug altogether and not connected in any way to the Arduino.

This kind of answer is not the kind of logic you need in the circumstances you're in. You can't outthink an unknown. If you let your reasoning block an easy test that you can try, you could essentially think your way out of a solution.

stevelondon2:
The 12v thats is connected to the working end of the relays (powering the motors and seems to trigger the error) is a separate plug altogether and not connected in any way to the Arduino.

your drawing shows the 12v negative sharing the negative buss with all the other negatives. The motors are inductive thus flyback is possible. We have seen a similar problem in the past where i2c is affected (in that case it was a lcd). As there's no need to join the negatives I would remove it from the buss or install a flyback diode on each motor (diagrams available on the net including a explanation of why they are required)

Ive seen all sorts of strange things happen with the arduino especially as we are using unshielded wire so its possible that if you have a ardunio wire that's close to a ac cable strange things can happen.

gpop1:
your drawing shows the 12v negative sharing the negative buss with all the other negatives.

I know it shows the 12v -ve going to the buss, but that is a 12v supply that is 'operating' a different pair of 12v relays. As in needs 12v TO switch, not to BE switched if I'm making myself clear.

I have two different types of relay boards, some that require 5v to power them and some that require 12v to power them. I have not put the 'switched' load in the diagram. Perhaps I should have. However I assumed that the voltage that they are 'switching' shouldn't matter as it shouldn't be linked to the Arduino circuitry.

AARG - yes you are so right. I will try it now anyway.

Is there an earth ground in your system?

aarg:
Is there an earth ground in your system?

I think so as the independent 5v and 12v supply are plugged into the mains, and the earths are all connected so I assume yes there is.

Actually no. I have just looked at the wall wart plug thing and the earth pin is just plastic, only the live and neutral are conductive. So as far as I can tell, there is no earth ground. (is that what you meant?)

stevelondon2:
I think so as the independent 5v and 12v supply are plugged into the mains, and the earths are all connected so I assume yes there is.

Actually no. I have just looked at the wall wart plug thing and the earth pin is just plastic, only the live and neutral are conductive. So as far as I can tell, there is no earth ground. (is that what you meant?)

Yes, that is what I meant. An earth ground is a vital component of an EMI suppression strategy.

aarg:
Yes, that is what I meant. An earth ground is a vital component of an EMI suppression strategy.

Oh right. How do you suggest doing that? Having a wire coming from the ground buss and into the ground of a plug socket?

stevelondon2:
Oh right. How do you suggest doing that? Having a wire coming from the ground buss and into the ground of a plug socket?

It's a little weird because you don't usually see a ground-only plug. But it would suffice for testing. It also helps if that ground extends to a shield around sensitive components like the controller.

For testing, you could also clip the ground to something grounded, like the case of a computer that is plugged in with a grounded cord.