ATtiny85 and other microcontrollers 240816

Hello

For about a year, beginning in 2021,
a 555 timer was used to receive
a signal from a PIR and saturate
a transistor that turned on four
twelve-volt LEDs to light a closet,
staircase or other small space.

After a few months it was noticed
that about a quarter of the installations
were failing. Either the LED would not come
or, in the greatest number of cases,
the LEDs would come on but not go off.

Research pointed to the failing
component being the capacitor in
the capacitor-resistor pair that
governed the high output of the 555
in monostable, one-shot mode.
The failure was greater in units that had an
infrequent usage. Counter intuitively,
units that were used several times a day
failed less often than units that
were used once or twice a month.

To overcome the 555 capacitor failure
it was suggested that a microprocessor
be substituted for the 555. Several
Arduino-IDE-compatible microprocessors
were evaluated: DFRobot DFR0282 $8.90,
Seeed Studio XIAO SAMD21 $5.40, and the
ATtiny85 $1.66.

Besides being more precise in timing,
microprocessors allowed for the time
allowed for the time that the LEDs
stayed on to be changed by reprogramming
instead desoldering and changing
components.

Despite the need for an ATtiny programmer
to get the ATtiny 85 connected via
USB to the Arduino IDE, the size
and price of the Tiny were the
deciding factors.

Now two of the ATtiny85 units are failing.
Because the ATtiny85 is the heart of
the closet light the MC was tested first.

When the ATtiny85 became an integral part
of the closet units an ATtiny Tester
was developed schematic and layout
on prototype PCB attached herewith.

When the ATtiny was pulled and
reprogrammed with the ATtiny Tester Sketch,
attached below.


When the Tiny called Mark3 was tested
it returned results that were unexpected.
Tests results copyed herewith below.
Three MCs were tested: Mark3, MarkB
and MarkC. Mark3 resulted in high
output much shorter than expected.

Tests of the MarkB MC were more in line
with expected results. To confirm that
the 8 MHZ was the correct Internal Clock
setting tests were performed on the
MCs using 1 MHZ and 16 MHZ clock settings.

To confirm that the MarkB results
were correct a new, out-of-the-box
MC, MarkC was tested. The results
of the MarkB and MarkC tests point
to the Mark3 unit being a failed
component.

The question is: How reliable are
the ATtiny85 MCs? Would going to
one of the other Arduino compatible
MCs improve the reliability?

Thanks.

Allen Pitts

/*
240816 
Processor ATtiny85
Programmer USBTinyISP
 Compiled this sketch at Internal Clock 8 MhZ: LEDs blink at 5 second on and .5 second off
 Compiled this sketch at Internal Clock 16 MhZ: LEDs blink at 8 second on and 2 second off
 Compiled this sketch at Internal Clock 1 MhZ: LEDs blink at 1 second on and imperceptible off

  ATtiny Tester 230811
  Turns on an five LEDs on for one second, then off for one second, repeatedly
  as  a test of the microcontroller. If the internal clock is set to 8 MHZ
  the D1 LED blinks at 9 seconds on and 4 seconds off.
 */

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 4 as an output.
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(0, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(500);            // wait for a second
  digitalWrite(0, LOW);   // turn the LED off by making the voltage LOW
  delay(100);            // wait for a second

  digitalWrite(1, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(500);            // wait for a second
  digitalWrite(1, LOW);   // turn the LED off by making the voltage LOW
  delay(100);            // wait for a second

  digitalWrite(2, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(500);            // wait for a second
  digitalWrite(2, LOW);   // turn the LED off by making the voltage LOW
  delay(100);            // wait for a second

  digitalWrite(3, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(500);            // wait for a second
  digitalWrite(3, LOW);   // turn the LED off by making the voltage LOW
  delay(100);            // wait for a second

  digitalWrite(4, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(500);            // wait for a second
  digitalWrite(4, LOW);   // turn the LED off by making the voltage LOW
  delay(100);            // wait for a second
}

Mark3
16 Mhz 1.1 sec on; imperceptible off
8 Mhz .6 sec ; imperceptible off
1 Mhz .1 sec ; imperceptible off
16 Mhz 1 sec ; imperceptible off
8 Mhz .7 sec ; imperceptible off
1 Mhz .06 sec; imperceptible off
16 Mhz 1.1 sec; imperceptible off
8 Mhz .8 sec; imperceptible off
1 Mhz .12 sec 8.; imperceptible off

MarkB
16 Mhz 8.1 sec ON, 1.6 sec OFF
8 Mhz 4.1 sec ON, .8 sec OFF
1 Mhz .7 sec ON, imperceptible OFF
16 Mhz 8.1 sec ON, 1.2 sec OFF
8 Mhz 4.1 sec ON, .7 sec OFF
1 Mhz .7 sec ON, imperceptible OFF
16 Mhz 8.0 sec ON, 1.4 sec OFF
8 Mhz 4.0 sec ON, .7 sec OFF
1 Mhz .7 sec ON, imperceptible OFF

MarkC
16 Mhz 7.9 sec ON, 1.5 sec OFF
8 Mhz 4.0 sec ON, .7 sec OFF
1 Mhz 8.1 sec ON, imperceptible OFF
16 Mhz 8.0 sec ON, 1.4 sec OFF
8 Mhz 3.9 sec ON, .8 sec OFF
1 Mhz 8.1 sec ON, imperceptible OFF
16 Mhz 7.9 sec ON, 1.2 sec OFF
8 Mhz 3.8 sec ON, .7 sec OFF
1 Mhz 8.1 sec ON, imperceptible OFF

Generally somewhat less reliable than capacitors, I guess. :slight_smile:

I'm surprised that you found the cap to be the failure point in the original circuit, and that you didn't fix it by finding a better cap. (although I guess for implementing long delays with a 555, you might end up needing relatively expensive caps.)

Your test circuit needs bypass caps, BTW...

Very. Quite like capacitors. There's likely a systematic problem in the design of your circuit or some environmental condition responsible for the premature failures in your electronics.

Very, if operated well below maximum ratings specified in the data sheet. That includes current to/from output pins, which should not exceed about 20 mA/pin and about 100 mA total package draw.

What value current limiting resistors on the LEDs?

If the environment is humid, check for corrosion caused by condensation on the PCB traces.

I think there is more to the issue with your 555 ckt. You could program a µcontroller but I would first find out what is happening with the cap. I've run 555 timers for years with no failures.
Can you post the value of the resistor and the value and type of capacitor?

If you wanted to go to a processor I would look at an Arduino Pro Mini for a low cost board that will only need the resistors and diodes added.
BTW if you did make the ATtiny85 board as you've drawn it will not work without a 0.1µF capacitor between the 5v pin and the ground pin. Must have very short leads.

With a 555 I'd have used a trimmer potentiometer.
Anyway, also for a microcontroller in such an application I also use a trimmer potentiometer to control the timing because connecting the project to a programmer to make such adjustments is a miserable process. I published one example here: ATtiny1614 based Under Bed Light

You could also use push buttons to increase 1 second per push and another button for decrease.

Hello westfw, rsmls, jremington, JohnRob, 6v6gt and the Arduino forum,

240819.1 westfw

I'm surprised that you found the cap to be the failure point in the original circuit,
and that you didn't fix it by finding a better cap.

The cap used in the 555 based closet fixture was a
Aluminum Electrolytic Capacitors - Radial Leaded 100uF 16V 5x11mm 85 C 2500h
by Vishay from Mouser Electronics part no. MAL203855101E3
https://www.mouser.com/ProductDetail/Vishay-BC-Components/MAL203855101E3?qs=G99oyVYclWVud%252B%2Fs3vRKoA%3D%3D

The circuit operates at 12 volts DC. Perhaps a better result would be acheived
by using a 25 or 30 v capacitor.

The cost of the capacitor, less than say, $5-$10, is not consequential after the time
and effort to design the schematic, breadboard the schematic, design the PCB,
and build & test the PCB.

So what is the best 100 uF capacitor available?

Having abandoned the 555 timer for the microntroller in April of 2023
not sure the 555 timer approach will be revisited but in the interest of thoroughness
the 555 time schematic and PCB design are attached herewith marked
P5L 220923 and P5L_220122. (P5L : PIR to 555 to LEDs).


240819.2 rsmls

There's likely a systematic problem in the design of your circuit or some environmental condition
responsible for the premature failures in your electronics.

Assuming that what is intended that there is systematic problem in the design
of the circuit. The closet fixture system using the ATtiny85 is attached.
Closet_ATtiny85_schematic_230815.jpg
Closet_ATtiny_PCB_230816


240819.3 jremington

The LEDs that light the closet are 12 volt automative back up lights.
OXILAM Upgraded 1156 LED Bulbs Reverse Light, 6000K White 400% Brightness 3000 Lumens, BA15S 7506 1003 1141 P21W LED Bulb

which have internal circuitry and thus require no limiting resistor.

The system environment is a residential closet.

240819.4 JohnRob

Can you post the value of the resistor and the value and type of capacitor?

Two systems have been described here but I think the question is about
the resistor anbd capacitor used in the 555 timer system. The values
are spec'd in the reply marked '240819.1 westfw', above.
PS. The resistor values are not on the schematic. The resistor values
are 220 ohms

Revised ATtiny_tester_on_Datak_21_114_240819.gif to include 0.1
ceramic capacitor. Leads as short as possible.

240819.5 6v6gt
The trimmer pot is a good idea. Will experiment.
The attiny1614-based-under-bed-light is a nice design.
Might try AC adapter instead of batteries.

Thanks.

Allen Pitts

I dunno. The capacitor you were using sounds like it should have been fine.

The (555) schematic seems to be a bit weird to me. The timing components are R2/C1, right? 560k and 0.01uF? Seems like a really short time constant.
C4 looks like a bypass cap, but is only 0.01uF as well?
C2 is the "control voltage" bypass, and is normally the 0.01uF, but your schematic has 100uF.
And I dont know WHAT C3 (also 100uF) is doing...

1 Like

I don't think you capacitors are failing, they're leakage current is probably changing. You C1 charging current is ~24µamps. The leakage of the capacitor could be as high as 16µamps.

Can we assume the lights go on but never go off?

You would be much better with a µprocessor.

You seem to be very thorough with your documentation. Of course, when you report what appears to be a series of component failures, your designs come under close scrutiny and things like lack of attention to decoupling get noticed. However, the results of your ATtiny85 tests look odd in that normally a reduction in the clock rate should either have no impact because the development system compensates so that timing functions like delay() are unaffected, or if you just change fuses or crystals to adjust the clock rate, then a reduced clock rate would normally result in longer timings.

Most of the design effort went into preserving battery life, such things as running the three leds with PWM 120 degrees out of phase to minimise the load when full brightness is not required or use of sleep modes. If you are running the device with a mains adapter then the design can be simplified quite significantly. However, maybe you can use the potentiometer trick for adjusting the on time of the light in your attiny85 design if you have a spare analog pin.

Not necessarily. It can also be related to how the thing is physically built, where it's installed etc. Think about things like high humidity, heat, ESD etc.
Having said that, I'd include a gate current limiting resistor between your Tiny pin 2 and Q2's gate. 1k or so would do fine here.
Nitpicking a bit: C1 isn't really necessary and it's odd to have it before the fuse; in case your cap fails short, it can still burn down the house. I'd just remove C1 altogether.

The main failure mode of the Tiny I'd be concerned about in your circuit would actually be failure of Q2 for some reason, causing 12V to appear on its gate, frying the Tiny. This would typically kill the Tiny altogether, not just a single pin.

IDK how big those LEDs are but the power traces on your PCB look kinda thin.

What's it made of, gold with platinum lining around the edges?

Virtually any capacitor would work fine in your application and should survive for at least 2 decades before any trouble can be expected, and that would include the inherently iffy tantalum types (you didn't use).