I am interested in connecting a 3.5" hard drive to an IoT device that I am building based on a microcontroller (e.g. an Arduino) which doesn't run a mainstream operating system.

As far as I know, to use a 3.5" hard-drive you need a full operating system (such as Linux or Windows) for device drivers to connect a 3.5" hard drive. Is this assumption correct?

Is there a way of implementing drivers for SATA/USB and the FAT filesystem, so that I can save files to a USB or hard drive? Are there any pre-existing projects or drivers that I can re-use for this purpose?

I would prefer not to use an SD card because the capacity that I want will be more expensive.

  • 1
    this is not IoT specific. Dec 6 '16 at 20:40
  • 3
    @SeanHoulihane So what? The important point is whether it applies to IoT, not whether it might also apply outside of IoT. Dec 7 '16 at 1:15
  • The question seems to be more about file system implementation than storage type; the distinction between magnetic hard drives vs flash drives is largely irrelevant if both are connected via USB and the intent is to use the same (un-optimized) legacy file system. Even historically, a compact flash interface is nearly the same as that of an IDE hard drive on which it was modeled. SATA will be difficult to do directly from an MCU almost regardless of what is hanging off of it, though a PATA to SATA bridge might conceivably work. Jan 15 '17 at 23:13

There is a project FatFs - Generic FAT File System Module that offers FAT access for microcontrollers.

FatFs is a generic FAT/exFAT file system module for small embedded systems. The FatFs module is written in compliance with ANSI C (C89) and completely separated from the disk I/O layer. Therefore it is independent of the platform. It can be incorporated into small microcontrollers with limited resource, such as 8051, PIC, AVR, ARM, Z80, 78K and etc.

Petit FatFs is for tiny (8 bit) microcontrollers.

Petit FatFs is a sub-set of FatFs module for tiny 8-bit microcontrollers. It is written in compliance with ANSI C and completely separated from the disk I/O layer. It can be incorporated into the tiny microcontrollers with limited memory even if the RAM size is less than sector size. Also full featured FAT file system module is available here.

So, yes, IoT devices that are based on microcontrollers that could run FatFs or Petit FatFs could access hard-disk drives without a full-blown OS.

  • 1
    Those are file systems for storage on the device. To attach an external device, you need the USB drivers Dec 6 '16 at 20:43
  • ... it is conceivable to connect a HDD other than via USB, e.g. the way it was done in the olden days PATA.
    – Ghanima
    Dec 6 '16 at 20:47
  • 1
    Agreed (+1) I guess I was misled by the usb tag :-) Dec 6 '16 at 20:51

Since the Raspberry Pi supports Windows 10, that is at least one example. You could certainly attach an external 3.5" drive by USB.

I have no doubt that other IoT devices can too. Just Google & I am sure that you will find plenty of information. Or, is there a specific device or o/s which interests you?

  • 2
    The Rasberry Pi have Linux Operation system. My question is if there is IoT device that not running Linux, that supports external 3.5" drives Dec 6 '16 at 20:27
  • 1
    The Rapsberry Pi commonly has Linux, but it does not have to. It is just a computer - Microsoft have already ported Windows 10 to it. I have no doubt that FreeRTOS will run on it soon (yup, it already has raspberrypi.org/forums/viewtopic.php?t=22423) Dec 6 '16 at 20:30
  • 1
    Win10 IoT is also supported by the Pi but mind that it is Win IoT (not the desktop version, so no GUI and stuff).
    – Ghanima
    Dec 6 '16 at 20:32
  • 1
    What has a GUI to do with this question? Dec 6 '16 at 20:35
  • 2
    Helpful, I guess, but, as an embedded programmer of a few decades, I never even think of a GUI :-) Dec 6 '16 at 23:08

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