0

Looking for a Sketch; Want ArDuino to "look like" USB memory
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Looking for a Sketch; Want ArDuino to "look like" USB memory

by phil.drummond on Sat Mar 21, 2009 8:17 pm

Is there anyone who has a sketch that when it's running, makes any computer attached to the ArDuino "think" it's attached to a memory device?
My idea/application; To create a logger that puts it's collected data into a "file system-like" fragment of memory and serves the result as a file when a computer is attached.
I want to try to make a device that has a battery and an ATMega on it that records the time when a button is pressed. The USB connection would provide recharge power and allow the contents to be downloaded for post processing.
I have to use a punch-clock at work and recently, there have been some "lost" card scans. There's no problem, but they usually ask me what time it was so they can "repair" the records. I usually have to guess. If I had a gizmo attached to my time card, with a button on it, I could press the button after scanning the card (and reading the "approved" message from the time clock). I would then have a running table of time stamps to reference when they "lose" one.

Phil
phil.drummond
 
Posts: 126
Joined: Sun Feb 08, 2009 4:57 pm

Re: Looking for a Sketch; Want ArDuino to "look like" USB memory

by eil on Sat Mar 21, 2009 11:31 pm

There's no way that I know of to make the Arduino look like a USB mass storage device without some extra (and probably surface-mount) hardware.

Perhaps the better way to handle it would be to use the serial connection already afforded to you by the Arduino. You'd of course have to use a terminal program to retrieve the data (or write something that talks to the serial-over-USB port).

However, I think your bigger problem will be timekeeping. The Arduino has no real-time clock. You'd have to do something like this:

http://www.arduino.cc/playground/Code/DateTime
eil
 
Posts: 440
Joined: Sun Aug 31, 2008 11:09 pm

Re: Looking for a Sketch; Want ArDuino to "look like" USB memory

by Amberwolf on Sun Mar 22, 2009 3:37 am

I don't know how to do it with Arduino, but code already exists to do this with the STM32 Primer1 and Primer2, here:
http://www.stm32circle.com/projects/project.php?id=57
Perhaps it can be adapted? (I know, the hardware is different, but still...)
Watch me build an electric bike from assorted junk!
Alternative Energy Sources for the Home from Recycled Junk
A subsidiary of Cybernetic Necromancers, Discorporated:
"We Bring Dead Things To Life"
Amberwolf
 
Posts: 310
Joined: Wed Oct 08, 2008 2:42 am
Location: Phoenix, AZ, USA

Re: Looking for a Sketch; Want ArDuino to "look like" USB memory

by mtbf0 on Sun Mar 22, 2009 7:37 am

if you use a kit version of the arduino like, say, the boarduino, you can replace the oscillator with a watch crystal and a couple of small caps to get a pretty accurate time base. you'll need to alter the fuses on the mcu, so you'll need an isp programmer like the usbtinyisp or another arduino programmed to function as an isp.

the arduino has 512 bytes of eeprom which is enough to store fifty 10 byte bcd time stamps. that'd be easily enough for a week's worth of clock rings at up to 8 rings a day.

a little sketch to set the time and retrieve your rings over a serial connection would not be too complicated. hell, you could even add an alarm to get you to work on time.
"i want to lead a dissipate existence, play scratchy records and enjoy my decline" - iggy pop, i need more
User avatar
mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am
Location: oakland ca

Re: Looking for a Sketch; Want ArDuino to "look like" USB memory

by Ran Talbott on Sun Mar 22, 2009 3:35 pm

The short answer is "no": what the board "looks like" to the PC is controlled by the USB-to-serial chip in a way that can't be changed.

To use an Arduino for your application, you need to either write applications to communicate over the serial port and transfer the data, or log to an SD card and read it on the PC with a standard USB card reader.

Ran
Ran Talbott
 
Posts: 57
Joined: Thu Feb 19, 2009 1:32 pm

Re: Looking for a Sketch; Want ArDuino to "look like" USB memory

by adafruit on Mon Mar 23, 2009 4:48 pm

you can, however, use something like a gpslogger shield and not include the GPS part (just use the SDLog library)
or you can use the FTDI viniculum chip devboards
http://apple.clickandbuild.com/cnb/shop ... nd+Modules
they'll write to a USB key

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Please be positive and constructive with your questions and comments.