Go Down

Topic: Help with Power Supply problem (Read 863 times) previous topic - next topic

Mitchell Christensen


I've built a stand alone board around a pre-programmed Atmega328 (Uno) chip.  My oscilloscope shows that my power supply runs clean (i.e. no noise/AC/etc.) until I plug in the Atmega328.  As soon as I plug in the Atmega328 (powered off first, of course) I see somewhere between 10 and 15mv AC on my power bus.  The Atmega does work (i.e. runs the 'Blink' demo fine), but when I plug in a DS1307 Real Time Clock chip the DS1307 just sits there.  Power is good (albiet noisy) at the clock chip power pins, but the sketch I'm using to read the RTC just returns all zeros.

I've tried replacing the DS1307 chip (a couple of times) to no avail.  I'm left suspecting that the AC component on my power bus might be the culprit, but I'm at a loss to explain where that AC component might be coming from.  I've reduced my Atmega328 connections to nothing more than +5v (VCC + AVCC), GND, XTAL1 & XTAL2 (at 16Mhz, with 18pF filter caps), PB5/D13 to run the Blink demo and PC4 (SDA) and PC5 (SCL) (i.e. the two I2C pins) to talk to the DS1307.

I have confirmed from the DS1307 data sheet that the I2C address is indeed 0x68.  One question I do have is whether I need external pull up resistors on SDA/SCL.  The data sheet says yes, but I guess I assumed that the Atmega328 would provide those.  Is this an invalid assumption?

Any help would be greatly appreciated.



15mV of ripple shouldn't be a problem for a digital circuit.    There''s plenty of safety-margin between what's considered a logic '1' and a logic '0', and things have to get fairly noisy before there's a problem. 

I've never used a real time clock chip, so I can't help with that...

...but I'm at a loss to explain where that AC component might be coming from.
If it's 50/60Hz, from the AC power into your power supply? ;)  If it's higher frequency noise, it can come from the processor clock, or from other processor/digital switching.

Power supplies have capacitors to smooth the rectified DC.   With little or no load, the capacitors stay fully-charged and there is no ripple.   When there is a load, the power is supplied by the capacitors during the low-voltage parts of the AC cycle.  With more load (more current), the capacitors discharge faster and you get more ripple.

A regulated power supply uses electronics to hold the voltage more-constant, and with a good regulated supply, you may not be able to measure the AC ripple or you may not be able to distinguish the line-ripple from other noise on the DC power line.


Hi Mitch,
The purity of your power supply would be one of the later things I would look at.

Hardware (wiring) issues or software issues could cause your issue.  Please post your code and we can see what might be going on.
The pullup resistors are needed.  Check the wiring of analog pins 4 and 5  -->  SDA and SCL (respectively)

You mention that the RTC reads all 0's - when the RTC first powers up, it is in a hold state, and it will read all 0's.  You need some code to a) set the time, and b) to start the clock.  Once set and running, the starting code does not need to be rerun.  Check out the playground for the 1307 library and page - and also the Adafruit.com tutorials on the RTC. 



What frequency is the AC component: 100/120Hz, or high frequency? Do you have a ceramic decoupling capacitor connected between the atmega328 Vcc and Gnd pins?

The Wire code does appear to activate the internal pullups on the two pins, however they are quite high value and you might need to use external, lower value pullup resistors.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.


Try looking for the start code, I had made the same mistake on another rtc chip, I thought it wasn't working, but after thorough inspection of the datasheet I realized in the second registor was an oscillator start stop bit which solvwd my problem
maybe its that simple

Go Up