element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Mass storage emulation raspberry pi
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 12 replies
  • Answers 1 answer
  • Subscribers 676 subscribers
  • Views 3420 views
  • Users 0 members are here
  • raspberry_pi
Related

Mass storage emulation raspberry pi

Former Member
Former Member over 9 years ago

I have a device developed by a third party that generates a report when requested.

The output of the report is a text file. The device is it is only capable of writing to a USB drive.

I am trying to figure out the best way to automatically print the report after it is generated.

 

I have found a good thermal printer I can use with a raspberry pi. But I'm not seeing a great solution to make the pi emulate a USB drive allowing this machine to output to the PIs native storage.

 

I'm wonder if anyone has a suggestion to make this work. Weather it use the raspberry pi or another board.

  • Sign in to reply
  • Cancel
Parents
  • clem57
    0 clem57 over 9 years ago

    If you use the Raspberry Pi Zero, it can emulate storage to another computer as if it were a USB stick. Is this what you are after?

    Clem

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to clem57

    Yes I believe so. Does it need additional boards? Or is it natively able to do this? After it receives a file I would like the pi to then print it.  So it would need to be booted into the OS while it is acting as a USB drive is that possible as well?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rew
    0 rew over 9 years ago in reply to Former Member

    The CPU on the raspberry pi family has the ability to work as an "USB Device". The hardware on B, B+ and Pi3 however makes this impossible unless you probe signals internal to the board. The A, A+ and Zero however bring out the right signals on the USB connector.

     

    There are however two problems with this approach. First there is the problem that this would use the ONLY usb peripheral on the chip. How are you going to connect to the printer? Through USB? No. Through Ethernet? Just need to add an USB-Ethernet adapter... Ah...shucks!

    Secondly, there is no (open source) software that I know of that makes the pi behave as an USB device.

    There now is open source software  (http://pi.gbaman.info/?p=699 )  that allows the pi to behave as an USB-device. As a mass-storage device everybody thinks that you would simple export the whole SD card. I don' think this is a good idea: both OSes (the one on the pi and the one on the "third party device") would cache disk-blocks of the storage. This would create big problems. So the best would be to have an image on the SD card that is exported as the USB-storage device. Then on the pi you would make some software to "peek" into the image and extract the report for printing.

     

    Possibly you might be able to use an ESP8266 board to get connectivity on the pi with the USB port already taken?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 9 years ago in reply to rew

    My thought was to use the hardware UART on the pins as a USB if needed with a converter to 5V from 3.3V on Raspberry Pi pins. There are many to be found. As to programming, a CRON task could wake up and look in the appropriate directory and perform the operations needed to print the text.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rew
    0 rew over 9 years ago in reply to clem57

    I don't think that will work. The "third party device" expects to find an USB DRIVE, not an USB serial port.

     

    Yes, in theory that solution would be possible. However the term "third party device" usually implies: "so we can't change its hardware or software".

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 9 years ago in reply to rew

    For clarity, the previous post is to set up a USB for printing text. The OTG is used as a storage device.

    C

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to clem57

    Would I still be able to program the pi? the printer can use a ttl pin I was looking at this one:

    https://www.adafruit.com/products/597?gclid=Cj0KEQjw5Ie8BRCJ9fHlr_bH24cBEiQAkoDQcWk-G6TSWUQmB1ZmDQsSc9VzhxNlfUwzMBKZW4Io…

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 9 years ago in reply to Former Member

    Here is what you can do:

    1. Buy Raspberry Pi Zero. Microcenter is good place if you are near one, Otherwise find one online.

    2. Install software like https://gist.github.com/gbaman/50b6cca61dd1c3f88f41

    3. Create a cron task to run python to read file(text based) and print to the thermal printer. It could run every few minutes. It would need to know the name(s) of the files being created. If it works, cleanup the files by deleting them.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 9 years ago in reply to clem57

    Tutorial at https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/other-modules

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • clem57
    0 clem57 over 9 years ago in reply to clem57

    Tutorial at https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/other-modules

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube