1

I have ATTiny85 that I want to drive a servo. Burned bootloader to the ATTiny85 and I am using HW-260 development board to program and to test the code. While the ATTiny85 works perfectly on the HW-260 development board, I cant get it to work as a standalone on a breadboard when testing with the servo by using the Adafruit_SoftServo library and with the blink example. Tried adding 4.7kOhm pull-up resistor to PB5 to prevent the ATTiny85 from resetting but I get the same result. Tried powering the standalone layout with 3V coin cell, USB 5V, powerbank 5V and nothing. This is the servo code I am using:

Adafruit_SoftServo myservo;
int pos = 0;
void setup() {
  myservo.attach(PB0);
}
void loop() {
  for (pos = 0; pos <= 180; pos += 1) {
    myservo.write(pos);
    myservo.refresh();
    delay(15);
  }
  for (pos = 180; pos >= 0; pos -= 1) {
    myservo.write(pos);
    myservo.refresh();
    delay(15);
  }
}

The blink code I am using is from the examples, I just change the output pin as PB1. If I connect the PB5 briefly to ground, I get the servo to turn a bit in random direction. Measured and the breadboard is not the problem, everything seems to be connected correctly.

This is the bootloader I used https://github.com/ashishchoudhary9998/ATtiny85-Boot-loader

Edit: This is the schematic of the HW-260 board enter image description here

This is my layout enter image description here

5
  • Welcome to SE/Arduino! Please take the tour to learn how this site works. You might also want to read "How to Ask" and some of the help center. -- If the same program works on the development board, but not on your board, you need to find out the differences. Please edit your question and add schematics (or at least relevant parts of them)for both. Dec 4, 2022 at 10:06
  • thanks @thebusybee I edited the question and added the schematics. Dec 4, 2022 at 13:33
  • Concerning the Blinky example, working on the HW-260, but not on your board, there is only just one difference: PB3 is pulled up by 1k5. Would you mind to add this to your board, and retry, please? And what do you see with Blinky on your board, a completely off LED, a completely on LED, or something in-between? BTW, do you have an oscilloscope? Dec 4, 2022 at 13:45
  • @thebusybee sure, i will try pulling PB3 up right away and i will let you know what will be the result. i dont have an oscilloscope :( thanks for trying to help me. Dec 4, 2022 at 13:48
  • @thebusybee it works :) adding a pull-up resistor to PB3 fixes the issue and the code is working perfectly. thanks allot. btw the current firmware (bootloader) has some kind of delay, i measured like 5-6 seconds delay before the code starts working. can you please add your comment as an answer so i can mark it as solution? Dec 4, 2022 at 13:53

1 Answer 1

1

After adding the schematics, a difference can be spotted:

PB3 needs a pull-up, on the development board it has 1,5 kΩ. This resistor is part of the USB standard and signals "low speed device". Presumably (because the source of it is not provided) the bootloader needs this to start at all, too.

The delay mentioned in a comment is typical for ATtiny85 development. Because of the low number of pins, the bootloader starts and waits for some seconds for a PC to connect. If no connection is established, the user program is started. It can then use all pins for its own purposes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.