How to pyboard achieve the usb print function

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
skylin008
Posts: 88
Joined: Wed Mar 11, 2015 6:21 am

How to micropython achieve usb print function

Post by skylin008 » Wed Jun 08, 2016 8:32 am

Hello,everyone !How to micropython achieve the usb print function (USB printer)?

skylin008
Posts: 88
Joined: Wed Mar 11, 2015 6:21 am

How to pyboard achieve the usb print function

Post by skylin008 » Wed Jun 08, 2016 8:34 am

Hello,everyone !How to pyboard connect the usb printer and achieve the usb print function.TKS!

markxr
Posts: 62
Joined: Wed Jun 01, 2016 3:41 pm

Re: How to micropython achieve usb print function

Post by markxr » Wed Jun 08, 2016 8:42 am

I think the problem is that the Micropython boards don't have USB controllers, either host or device. This will cause a problem trying to talk USB.

The USB port on the board goes directly into a usb-serial chip attached to the uart, so it's not a USB port which can be controlled by the gadget. There's also probably no USB software stack.

I think probably your best bet is to get a combination of controller / printer which have a common interface. E.g. Raspberry Pi have USB ports, or on a wifi network a device with wifi might be able to print (e.g. esp8266 could do it, if the printing protocol is nice and simple).

Simpler printers intended for embedded use, for example, thermal printers used in point-of-sale systems, usually have rs232 or similar serial interfaces whcih could be wired (possibly with level converters as necessary) to the uart of a Micropython board.

The trick of avoiding trying to get a square peg into a round hole, is to change the shape of the peg or hole. Not a bigger hammer.

Mark

skylin008
Posts: 88
Joined: Wed Mar 11, 2015 6:21 am

Re: How to micropython achieve usb print function

Post by skylin008 » Wed Jun 08, 2016 9:06 am

@ markxr,Thanks!Pyboard have USB controller intergrated.I was a novice for printers , how to achieve printing protocol via network , whether you information in this regard , it was very grateful !

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: How to pyboard achieve the usb print function

Post by deshipu » Wed Jun 08, 2016 9:08 am

In short, you can't. PyBoard can only work as a USB device (something you connect to the computer) and not as USB host (something you can connect devices to). A printer is also only an USB device, and thus requires a USB host (such as your computer).

There *may* be some special printers that can act as USB host, for instance to print from an USB flash drive that you connect to them. If you own such a printer, the PyBoard should be visible as a flash drive to them too, and you can select and print the files from it normally.
Last edited by deshipu on Wed Jun 08, 2016 4:05 pm, edited 1 time in total.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: How to pyboard achieve the usb print function

Post by dhylands » Wed Jun 08, 2016 3:37 pm

In theory its possible, since the pyboard can as as a host for a keyboard and mouse, but it would require writing a bunch of C code. I'm not familiar with what protocols USB printers use, so you'd need to figure that out and integrate with MicroPython.

I think that this would be a fairly large undetaking.

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: How to pyboard achieve the usb print function

Post by platforma » Fri Jun 10, 2016 9:47 am

Topics merged. Please don't crosspost :)

Post Reply