HID library/module for ESP8266?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
idesignstuff
Posts: 5
Joined: Tue Aug 01, 2017 8:51 pm

HID library/module for ESP8266?

Post by idesignstuff » Thu Aug 03, 2017 2:41 am

Hey, how hard would it be to port the PYB module for HID over to the ESP8266?
I'd really like to use Wemos D1 mini or NodeMCU via USB to send Keyboard and/or mouse inputs to Windows/MacOS/or Linux machines.

It looks like PYB has a profile that also keeps mass storage access alive while also sending HID commands over USB.

Is this possible on ESP8266?

Thanks!

Sent from my Moto G (4) using Tapatalk

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

Re: HID library/module for ESP8266?

Post by dhylands » Thu Aug 03, 2017 5:27 am

My understanding is that the ESP8266 doesn't have a USB port. It has a serial port and uses an external USB-to-serial adapter. So no, you can't easily make HID work.

User avatar
mcauser
Posts: 492
Joined: Mon Jun 15, 2015 8:03 am

Re: HID library/module for ESP8266?

Post by mcauser » Mon Aug 07, 2017 5:50 am

Not having a USB port is not enough to stop this guy from implementing it in software:
https://github.com/cnlohr/espusb
http://hackaday.com/2016/09/03/software ... e-esp8266/

User avatar
pythoncoder
Posts: 5104
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: HID library/module for ESP8266?

Post by pythoncoder » Mon Aug 07, 2017 7:58 am

Astonishing :D
Peter Hinch

idesignstuff
Posts: 5
Joined: Tue Aug 01, 2017 8:51 pm

Re: HID library/module for ESP8266?

Post by idesignstuff » Mon Aug 07, 2017 11:34 am

There are at least a few Dev boards that add a micro USB connector and chip to ease programming and powering the esp. Wemos D1 mini and Node MCU are two of those.

Sent from my Moto G (4) using Tapatalk

torwag
Posts: 220
Joined: Fri Dec 13, 2013 9:25 am

Re: HID library/module for ESP8266?

Post by torwag » Mon Aug 07, 2017 1:23 pm

There are at least a few Dev boards that add a micro USB connector and chip to ease programming and powering the esp. Wemos D1 mini and Node MCU are two of those.
But those are client only. The FTDI or whatever clone just converts the USB PC-side to the serial communication for the ESP.
Therefore, those devices are recognized USB-based COM-serial port. There is no way to switch turn this into a HID device or anything else.

idesignstuff
Posts: 5
Joined: Tue Aug 01, 2017 8:51 pm

Re: RE: Re: HID library/module for ESP8266?

Post by idesignstuff » Mon Aug 07, 2017 1:58 pm

[quote="torwag"][quote]There are at least a few Dev boards that add a micro USB connector and chip to ease programming and powering the esp. Wemos D1 mini and Node MCU are two of those.[/quote]

But those are client only. The FTDI or whatever clone just converts the USB PC-side to the serial communication for the ESP.
Therefore, those devices are recognized USB-based COM-serial port. There is no way to switch turn this into a HID device or anything else.[/quote]Except using pins to make another USB interface?

Sent from my Moto G (4) using Tapatalk

torwag
Posts: 220
Joined: Fri Dec 13, 2013 9:25 am

Re: HID library/module for ESP8266?

Post by torwag » Mon Aug 07, 2017 2:16 pm

USB is a pretty big beast. Usually, it requires dedicated hardware to operate smoothly. The ESP does not have this hardware. It is not trivial to implement it in software only, esp. if the device itself is already very limited. Therefore, I agree with pythoncoder that the mentioned bit-banging USB-project is an astonishing achievement. The question is how practical it really is, as how much can you do something else if the uC is already very busy keeping the USB-part running. I know that SoftUart on the ESP is already very tricky to operate. Thus, I assume that a Soft-USB is even more challenging.
AFAIK, there is no simple extra chip, which can add a hardware USB function to a board. The existing chips and modules always rely on a driver on the PC side and on a IC on the uC side. With this you receive and send the data from the PC via USB to the uC. However, on the PC side, the specific serial bus will be presented by the driver (E.g. a serial com port). On the uC side the chip will do the same for the uC. That the intermediate communication is via USB, is just something between the driver and the extra chip. The controller and the PC side software do not notice anything about it, it is a "N-over-X"-technology. In fact it could be something else down to pigeon carriers https://en.wikipedia.org/wiki/IP_over_Avian_Carriers. In contrast, HID however, is something USB specific it requires full awareness of the USB protocol on both ends.

idesignstuff
Posts: 5
Joined: Tue Aug 01, 2017 8:51 pm

Re: RE: Re: HID library/module for ESP8266?

Post by idesignstuff » Mon Aug 07, 2017 2:26 pm

[quote="torwag"]USB is a pretty big beast. Usually, it requires dedicated hardware to operate smoothly. The ESP does not have this hardware. It is not trivial to implement it in software only, esp. if the device itself is already very limited. Therefore, I agree with pythoncoder that the mentioned bit-banging USB-project is an astonishing achievement. The question is how practical it really is, as how much can you do something else if the uC is already very busy keeping the USB-part running. I know that SoftUart on the ESP is already very tricky to operate. Thus, I assume that a Soft-USB is even more challenging.
AFAIK, there is no simple extra chip, which can add a hardware USB function to a board. The existing chips and modules always rely on a driver on the PC side and on a IC on the uC side. With this you receive and send the data from the PC via USB to the uC. However, on the PC side, the specific serial bus will be presented by the driver (E.g. a serial com port). On the uC side the chip will do the same for the uC. That the intermediate communication is via USB, is just something between the driver and the extra chip. The controller and the PC side software do not notice anything about it, it is a "N-over-X"-technology. In fact it could be something else down to pigeon carriers [url]https://en.wikipedia.org/wiki/IP_over_Avian_Carriers[/url]. In contrast, HID however, is something USB specific it requires full awareness of the USB protocol on both ends.[/quote]Thanks for clarifying. Looks like those pro micros I ordered will be the ticket then...

Sent from my Moto G (4) using Tapatalk

Post Reply