Shop OBEX P1 Docs P2 Docs Learn Events
Output ProtoBoard/DemoBoard etc directrly to USB printer — Parallax Forums

Output ProtoBoard/DemoBoard etc directrly to USB printer

SkogsgurraSkogsgurra Posts: 231
edited 2007-07-30 16:51 in Propeller 1
I know next to nothing about USB. So, before I fry anything, I thought that it would be a good idea to ask. Simply put: Can I connect the PropPlug directly to a USB printer? Do I need a "null modem" or can I connect using a standard straigh through cable?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Comments

  • LeonLeon Posts: 7,620
    edited 2007-07-29 14:39
    No, you can't. USB doesn't work like that.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • SkogsgurraSkogsgurra Posts: 231
    edited 2007-07-29 14:44
    Not at all?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-29 14:55
    Nope, not at all.

    USB is a serial network with one master (host) and some number of slaves (peripherals). All the devices are addressable. There's a huge amount of complexity in the host to organize this network and manage it. There are some fairly cheap USB host interfaces on the market now that can be connected to a Propeller. The USBwiz from GHI Electronics has provisions for using a USB printer as well as a USB keyboard or mouse plus mass storage devices like thumb drives or even a CD drive.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2007-07-29 14:56
    Beer you know, USB you obviously don't smile.gif

    I will get around to writing some usb drivers myself but you may like to look at what one guy did by bit-bashing an AVR.

    www.cesko.host.sk/IgorPlugUSB/IgorPlug-USB%20(AVR)_eng.htm

    This is possible with the Propeller running the USB at 1.5Mbps since 12Mbps would be out of the question. You might need clamping diodes.

    *Peter*
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2007-07-29 15:02
    Just a note regarding host USB. It is true that the host USB on a PC is very complex but it is also true that it tries to encompass every possible device. But take for example the various USB host devices which are nothing more than preprogrammed CPUs, they have limited ability as hosts to talk various classes such as HIDs, mass storage, and printers to some extent. The first two classes are fairly well defined but I'm not quiet sure about the printers at this stage.

    *Peter*
  • RinksCustomsRinksCustoms Posts: 531
    edited 2007-07-29 15:07
    I would imagine that the prop is technically feasable of doing this, but you'd have to figure out if you could get the prop to act as the host device and also write your own driver for that specific printer.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    E3 = Thought

    http://folding.stanford.edu/·- Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-29 15:13
    If you look at the AVR bit-bashing device description, you'll notice that it's a USB slave device, not a host device. There have been a variety of USB slave device designs posted in various places ... there have been several in Circuit Cellar for example. They're relatively straightforward to do with bit-bashing and could be done with the Propeller. There are very few USB host devices on the market. The ones by GHI Electronics and Vinculum are really the first and Vinculum's only handles mass storage devices and their own serial interfaces.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2007-07-29 15:52
    The AVR is an example of how simple it can be to interface to USB. But of course this example is a slave since it's only an itty-bitty AVR. I can't say I've written a usb host yet but from what I know it can be done, especially if you have the driver information about the slave. There is a generic usb printer class 07.

    Personally I hate the USB implementation, but not the concept. If they had allowed for multi-dropping as well as for hubs plus +12V power on the cable it would be more "universal". Then there's the software complexity that seems to accompany anything remotely associated with microsoft. There also seems to be a great deal of obfuscation surrounding usb in general but that's what happens when you have a standards body and $4,000 annual membership fees.

    But I'm just a mushie and I don't know that's it's impossible.

    *Peter*
  • RinksCustomsRinksCustoms Posts: 531
    edited 2007-07-29 16:31
    http://www.youtube.com/watch?v=a14zELKPw8M&mode=related&search=
    Perhaps somethnig like this would be easier to implementsmilewinkgrin.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    E3 = Thought

    http://folding.stanford.edu/·- Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.
  • SkogsgurraSkogsgurra Posts: 231
    edited 2007-07-29 17:28
    Boy! Am I happy I told them it would be difficult!

    The problem: I have this little hand-held boc that takes field measurements (Prop Inside) and stores the results. Then, it is taken to a PC and the results are transferred, using Hyperterminal or something. Someone said that it would be neat to plug the device right into a printer and get the results on paper. The output is already formatted for that.

    I told him to use a serial printer and he didn't even know what it is.

    And there are no Centronics connectors on printers any more either... :-(

    Thanks for lots of information! I bet there is more?!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-07-29 18:24
    Rinks,

    That printer is still being driven from the PC, the propeller is just converting encoder pulses from the origional paper feed to step pulses for a stepper motor.

    More details of my ongoing project here: www.indoor.flyer.co.uk/3dprint.htm


    Skogs,

    A thermal printer module would probably do what you want, like the ones used in tills.

    Or build your own printer: http://www.parallax.com/detail.asp?product_id=27949

    Or look at the IR camera to printer interfaces, MIGHT be easier than USB if documented.

    Graham
  • SkogsgurraSkogsgurra Posts: 231
    edited 2007-07-29 18:29
    Thanks. But this is not about having a printer or having a computer. It is about someone being too lazy to walk a few hundred metres and starting the terminal program. A printer happened to be close and he just asked if he could plug into that. Now I know he cannot. And I will tell him that.

    Sometimes, a no is also an answer smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-07-29 20:28
    You did ask for more information.

    NO
  • SkogsgurraSkogsgurra Posts: 231
    edited 2007-07-29 21:59
    ???

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • RinksCustomsRinksCustoms Posts: 531
    edited 2007-07-29 22:50
    Skogsgurra said...
    Not at all?

    That statement is explicitly a request for additional information of a possible alternative solution to the original querry, and if you knew the answer why waist our time with a post that appears as a genuine inquerry?! nono.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    E3 = Thought

    http://folding.stanford.edu/·- Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-07-29 23:08
    Skogsgurra said...
    I told him to use a serial printer and he didn't even know what it is.

    And there are no Centronics connectors on printers any more either... :-(
    My two year old (or so) Konica Minolta 2300 DL has RS232, usb and RJ-45 connects.

    I'd check with Minolta first before I would say "not any more".
  • Franz AchatzFranz Achatz Posts: 140
    edited 2007-07-29 23:24
    This Printer is Atmel enabled.

    http://www.xs4all.nl/~achatz/drucker.MPG

    have fun

    Franz
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-07-30 00:45
    Franz,

    Any further details?

    Graham
  • Harrison.Harrison. Posts: 484
    edited 2007-07-30 01:09
    Most lasers (not counting the really cheap ones) have usb and parallel (centronix) interfaces. Parallel is really easy, especially if the printer supports PCL, PS, or text printing. You just have to write the byte to the 8 bit wide port and toggle the strobe line. You may have to send out some PS or PCL printer language stuff, but it isn't too difficult and is well documented online.

    I have a color dell laser (renamed xerox laser) and a b/w brother laser. Both have parallel and usb interfaces (the dell color also has ethernet, but that wouldn't help you too much).

    So it would probably be cheapest to just go find a printer with a parallel interface that supports raw text printing (usually called dos support). If you can get that then just reserve about 10 pins on the Propeller (8 bit data, 1 bit strobe, 1 bit busy) and you can print via parallel.

    Harrison
  • SkogsgurraSkogsgurra Posts: 231
    edited 2007-07-30 04:41
    Sorry for waisting your time. (Did I, really?)

    The problem is not, as I said before, to find a printer. The problem is that someone was a little lazy and did not want to walk to his office, start Hyperterminal etc. He than thought that it would be nice to plug into a USB printer close to the work-area and get a printout. I also thought that that would be a valuable possibility, if it was a possibility. Which it doesn't seem to be. So, he will either bring a laptop with him - or walk a couple of hundred metres, start HT and do the transfer. There's not much to it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-30 04:51
    The USBwiz is $60 from Saelig in the USA and would support an SD card and a USB printer. Don't forget that you'd have to figure out the printer's control language for selecting fonts, margins, etc. if you don't like the printer's defaults. That's part of what you get by using the manufacturer's printer driver on a laptop or desktop computer. Most laser printers require Postscript or HP's PCL (which are text-based page description languages) even though the interface is USB.
  • inakiinaki Posts: 262
    edited 2007-07-30 05:41
    Not counting the USB part, writing the printer driver itself·might be a significant part of the work. Remember that if anyone wants to print·to the nearest printer you should be able able to·drive each kind of printer!

    For a portable device like yours·I would suggest to use a calculators printer, like the HP 82240B thermal printer·that is used with HP calculators and can print text and graphics in a compact size. It uses an InfraRed port to communicate and the command set is easy to implement in a Propeller.

    There are several examples on the internet·of how to use this printer with a microcontroller. I wrote·a very·simple BS·code·for a Stamp and it worked nicely.

    This printer is cheap and is still available at many stores although HP has discontinued it(although there are compatible printers).
    http://www.calculatorsource.com/hp-82240b.html

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • RinksCustomsRinksCustoms Posts: 531
    edited 2007-07-30 05:49
    The propeller is more than capable of driving your USB printer. One simply needs to dev a USB Driver in ASM, but being able to carry a laptop and fire up HT seems a lot more of a lazy task than writing a custom USB driver or a leisurly few hundred meters. Me thinks he votes for the laptop.

    And no, you didn't really waist our time but if it was a boolean answer you were seeking, perhaps you should have mentioned it in the first or second post.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    E3 = Thought

    http://folding.stanford.edu/·- Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.
  • SkogsgurraSkogsgurra Posts: 231
    edited 2007-07-30 05:59
    Yes. NO is definitely an answer. Or, no, YES wasn't the answer - this time.

    I learned a lot. That USBwiz is something I will look into. Not for this application, but others. This guy will have to do some walking. He is already excersising...

    Thanks for sharing your vast knowledge. I appreciate that.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • rjo_rjo_ Posts: 1,825
    edited 2007-07-30 16:13
    Skogs... great thread.

    Any time you guys dig your teeth into a question... it is never a waste of time.

    Scogs, you said "Thanks. But this is not about having a printer or having a computer. It is about someone being too lazy to walk a few hundred metres and starting the terminal program."

    It sounds like your guy needs a hard-copy record... occasionally. And it sounds like he is employed... so he can't be all that lazy. Time is money... The distance he has to walk has a direct monetary value... and therefore set's the floor and ceiling for project costs.

    distance x velocity x wage rate + cost of health care/hour + social security per hour + insurance * 8 hrs * 5 days * 52 = total cost per year (your potential budget[noparse]:)[/noparse]

    You can set the terminal program once and it will be constantly waiting for input... which it can automatically save to a fixed file location. You could have another program watching that file and automatically print the file or some portion of it depending upon logic that you choose(ImageJ... is my favorite... nice macro language). If I were you, I would hot glue a prop to the side of the computer so your guy doesn't lose it...[noparse]:)[/noparse] But I'm not an engineer... so your solution would probably work better...

    You problem can be translated "the office based prop communicates with the Prop doing the measurements... over a couple of hundred meters.
    What is the cheapest and most reliable way to get the data from one to the other.

    Rich

    He could ride a bicycle?
  • SkogsgurraSkogsgurra Posts: 231
    edited 2007-07-30 16:42
    Interesting new possibilities.

    This is a little like when I was employed at the head office of that HUGE company. When there was a technical thing to discuss, we posted a piece of paper on the bill-board in our coffee-room. Only hours later, the ideas used to pop up. Sometimes taking unexpected ways. Like riding a bike...

    Yes, you are right. This is in an industrial environment. And it isn't just laziness. I think that the macro idea is just what I was needing. Some guys do not like to start programs like Hyperterminal, let alone configuring them. Bringing a laptop on site is no big deal. And if the data collection can be automated, it will be perfect. I will see what a macro can do for me. Thanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • rjo_rjo_ Posts: 1,825
    edited 2007-07-30 16:51
    Skogs...

    I have a similar problem... much simpler though. I like ImageJ... because you can watch the data come into your pc file and do things like "print" based on the value. http://rsb.info.nih.gov/ij/notes.html
Sign In or Register to comment.