Does anyone know if an Arduino (clone) with an SD card on board can be made to show up as an HID device on a computer, so the SD card shows up as a mass storage device? Basically, plug the board in, and the SD card shows up as a mass storage, or one can use the Arduino IDE to actually program the controller.
Even if it means doing some manual work, such as removing the SD card prior to programming the board. I'm thinking since one can use the card detect pin on a card holder, it should be easy to detect whether to have the device show up as a mass storage, or as a virtual comm port for programming.
Anyone ever do this, or know of a board that does this?
This might be possible with a true Uno or 100% compatible Uno clone. They work as HIDs. But I think you may have to do some coding to get the SD card to appear as removable storage. But seeing as how you can just put the SD card into most computers made since 2006, why would you want to do this?
BillO:
This might be possible with a true Uno or 100% compatible Uno clone. They work as HIDs. But I think you may have to do some coding to get the SD card to appear as removable storage. But seeing as how you can just put the SD card into most computers made since 2006, why would you want to do this?
Unos don't work as HID. And in this instance, the SD Card isn't easily accessible to pull out every time it needs to have a new set of instructions downloaded on it. So if I can have the device show up as a mass storage, that would be a better solution.
I suppose another possible kludge would be to have a specific sketch which sole purpose is to write data (embedded in the sketch) onto the SD card. Then load up the actual sketch that's going to drive everything. But I hate having to go back and forth and ultimately that's not a good solution for the end-user (which won't always be me.)
Like I said, the SD card won't be easily accessible (it's inside of an enclosure), so taking it out to put in a card reader isn't an option without tearing open the enclosure each time.
If you're willing to throw some money at the problem ($16), a Teensy might be just the ticket... Projects using the Teensy USB development board ...towards the bottom is "CD Emulation - A USB MassStorage Device that can emulate A CD Rom Library".
And I've seen PJRC credited with supporting Arduino at the Lady Ada site, though not all Teensy2 makers do.
When I started with Arduino I had looked into HID with UNO and while it's possible, I won't even try. I'd much sooner go the V-USB route, even ATtiny chips can do it.
GoForSmoke:
And I've seen PJRC credited with supporting Arduino at the Lady Ada site,
Definately: significant enhancements and bug fixes for the IDE, toolset, and a long list of libraries. If you believe in supporting those who support the Arduino community PJRC is definitely on the "good" list.
Hrm, that's specific to the Teensy. I wonder if the same can be applied to a 328P, or whether I'll be forced to build a Teensy in the design with a second USB port. Meh.
Something else popped in my head this morning though ... they say a man thinks best when on the throne ... maybe so. This board design will also have one of either wired or wireless ethernet. Technically it should be possible to have the device show up on the network, and be able to transmit a new data file for it to write on to its SD card, yes? It should all come down to the coding, and how to tell it that you're about to send it a new data file that it should just put on it's onboard SDcard. That same coding should also do its normal stuff, like running the sketch itself.
Thinking out loud, the sketch would be like any other sketch would be, tell the MCU what to do, from receiving data through the ethernet (whether wired or wireless), to controlling the servos. With everything build as loop calls, it should be possible to add a section that says 'if you see this sequence of commands over ethernet, go in this mode' where this 'mode' would be to receive data that goes straight to the SD card (while halting everything else the sketch is doing.) Or just have each unit poll a master unit on the network and if present, pull a file from it.
One possible "run" would be something akin to this:
device boots up and configures itself as an EthernetClient
scans for a specific server on the network
if found, requests a data file and downloads it to its onboard SD card
if the server isn't found, reconfigure itself as a listening server and jump in it's normal loop
(the purpose of each one being a listening server is so I can poll them later and retrieve status information from each one, as opposed to having them constantly send stuff out.)
This way I don't have to be scanning for that server during a program run, but only when the thing boots up (or gets reset). Very much like what a bootloader does, either go into programming mode, or run the sketch.