DS1307 read error!

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!

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

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

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

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

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. :frowning:

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!!!!

Not that it probably makes any difference, but also after coming up with the error a few times, the arduino freezes and doesn't respond any more.

Right, I have just tested again with another set of relays running my plug sockets, that is doing it too!!!! Why the hell are these relays interfering with my RTC!?!?!?

Please follow a time tested procedure here, and provide a complete schematic diagram of your setup, including all boards, modules, supplies and interconnections.

Here is what I've made up and from I can see best shows it and easiest to understand.

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