Using an ATTiny85 and an Arduino loader I created a simple device for turning on an exhaust fan based on a light sensor. The ATTiny85 turns on the fan after activating a warning light and sounding an alarm. Of course, I use a relay to amplify the signal from the ATTiny85 to switch the AC power to the fan. I’m not using I2C, it is simply an on/off pin command. All well and good.

However, after several weeks of operation the ATTiny85 seems to increase its clock speed. The warning light flashes much faster than it was programmed to and the alarm sounds for a shorter time and at a higher pitch.

digitalWrite(FUNCTION, HIGH);
buzzer(1000, 1, 1);
buzzer(1000, 1, 1);
buzzer(2000, 1, 1);
digitalWrite(FUNCTION, LOW);

Simply rebooting the system solves the problem for a few weeks.

Initially I figured the problem was dirty power. I replaced the 5V transformer running the chip with a 12V transformer and ran the power through a XL4015 Step-Down Buck Converter. When I test the power going to the ATTiny85 from the buck, I get a steady 5.16V as designed. Still, after a few weeks, the ATTiny85 seems to go into hyper-speed.

I have searched along the lines of “ATTiny85 clock speed” and have found nothing that approximates my problem. The code is a fairly simple loop and the integers passed to the "buzzer" routine should produce a constant time period, I would think.

Assuming the code is not at fault, are there ways that the ATTiny85’s clock speed can be altered by external events? Power spikes? phases of the moon? ;-)...

I wanted to ask this question, before I go wading-in looking for a silly software bug! Which is likely the problem!

Awjlogan and SamGibson - Thanks for your prompt reply and suggestions. Your initial comments about Protection Circuitry and Vdd ramp-up “inspired” me to look at:

EEVblog #859 - Bypass Capacitor Tutorial https://www.youtube.com/watch?v=BcJ6UdDx1vg

When I built this little project I had just gotten a new cable crimper. A PA-09 and it works great for making custom Dupont connectors. After going thru Dave’s blog I suspect I over did it. The leads are at least 150 mm long. More than enough to cause problems. I’m betting that these long connectors and NO Bypass Caps are the reason I’m having problems! Naively, I thought that the XL4015 Step-Down Buck Converter would have taken care of this. But based on what I’ve learned the length of the connectors are probably the source of the problem.

I’ll update this post when I’ve confirmed or denied this assessment.

Thanks for your input!

  • 3
    \$\begingroup\$ Can you post a full schematic, including decoupling and any protection circuitry? \$\endgroup\$ – awjlogan Nov 7 '19 at 16:36
  • 1
    \$\begingroup\$ ArcZap - Welcome :-) I can't find the question (now deleted?) but within the last few months, I remember a question about (I think) a member of the ATtiny family, which started running at a different clock speed after a somehow unusual power-up (can't remember the exact details, sorry, that's why I searched for that question!). Something about long Vdd ramp-up time being a problem, perhaps?? (a) Is there a consistent time-to-failure after power-on? If so, review the code & add it into the question. (b) Could a power dropout be the trigger? If so, add schematic, photos & more history. \$\endgroup\$ – SamGibson Nov 7 '19 at 16:56
  • 3
    \$\begingroup\$ ArcZap - Seeing your full code and schematics would help anyway, so please add those to the question. My previous comment gives some hints about areas I would start looking at first, depending on the answers to those previous questions (a) & (b) I asked. Thinking about this, I want to know what clock speed it runs at normally and, if you can measure the "hyper-speed" situation, can you estimate the new clock speed? For example, use an oscilloscope to look at relevant GPIO pins and measure the faster flashing time / higher buzzer pitch, to estimate the change to the clock speed. Thanks. \$\endgroup\$ – SamGibson Nov 7 '19 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.