Author Topic: Digispark SPI/SD  (Read 5478 times)


  • Newbie
  • *
  • Posts: 1
Digispark SPI/SD
« on: September 08, 2017, 06:46:58 am »
Hi - I am trying to make a usb keyboard that will type out what is found in a file on an SD card. I have an SD card board with its own chip to read/write to the sd card. It uses SPI to communicate to whatever device. The SPI library does not compile when Digispark default is the chosen board. After some research, all I can find are people who have had no success, but insist that the Tiny85 is SPI compatible. Most of the threads are years old too; I was hoping maybe some progress was made by now. Does anyone have a clue of what to do? I read that the SPI pins are 0 for MOSI, 1 for MISO, 2 for SCK, and that 5 must be used for CS because 3 and 4 are used for something on the usb connection. The SD card board has a voltage regulator on it so voltage put out by the digispark should not be a concern. Does anyone have any ideas? Thanks!


  • Hero Member
  • *****
  • Posts: 881
Re: Digispark SPI/SD
« Reply #1 on: September 09, 2017, 02:13:50 am »
Pinwise, that shouldn't be a problem... D0 is MOSI, D1 is MISO, D2 is SCK/CLK, and CS (chip select) can go on D5, so you won't interfere with the D3/D4 USB lines.

Your problem will be space... not sure how much space the UsbKeyboard library takes up, but I bet you won't have much SRAM or flash memory left for the SD libraries, and they need a LOT of flash and RAM... and then there is a question of is there anything compatible with the attiny85 in the digispark. There is some code for a sd wave player, but the author has had to write that in AVR Studio C code, rather than Arduino code, and that doesn't have USB connect either.

I suspect to do what you want, you'll want to get something with a bit more grunt.... both in SRAM (memory) and flash (program space). If you want something cheap, possibly the STM32 'blue pill' might work... lots of program and RAM space, and there is supposedly USB HID stuff for it.... A better option might be one of the micro Arduino Lenardo type boards that you can get now... for example, this one - which is basically the same side as the digispark, but has the more powerful ATMEGA32U4 processor and can readily do USB HID/keyboard/mouse stuff, and also have the grunt to do the SD card stuff you need.