A popular modification for the Adafruit kit is to upgrade the ATmega168v to the ATmega328p in order to support one of the larger alternative firmwares--particularly William's firmware (thread, GitHub) and my xmas-icetube firmware (thread, GitHub).
I've claimed many times that the ATmega328p works as a drop-in replacement for the ATmega168v in the Ice Tube Clock. But oscillator failures do occasionally happen after the upgrade, so I'm wondering if I could be wrong. Oscillator failures seem to happen with a frequency of around one in ten or one in twenty--just my general impression. The failures can be resolved by replacing components in the oscillator circuit, so I do not think this is a firmware issue. I'm wondering if the problem could involve the crystal.
According to the datasheet, the ATmega328p requires a clock crystal with an ESR (equivalent series resistance) of 30k or less for a standard 12.5 pF crystal. I could not find any similar stipulation in the ATmega168v datasheet, suggesting that the ATmega168v might be a bit more promiscuous. In the Ice Tube Clock build instructions, Q1 is listed as a generic 32.768 kHz 12.5 pF watch crystal. But the instructions link to the Adafruit Partfinder, and the Partfinder links to the Abracon AB38T-32.768KHZ datasheet. The AB38T-32.768KHZ has an equivalent series resistance of 30k and should work with both the ATmega328p and ATmega168v.
So what is Q1? Does Adafruit always use an AB38T-32.768KHZ? If not, does the substitute ever have an ESR (equivalent series resistance) of greater than 30k?
What is the ESR of Q1 in the Ice Tube Clock kit?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- jarchie
- Posts: 615
- Joined: Sun Jun 24, 2012 2:16 pm
- phild13
- Posts: 247
- Joined: Mon Sep 10, 2012 1:05 pm
Re: What is the ESR of Q1 in the Ice Tube Clock kit?
I don't know the answer to the question but of course I have a comment
I have put together several icetube clocks of various main board designs and I recently put together a clock based on the Adafruit icetube design with the Q3 transistor mod as suggested by Russell. Basically I moved a couple things around to make room for a 1K (might try a 470 ohm also) resistor so I don't have to solder one to the transistor like Russells mod suggests. This also enables the board to accommodate a FET as Q3 without the resistor by placing a jumper in it's place.
Anyway, the clock counted seconds really slow; like 1 second for every 10 actual seconds. First I verified the correct components were used for the capacitors and the crystal and the capacitors were installed correctly. Second I verified the ATmega328p was correctly programmed and I did not somehow destroy it by placing it in a known working clock. Third I replaced the crystal with a new one. That worked. The removed crystal caused a different clock to count time slow and so it is definitely bad.
Upon close inspection of the old crystal I think I may have damaged it by pulling on the crystals leds too hard while originally installing it in an attempt to get it really close to the board. I think by excessively spreading and pulling on the leds the connection to the crystal was damaged or the crystal was broken. The holes for the crystal in the Adafruit icetube clock main board design are rather far apart and it is very easy to pull or push too hard while inserting the crystal.
I would suggest that one gently push the crystal leds into their holes and stop when the crystal base is still about 3mm above the board. This will not put stress on the crystal and possibly cause damage to it.
This may be where some problems that were traced to the crystal originate from.
I have put together several icetube clocks of various main board designs and I recently put together a clock based on the Adafruit icetube design with the Q3 transistor mod as suggested by Russell. Basically I moved a couple things around to make room for a 1K (might try a 470 ohm also) resistor so I don't have to solder one to the transistor like Russells mod suggests. This also enables the board to accommodate a FET as Q3 without the resistor by placing a jumper in it's place.
Anyway, the clock counted seconds really slow; like 1 second for every 10 actual seconds. First I verified the correct components were used for the capacitors and the crystal and the capacitors were installed correctly. Second I verified the ATmega328p was correctly programmed and I did not somehow destroy it by placing it in a known working clock. Third I replaced the crystal with a new one. That worked. The removed crystal caused a different clock to count time slow and so it is definitely bad.
Upon close inspection of the old crystal I think I may have damaged it by pulling on the crystals leds too hard while originally installing it in an attempt to get it really close to the board. I think by excessively spreading and pulling on the leds the connection to the crystal was damaged or the crystal was broken. The holes for the crystal in the Adafruit icetube clock main board design are rather far apart and it is very easy to pull or push too hard while inserting the crystal.
I would suggest that one gently push the crystal leds into their holes and stop when the crystal base is still about 3mm above the board. This will not put stress on the crystal and possibly cause damage to it.
This may be where some problems that were traced to the crystal originate from.
- jarchie
- Posts: 615
- Joined: Sun Jun 24, 2012 2:16 pm
Re: What is the ESR of Q1 in the Ice Tube Clock kit?
Thanks, Phil! I hadn't considered crystal damage as a possible cause and will need to update that part of the troubleshooting section in my firmware/README. Mounting the crystal 3 mm away from the board to avoid damage is a good idea. If you have time to look over that section, I'd certainly appreciate any suggestions or comments you might have.
xmas-icetube firmware/README wrote: #####################
## TROUBLESHOOTING ##
#####################
[...]
:: Crystal Oscillator Problems ("wdt rset") ::
The ATmega328p is more prone to oscillator issues than the ATmega168v,
and users occasionally encounter oscillator problems after upgrading.
Oscillator problems usually result in inconsistent timekeeping; the
clock may keep time one day, but not another. When oscillator
problems are severe, the microcontroller's watchdog circuit will
detect that time is not advancing and reset the clock in an attempt to
fix the problem. After such a reset, the clock will beep and display
"wdt rset" to indicate possible time loss due to a watchdog reset.
Fixing oscillator issues requires some trial and error, but following
the procedure below will likely fix the problem.
First, excess flux or burnt flux can cause oscillator problems.
Sometimes cleaning the board thoroughly with flux cleaner--or simply
alcohol and a toothbrush--will solve the problem.
Second, the 20 pF oscillator capacitors included in the Adafruit kit
are a bit large. Replacing C8 and C9 with with 10 pF caps will
sometimes fix the oscillator.
Finally, replacing the crystal will sometimes resolve the issue. The
replacement should be another 32.768 kHz crystal with a 12.5 pF load
capacitance and equivalent series resistance of 30 kOhm or less. The
AB38T-32.768KHZ is a good choice and is available from Digi-Key or
Mouser. When soldering the crystal, there should be at least 1 mm
between the case and circuit board to ensure that solder will not flow
through the board and contact the metallic crystal housing.
- phild13
- Posts: 247
- Joined: Mon Sep 10, 2012 1:05 pm
Re: What is the ESR of Q1 in the Ice Tube Clock kit?
I did a search on the forum and I don't think there are any more or less issues with the crystals and using an ATmega328p over the Adafruit supplied ATmega168v. As mine was, I think most were caused by operator error. If I can accidentally kill one, I'm sure others can too.
On that note, I would change this:
I would also change this part:
On that note, I would change this:
to something like this:When soldering the crystal, there should be at least 1 mm
between the case and circuit board to ensure that solder will not flow
through the board and contact the metallic crystal housing.
or something to that effect.When installing and soldering the crystal, gently push the crystal through the circuit board until there is 2 - 3 mm of space between the bottom of the crystal and the circuit board. This is to ensure that the crystal is not stressed and broken and solder will not flow through the board contacting the metallic crystal housing causing a short.
I would also change this part:
to something like this:Second, the 20 pF oscillator capacitors included in the Adafruit kit
are a bit large. Replacing C8 and C9 with with 10 pF caps will
sometimes fix the oscillator.
BTW, Interesting question you posed.Second, the 20 pF oscillator capacitors included in the Adafruit kit
are a bit large. Replacing C8 and C9 with with 10 pF caps will
sometimes fix the oscillator and increase time keeping accuracy.
- jarchie
- Posts: 615
- Joined: Sun Jun 24, 2012 2:16 pm
Re: What is the ESR of Q1 in the Ice Tube Clock kit?
Thank you for the suggestions! I'll revise the firmware/README file sometime tomorrow.
Of course I have no idea how often oscillators work with the ATmega328p, but fail after switching to a ATmega168v. So my experience is not proof. But the fact that a noticeable proportion of clocks have oscillator trouble only after upgrading to the ATmega328p suggests that the ATmega328p is more sensitive to oscillator failures.
My suspicion is that the inverting amplifier driving the crystal is less powerful in the ATmega328p than it is in the ATmega168v.
A quick search on Digi-Key shows that not many through-hole clock crystals have an ESR of 30k or less, so most crystals would not be compatible with the ATmega328p.
I'm aware of four cases where the oscillator on an Adafruit Ice Tube Clock worked perfectly with the ATmega168v, but started having problems after upgrading to a ATmega328p. I mentioned two of those cases in passing on the forums, but the other two were only reported to me through email.PhilD13 wrote:I did a search on the forum and I don't think there are any more or less issues with the crystals and using an ATmega328p over the Adafruit supplied ATmega168v.
Of course I have no idea how often oscillators work with the ATmega328p, but fail after switching to a ATmega168v. So my experience is not proof. But the fact that a noticeable proportion of clocks have oscillator trouble only after upgrading to the ATmega328p suggests that the ATmega328p is more sensitive to oscillator failures.
My suspicion is that the inverting amplifier driving the crystal is less powerful in the ATmega328p than it is in the ATmega168v.
Thank you! I do hope Adafruit answers it... I'd be happy even if they are not certain. At least I would know that it's possible the kit has shipped with crystals that may not work with the ATmega328p.PhilD13 wrote:BTW, Interesting question you posed.
A quick search on Digi-Key shows that not many through-hole clock crystals have an ESR of 30k or less, so most crystals would not be compatible with the ATmega328p.
- jarchie
- Posts: 615
- Joined: Sun Jun 24, 2012 2:16 pm
Re: What is the ESR of Q1 in the Ice Tube Clock kit?
Done. Thanks again!jarchie wrote:I'll revise the firmware/README file sometime tomorrow.
Of course, I'm still hoping the people at Adafruit will answer the initial question of this thread. I'd be satisfied even if they post that they are not certain.
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: What is the ESR of Q1 in the Ice Tube Clock kit?
Abracon AB38T-32.768KHZ is used
- jarchie
- Posts: 615
- Joined: Sun Jun 24, 2012 2:16 pm
Re: What is the ESR of Q1 in the Ice Tube Clock kit?
Excellent. Thank you!adafruit wrote:Abracon AB38T-32.768KHZ is used
So the occasional problems seen after upgrading to the ATmega328p must be in the individual builds (e.g., excessive or burnt flux, crystal damage from stress on the leads, or an otherwise damaged or defective part).
Please be positive and constructive with your questions and comments.