I2C clock miss behaving!

Thread Starter

geoffers

Joined Oct 25, 2010
475
Hi all,

I've a project on the go at the moment that uses a microchip rtcc on the I2C bus, I've had it working no problems back in the spring, keeping good time etc.

Just recently I've been adding a few more bits and bobs to the board, my circuit is currently built up on bodge (strip!) board. First strange thing was the clock refused to start on power up after a few months unused, I thought a bit of damp must have got in, gave it a quick blast with the hot air gun and off it went!

I then added a ssr to the board to switch a small 240v ac pump, I noticed when the pic starts the pump the clock stops! Its also running quite slow?

The first problem, ie clock not running happened before the addition of the ssr, however the clock stopping and starting as the pump goes on and off, has only happened since 240v turned up on the board.

I've checked for any shorts and found none, the rtcc uses a 32Khz crystal as a osc, do folks think its more likely my crystal is junk or the 240v ac on the strip board is the problem?

I'm feeling my way with this stuff, I wonder if I should put mains switching stuff in a seperate box?

Cheers Geoff
 

ErnieM

Joined Apr 24, 2011
8,377
Remotely commenting on "oddball" problems like this is really futile, it's the guy on site that can note "when I wiggle this that goes out" and can "feel" the way to a solution.

Got a schematic?

Got pictures of the build?

Did you clean the board when you were done soldering?
 

Thread Starter

geoffers

Joined Oct 25, 2010
475
Hi Guys,
Thanks for the quick responses, I've been messing about with it today, I may have posted before I asked myself properly?!

I think the problem is the oscillator attached to the I2C clock (mcp7940m) is being interfered with by the presence of 240v ac on the same bit of stripboard?

Start from the top, with the pump attached and running, the I2C clock stops, the pic is running fine, the logic of the I2C clock must also be working as the pic is asking it the time and then displaying the time on a display.

If I disconnect the pump, when the pic turns the ssr on the clock runs really slow.

If I remove the 240v connection from the board completly the clock keeps good time.

All this is a roundabout way of asking if there is a rough rule of thumb as to how far a track with 240vac on it should be away from a crystal osc? Mine is obviously to close! I broke the tracks on board with a drill bit so the gap isn't huge at to moment!

Cheers Geoff
 

THE_RB

Joined Feb 11, 2008
5,438
Standard 0.1" veroboard/stripboard is NOT rated for 240v AC mains! :eek:

I'm not saying that is the cause of your I2C comms issues, but it is a REALLY good idea to remove the 240v AC from your stripboard to make it much less dangerous and less prone to arc over in event of humidity or insects etc.

Can you post a photo of your setup? We can then advise on both making it safer and on modifications to improve the noise immunity.
 

ErnieM

Joined Apr 24, 2011
8,377
All this is a roundabout way of asking if there is a rough rule of thumb as to how far a track with 240vac on it should be away from a crystal osc? Mine is obviously to close! I broke the tracks on board with a drill bit so the gap isn't huge at to moment!
Somewhere a brain cell is saying something like "100 volts per mil," meaning 240 V would need a spacing of just .0024 inches... but that's for trace spacing on a clean PCB made of FR4 with all flux removed. An ideal situation.

Rather then breaking a track with a drill bit I cut then with an exacto knife so I can pull them off: a soldering iron and a solder blob are great at getting the adhesive to release so you can zip up a trace.

When laying out something like this I make a domain there for the 240 V stuff and over here for the low voltage stuff... with the least amount of traces crossing the border, and as big a no man's land as is left.

That's the general case. To make any comments about your work POST THE SCHEMATIC AND A BUILD PICTURE. Second request.
 

Thread Starter

geoffers

Joined Oct 25, 2010
475
Thanks again,
Sorry I've been a while responding, lambing sheep at the moment! RB thanks for that, 240v ac will remain off my stripboard :eek::eek:! Ooops.

Ernie, sorry I havn't posted a scematic yet, should be a photo attached, I tried to keep the ssr and 240v the other end of the strip board from the I2C clock. I think I'm going to cut the board away and solder the wires for the pump directly to the ssr and see how that works? I'm almost ashamed to post the photo, it is a prototype though:p! I'm going to start doing out a schematic, the whole thing has evolved with me adding bits n bobs as I go and I'm very soon going to be in a muddle if I don't!

Cheers Geoff
 

Attachments

MrChips

Joined Oct 2, 2009
30,708
My guess is the 32768Hz crystal oscillator.

You need to show the circuit for this and a well focused photo might help.
This circuit usually has the crystal, two capacitors and one or two resistors. PCB layout is critical. Veroboard for this is not a good idea.

I don't see your power supply decoupling cap for this. You need 0.1μF and 10μF in parallel.
 

ErnieM

Joined Apr 24, 2011
8,377
Actually your build isn't half bad (from the top view anyway <g>) but your lack of a schematic is shameful, so shame on you! :mad:

Schematics need to be up to date. Sure, pencil in on-the-fly changes so they are KNOWN, and then step back and put them into the drawing. There are so many freebie schematic programs there's no reason not to have one (or 5).

What are the parts I'm looking at? What is the PCB in the center? What are the parts in the lower right? What's that black thing on the left?

Microsoft Paint is always there to add some descriptions.

The more information you can give us the better we can help ya.

And don't apologies for being late, this ain't my project, it doesn't bother me any even if you never finish it...

But finish it anyway, please? :D
 

MrChips

Joined Oct 2, 2009
30,708
I gather the PCB in the center is the main mcu board that drives the LCD.
The black thing on the left is a solid-state relay to control 240VAC.

The parts in the lower right is his I2C RTC with a 32768Hz xtal and two capacitors.
That is where the problem lies. He has no decoupling capacitors showing.
 

Thread Starter

geoffers

Joined Oct 25, 2010
475
Thanks for your input guys,

I've further farted about with it and its all up and running now :) ! Removing the 240v parts from the stripboard has made my problems go away! I'm gathering up all my scribbles to turn them into a schematic now!

I'm very grateful to you all for taking the time to look at this and feel a bit guilty for posting without giving all the imformation you need to give me a good diagnosis! There are some decoupling caps on the rtcc but their soldered on under the board to get them nice and close to chip!

When I've got my act together and done a schematic it will eventualy end up on one board, but at least its working now:):):).

Thanks again Geoff
 

takao21203

Joined Apr 28, 2012
3,702
240V on a stripboard will never cause arcing.

There are TRIACS which have TO92 case (like a 2n3904), and they are rated for 400 volts or even more.

The creep distance you should have is 3mm or 4mm if you can.

And I'd rather recomment proto boards with solder points, not strip board.
You can handle a points board powered on, but for a strip board, even with years of experience, I'd not want to touch it when powered on.

The distance between the points is higher than between the lines, even if you'd still require 2 kV or so to have any chance for arcing.

And yes I2C is sensible a lot for all sort of disturbances.
 
Top