AT Tiny 85 not responding

Thread Starter

abuhafss

Joined Aug 17, 2010
317
Hi

I recently soldered my components as per schematic below:

Tiny circuit A.pngThe four terminals at the left are to drive an AC servo (Pulse and Direction).
The three terminals at the right are to activate solenoid valves.
The 5V supply and 24V supply share common ground.
Initially, the ATTiny85 performed as programmed though the speed was slow and the direction of the motor was not changing.

I made some improvements and addition as below:
Tiny circuit B.pngBut now the ATTiny85 is not responding, as if it is not programmed! I replaced the chip but not worked.
I have thoroughly checked all the connections. Even I replaced the original code lines within the main LOOP() with just switching on the LED connected to pin #3 but it is not lighting up. I have spent hours to figure out the problem but failed. Could anyone help me with this, please?
Here is is the soldered PCB for reference.

20230520_225805.jpg
 

DickCappels

Joined Aug 21, 2008
10,246
You really need at least a .01 uF bypass capacitor between power supply pins 8 and 4.

Did the programmer report that the Tiny85 was successfully programmed?

What voltage do you see on RESET input pin 1?

That .01 uF capacitor in the SCLK pin 7 has a good chance of interfering with programming the chip. If you are programming the chip in-circuit remove the capacitor at least for now.
 
Last edited:

Thread Starter

abuhafss

Joined Aug 17, 2010
317
You really need at least a .01 uF bypass capacitor between power supply pins 8 and 4.

Did the programmer report that the Tiny85 was successfully programmed?

What voltage do you see on RESET input pin 1?

That .01 uF capacitor in the SCLK pin 7 has a good chance of interfering with programming the chip. If you are programming the chip in-circuit remove the capacitor at least for now.
Today, Sunday being off; I will add the bypass capacitor tomorrow and will inform the voltage on the RESET pin.

Yes, the Tiny85 was programmed successfully.

I had already tried disconnecting the capacitor at pin 7, but no change.
 

trebla

Joined Jun 29, 2019
550
If the reset pin is disabled you can't program this MCU with serial programmer, you will need a HV programmer to reprogram this chip.
 

Thread Starter

abuhafss

Joined Aug 17, 2010
317
Can you post the ATtiny85 code?
Here you go

Code:
//                         -------
//                     5  |       |  VCC
//                     3  | Tiny  |  2
//                     4  |  85   |  1
//                   GND  |       |  0
//                         -------
// 

const int LED = 4;
const int pedal = 2;
const int dirPin = 5;
const int pulsePin = 3;
const int verticalPin = 0;
const int horizontalPin = 1;
const int forward = LOW;

// Motor should be set at 1000 steps per rev
// GEAR RATIO 10 (INOVANCE)
// Numerator 100
// Denominator 10

int val;
int cylinderTime = 190; // delay for Pn. Cyl. to come to rest
int revSteps = 500; // 1/4 rev
int fwdSteps = 4000;// 4 rev
unsigned long lastRunTime = 0;

// #####################   Variables for Debouncing  #################
int buttonState;             // the current reading from the input pin
int lastButtonState = LOW;   // the previous reading from the input pin
unsigned long lastDebounceTime = 0;  // the last time the output pin was toggpulsePin
unsigned long debounceDelay = 300;    // the debounce time; increase if the output flickers
int reading = HIGH; // Temporary variable for button read value

void setup()
{
  pinMode(LED, OUTPUT); 
  pinMode(pedal, INPUT);
  pinMode(verticalPin, OUTPUT);
  pinMode(horizontalPin, OUTPUT);
  pinMode(pulsePin, OUTPUT);
  pinMode(dirPin, OUTPUT);
}

void loop()
{
  reading = digitalRead(pedal);
  debounce();
  if (reading == LOW)
  {
    if (millis() - lastRunTime > 500)
    {
      lastRunTime = millis();
      runProcedure();
      digitalWrite(LED, LOW);
    }
  }
}

void runProcedure()
{
  //###### Vertical Cylinder DOWN #######
  digitalWrite(verticalPin, HIGH); // Vertical Cylinder DN
  delay(cylinderTime);
 
  //###### 1/4 turn Reverse ########
  digitalWrite(dirPin, !forward);
  digitalWrite(LED, HIGH);
  for(int x = 0; x < revSteps; x++)
  {
    digitalWrite(pulsePin,LOW);
    delayMicroseconds(100);
    digitalWrite(pulsePin,HIGH);
    delayMicroseconds(100);
  }
  digitalWrite(LED, LOW);

  //###### Horizontal Cylinder ON/OFF #######
  digitalWrite(horizontalPin, HIGH); // Horizontal Cyl.
  delay(cylinderTime);
  digitalWrite(horizontalPin, LOW);

  //###### 4 turns Forward ########
  digitalWrite(dirPin, forward);
  digitalWrite(LED, HIGH);
  for(int x = 0; x < fwdSteps; x++)
  {
    digitalWrite(pulsePin,LOW);
    delayMicroseconds(25);
    digitalWrite(pulsePin,HIGH);
    delayMicroseconds(25);
  }
  digitalWrite(LED, LOW);

  //###### Vertical Cylinder UP #######
  digitalWrite(verticalPin, LOW);
}


// ##################### Debounce ##############
void debounce()
{
  // check to see if you just pressed the button
  // (i.e. the input went from LOW to HIGH), and you've waited long enough
  // since the last press to ignore any noise:

  if (reading != lastButtonState) // if Switch status changed pressed or noise
  {
    lastDebounceTime = millis(); // reset the debouncing timer
  }

  // if Longer than the debounce delay, switch really pressed
  if ((millis() - lastDebounceTime) > debounceDelay)
  {
    if (reading != buttonState)
    {
      buttonState = reading;
    }
  }

  lastButtonState = reading;
}
 

Ya’akov

Joined Jan 27, 2019
9,264
Not to belabor the point but to clarify: did you actually measure Vcc across pins 4 and 8 since having this problem? Can you confirm that your buck converter can provide current (not just the voltage into a DMM)?
 

Thread Starter

abuhafss

Joined Aug 17, 2010
317
Ok. Post that code. That should be your test code for now. No need for any other code.
This was the change I made, but LED remains off.
Code:
void loop()
{
  digitalWrite(LED, HIGH);
  delay(3000);
  digitalWrite(LED, LOW);
}
 
Last edited:

Thread Starter

abuhafss

Joined Aug 17, 2010
317
Not to belabor the point but to clarify: did you actually measure Vcc across pins 4 and 8 since having this problem? Can you confirm that your buck converter can provide current (not just the voltage into a DMM)?
Voltage across Pins 8 and 4 = 5.06V

Yes, I baised the BJTs to see if they light up their corresponding LEDs. All four LEDs are working fine. Do you want me to further check if the buck converter is really supplying current?
 

Ya’akov

Joined Jan 27, 2019
9,264
Voltage across Pins 8 and 4 = 5.06V

Yes, I baised the BJTs to see if they light up their corresponding LEDs. All four LEDs are working fine. Do you want me to further check if the buck converter is really supplying current?
The reason I am asking this particular question is that is the most basic and otherwise invisible fault that would account for the problem, including the sudden change in behavior. It would be a shame to spend time and effort on other things if this turned out to be the actual problem so I just wanted to be certain.

I have had things like that happen, and I learned a while ago to start with the most basic thing to avoid it.
 

Thread Starter

abuhafss

Joined Aug 17, 2010
317
The reason I am asking this particular question is that is the most basic and otherwise invisible fault that would account for the problem, including the sudden change in behavior. It would be a shame to spend time and effort on other things if this turned out to be the actual problem so I just wanted to be certain.

I have had things like that happen, and I learned a while ago to start with the most basic thing to avoid it.
Yes, I understand. Even though, the controller worked initially, there are chances of the buck converter being failed. So I verified the voltage at pin 8 at the first instant. I will recheck the current tomorrow.
I was just doubting that utilizing all the I/O pins might be causing some problem.
 

sagor

Joined Mar 10, 2019
926
This was the change I made, but LED remains off.
Code:
void loop()
{
  digitalWrite(LED, HIGH);
  delay(3000);
  digitalWrite(LED, LOW);
}
It will never stay low long enough to see, as right after "LOW", you write "HIGH" within a few uS. So, it will be high all the time, visually. If the LED never lights up when high, it is possible you have blown outputs in the Tiny?
 

Thread Starter

abuhafss

Joined Aug 17, 2010
317
It will never stay low long enough to see, as right after "LOW", you write "HIGH" within a few uS. So, it will be high all the time, visually. If the LED never lights up when high, it is possible you have blown outputs in the Tiny?
I have already mentioned in my 1st post that I have also replaced the Tiny with a new one. The new Tiny is also not responding.
 
Top