I am trying to create auto-username-writer with Digispark ATtiny 85. I have a pretty simple sketch:

#include <DigiKeyboard.h>        
void setup() {
void loop() {
    DigiKeyboard.sendKeyStroke(76, MOD_ALT_RIGHT | MOD_CONTROL_LEFT); //ctrl+alt+del
    DigiKeyboard.sendKeyStroke(0x2B); //tab

    for (;;) {}

When I upload the code via Arduino IDE into the device (Board: Digispark (Default - 16.5MHz), it finishes successfully, it is recognised as a HID device and immediately performs all the tasks. But when I disconnect it and connect it again (to my PC or any other PC) it is recognised as Digispark Bootloader and does not do anything.

I have tried it in Arduino IDE 1.8.8 and in Arduino IDE 1.6.5 and I have no idea why it is only recognised right after upload. I have two ATtinys and both do the same behaviour.

Can someone help me, please?

EDIT: I tried adding digitalWrite(1, HIGH); to detect, whether the sketch even runs and it turned out it does not even run (except after the upload)...

  • are you waiting 5 seconds for the sketch to start executing?
    – jsotola
    Mar 6 '19 at 21:17
  • Well, I have tried adding something like a 4-second delay at the start and I even let the ATTiny be in USB for some time. Neither helped... Mar 6 '19 at 21:21
  • the title of your post indicates that you have not identified the problem correctly, so it is difficult to find a solution on the internet ..... not recognised as HID device is not the problem ....... the problem is that the loaded program does not start after the digispark is reset .... the digispark enters program loader mode and does not continue to the loaded program after a timeout
    – jsotola
    Mar 7 '19 at 0:36
  • You are probably right. At time of writing I did not know the sketch is not executing. I tried googling the problem in regard what you have written, but was also unsuccessful - did not find anything I can use. Mar 7 '19 at 5:39

After five seconds, which is when the bootloader should switch to running your code, how does it show up in the list of usb devices (lsusb in Linux, Device Manager in Windows, etc.)

The original Digispark was a bit temperamental when plugged into USB 3 ports. If you are plugging it into one, try using a usb2 hub and plugging it into the hub instead.

Also, did you get this from Digistump, or is it a knock-off?

  • I have tried several USB ports (2 and 3) and neither worked even after extended period of time. Whole time it is shown in device manager as Digispark bootloader. Unfortunately I bought it in a local Czech e-shop, so I have no idea whether they are selling clone or original. Is there a way to detect whether it is original or clone? Mar 7 '19 at 5:37
  • I just run your sketch on a digispark, and it behaved as expected; at this point the easiest thing to do is to just get another little digispark and see if that one works. It's open-source hardware, so chances are that unless you ordered it from digistump directly, it's a knockoff.
    – JayEye
    Mar 8 '19 at 3:46

I hope I'm not too late here, but I believe you may need to update the bootloader. Could you try the instructions here? https://www.iot-experiments.com/micronucleus-bootloader-upgrade/ I happened to be reading through this guide: https://hackernoon.com/low-cost-usb-rubber-ducky-pen-test-tool-for-3-using-digispark-and-duck2spark-5d59afc1910 and the troubleshooting section there sounds like the issue you're having.

  • Hi, thank you for your answer. I tried upgrading the firmware, but unfortunately without any success, here is micronucleus.exe output: pastebin.com/2SsexNQ4 . May 8 '19 at 11:22

Your Answer

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

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