Close
0%
0%

sdlocker-tiny

Attiny85-based device to enable and disable write-protection on any SD card.

Similar projects worth following
I routinely use USB drives loaded with software tools and benchmarks to diagnose and fix computers. I wanted a way to protect those drives from viruses, malware, filesystem corruption and accidental erase.

USB drives with a write-protect switch do exist, but are hard to find and expensive. Full-sized SD cards have a slider tab to write-protect them, but it actually does nothing - it's up to the card reader to report it to the OS, and it's up to the OS to decide whether to comply and mount the card read-only or not. Most of them simply ignore it, so SD cards may be overwritten regardless of the write-protect tab.

The sdlocker allows me to truly write-protect any SD card by toggling the TMP_WRITE_PROTECT bit on the flash memory controller of the card itself. Together with a USB card reader, this write-protected card can then be used as a read-only USB drive.

This is my own fork of the original sdlocker by Karl Lunt, tailored to suit my needs - smaller, simpler, and USB-powered.

Changes from original sdlocker

  • Ported from Atmega328 to Attiny85
  • Removed all the UART code and unused functions
  • Rewrote the user interface (1 button, 1 LED)

Device Usage

The LED shows the state of the inserted card at all times:

  • Steady off: card is unlocked (writable)
  • Steady on: card is locked (write-protected)
  • Blinking, fast: device is reading the card
  • Blinking, slow: card is faulty or not properly inserted

Holding the button down (over half a second) toggles the write-protection of the inserted card.

  • 1 × ATTINY85 Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers
  • 1 × Tactile switch
  • 1 × LED, Green Fiber Optics / Emitters
  • 2 × Resistor, 300 Ohm current limiters for the LED and the switch
  • 1 × SD card socket

View all 10 components

  • 1
    Step 1

    The provided makefile uses avr-gcc and avrdude. Edit it to match your programmer.
    Run make to compile and make program to flash.

View all instructions

Enjoy this project?

Share

Discussions

Rich text editor

inxx wrote 09/26/2016 at 07:54 point

Nephiel, where  can I find the electronic schematic,please?

  Are you sure? yes | no

Nephiel wrote 09/26/2016 at 08:29 point

The original schematic by Karl Lunt can be found here: http://www.seanet.com/~karllunt/sdlocker.html. The pinouts and details for the ATTTINY85 are on sdlocker-tiny.cpp

  Are you sure? yes | no

sign321 wrote 08/19/2016 at 19:01 point

@Nephiel Another question for you. I am totally knew to building any kind of electronics, so bear with me.  I just came across this product: https://www.adafruit.com/products/1500 (the Trinket).  It seems to include the ATTiny, LEDs, and a a micro-USB socket.  It comes in 5v and 3.3 v models.  If I bought a 3.3 volt model, should I be able to add a Switch and an SDcard socket and program it and have it work?  I realize this is not quite as DIY but it might but a little easier and cleaner for me.  Thanks again.

  Are you sure? yes | no

Nephiel wrote 08/21/2016 at 17:31 point

The 3.3V Trinket should do fine, but the code might need a few tweaks to get it to work on it.

  Are you sure? yes | no

sign321 wrote 08/19/2016 at 18:47 point

@Nephiel when I look at the TI specification for the LM3840 it says the 33 capacitor should be "Low ESR".  Is that significant?  I don't really know exactly what I'm looking for/where to find it.  Thanks for sharing this interesting project.

  Are you sure? yes | no

Nephiel wrote 08/21/2016 at 17:44 point

Pretty much any Low ESR capacitor that is at least 33μF should do. See the datasheet http://www.ti.com/lit/ds/symlink/lm3940.pdf, section 8.2: Typical Application (page 9). You don't really need the 0.47μF capacitor, though It's always best to match the datasheet to be on the safe side.

  Are you sure? yes | no

Eric Hertz wrote 12/13/2014 at 00:28 point
Hah, it was already done on the 328! Maybe you should submit to the Trinket Everyday-Carry contest?

  Are you sure? yes | no

Nephiel wrote 12/13/2014 at 00:50 point
Nah, it wouldn't be fair. It was completed months ago, doesn't meet all the guidelines (not battery-powered and not using a Trinket), and it was already featured on HaD. But it's neat and useful, so I thought it'd make a good first entry here.

  Are you sure? yes | no

Eric Hertz wrote 12/13/2014 at 00:07 point
Awesome! I saw that bit in the register and thought "How come no one seems to use this?!"

  Are you sure? yes | no

Nephiel wrote 12/13/2014 at 00:48 point
Thanks! I thought the same when I saw Karl's project. It does come in handy for some applications.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates