Digispark Attiny85 works with code, but my PCB resets with Digital Read Input High

I have what is a pretty simple circuit (snippet attached). The input voltage is between +12VDC to +14.7VDC. When this voltage is applied, the device should power up and do a certain light sequence. Then, there is also another input of the same voltage. This is used as a signal turn-on (CTRL) to apply a secondary action after start-up. In this case it is to turn the LEDs brighter red as long as the signal is applied. On my PCB, both Power and CTRL inputs go through separate MIC5219 5VDC linear voltage regulators to drop the input voltage down to the proper range for the Attiny85.

I have tested this using a Digispark Attiny85, and the code works fine. To simulate the CTRL signal, I wire a button from the Digispark 5V out to PB1, which I configured in the code as digital read. When I hold the button to apply the 5V from the Digispark's 78L05 to PB1, it works fine and is stable.

On my PCB, if I momentarily apply the CRTL signal to PB1, it works as expected. If I hold it for a few seconds, the lights start to flutter and then the Attiny restarts. I can't figure it out. Here are some things I tried:

  • Put 3.3VDC directly on the Attiny VDD input and then on the CTRL signal and there was no problem, but my LEDs are not as bright.

  • Used the +12VDC Power per design and then applied a 3.3 VDC CTRL signal for a few seconds. The Attiny85 reset, although it took about 5 seconds instead of the 3 seconds using the onboard 5VDC CTRL regulator.

  • I tried resistors from PB1 to ground, in parallel with the CTRL signal, to be sure to pull down the input to ground when no CTRL signal is applied (so it is not floating). I tried 10k and 100k ohm resistors. It did not help. Also, the Digispark does not have these.

  • The capacitors I am using are those recommended in the voltage regulator specs. I tried to put the same capacitors on the +5VDC power to the Attiny85 as the Digispark has (0.1 uF and 4.7uF in parallel), instead of C2. The function was not as crisp before this. So it seemed more stable, but it still restarted with a sustained high (5VDC) input on PB1.

I'm out of ideas now :woozy_face:

Any help would be greatly appreciated!!!

Here is my code:

#include "FastLED.h"
#include "FastLED_RGBW.h"

#define NUM_LEDS 28
#define DATA_PIN 0
#define CTRL 1

CRGBW leds[NUM_LEDS];
CRGB *ledsRGB = (CRGB *) &leds[0];

const uint8_t brightness = 85;
int space = 25;
int brake = LOW;
bool start = true;

void setup() { 
  FastLED.addLeds<WS2812B, DATA_PIN, RGB>(ledsRGB, getRGBWsize(NUM_LEDS));
  FastLED.setBrightness(brightness);
  FastLED.show();
  pinMode(CTRL, INPUT);
  //Serial.begin(9600);
}

void loop(){
  if (start == true) {
    rainbowLoop();
    colorFill(CRGB::Red);
    start = false;
  }
  brake = digitalRead(CTRL);
  if (brake == HIGH) {
    FastLED.setBrightness(brightness*3);
    FastLED.show();
  }
  else FastLED.setBrightness(brightness);
    FastLED.show();
}

void colorFill(CRGB c){
  for(int i = 0; i < NUM_LEDS; i++){
    leds[i] = c;
    FastLED.show();
    delay(space);
  }
  delay(500);
}

void fillWhite(){
  for(int i = 0; i < NUM_LEDS; i++){
    leds[i] = CRGBW(0, 0, 0, 255);
    FastLED.show();
    delay(space);
  }
  delay(500);
}

void rainbow(){
  static uint8_t hue;

  for(int i = 0; i < NUM_LEDS; i++){
    leds[i] = CHSV((i * 256 / NUM_LEDS) + hue, 255, 255);
  }
  FastLED.show();
  hue++;
}

void rainbowLoop(){
  long millisIn = millis();
  long loopTime = 3000; // 5 seconds

  while(millis() < millisIn + loopTime){
    rainbow();
    delay(5);
  }
}

Great schematic! Did you solder the back pad to ground as stated in the data sheet Figure 1-1. Pinout ATtiny25/45/85 - Rev. 2586Q–AVR–08/2013.

Not sure what you are saying: "Used the +12VDC Power per design and then applied a 3.3 VDC CTRL signal for a few seconds. The Attiny85 reset, although it took about 5 seconds instead of the 3 seconds using the onboard 5VDC CTRL regulator."

What is connected to the board?

1 Like

I did solder the back pad to ground.

I am just using a variable DC power supply set at +12 VDC. This is connected to the +12V PWR flag.
To see if the PB1 input was "unhappy" with the 5V output of the regulator (CTRLo/MISO in the schematic), I separately wired a 3.3V regulator to a button connecting it to PB1 directly. It still restarted.

There are 3 connections: Power, Ground, and a Control signal (same voltage as Power when it is activated).

bump Any help would be greatly appreciated!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.