3

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.

Sean Houlihane
  • 10,504
  • 1
  • 25
  • 61
  • 1
    this is not IoT specific. – Sean Houlihane Dec 06 '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. – Gilles 'SO- stop being evil' Dec 07 '16 at 01: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. – Chris Stratton Jan 15 '17 at 23:13

2 Answers2

11

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.

Ghanima
  • 2,539
  • 1
  • 17
  • 46
5

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?