A while back, [cnlohr] needed a USB keyboard and mouse. His box ‘o junk didn’t hold this particular treasure, and instead of hopping on Amazon like a normal geek or venturing into the outside realm on a mid-level ‘store’ quest like a normal person, [cnlohr] decided to turn an ESP8266 into a USB keyboard and mouse. How hard could it be? The ESP doesn’t support USB, but bitbanging hasn’t stopped him before. The end result is a USB stack running on the ESP8266 WiFI module.
[cnlohr] has been working for about a month on this USB implementation for the ESP, beginning with a logic analyzer, Wireshark, Xtensa assembly, and a lot of iteration. The end result of this hardware hacking is a board based on the ESP8285 – an 8286 with integrated Flash – that fits snugly inside a USB socket.
This tiny board emulates low-speed USB (1.5 Mbps), and isn’t really fast enough for storage, serial, or any of the fancier things USB does, but it is good enough for a keyboard and mouse. Right now, [cnlohr]’s ESP USB device is hosting a webpage, and by loading this webpage on his phone, he has a virtual keyboard and mouse on a handheld touchscreen.
If you’re keeping track, [cnlohr] has now brought Ethernet and USB to a tiny microcontroller that can be bought for a few bucks through the usual online outlets. If you’d like to build your own ESP USB stick, all the files are over on the Gits.
Thanks [lageos] for the tip.
This thing could be VERY useful actually. It could easily replace my gyro mouse/keyboard/remote-thing that I use today with my htpc…
If he takes the time to fill out the usb spec to a functional level agreed. Its liable to play havoc on devices its used on if they send it a command its not prepared to handle as it stands with a quasi sw usb stack.
i have tried bitbanging USB on an ESP8266 before
it nearly gave me a stroke … cnlohr keeps doing amazing work!
So, 2 months would be $6, right?
I woulda reached for a 18f26j50 or similar, 18f14k50?
Also would have let microchip send me a sample.
That doesn’t have wifi.
should i have clarified 3 $ /more/?
Whoops, accidentally reported child comment. Sorry, Addidis :(. What I was going to reply with was: “$3 more, per project, times all the projects that will ever use espusb, which is like 10, so $30.”
twice for good measure.
Impressive. Well done. So next step is having this in nodemcu. It also allows you to connect a keyboard to an ESP chip, which can also be connected to a 128×128 display. Meaning you can direcly write your lua code on the ESP !
He has implemented USB gadget, not USB host, which is a somewhat different beast. Not dramatically, but still different.
Host is harder in this particular case. I don’t even know if USB hubs support low-speed hosts.
I see… But come on, a 2$ ;-) !
Hmm, can you give a link to the turn key solutions? My eBay searches seem to be coming up empty.
Stirred up a had troll lol.
I can imagine this being used like the USB Rubber Ducky.
Given its size and shape could just about be fitted inside the USB socket, it has NSA-like wireless exfil implant written all over it.
Or like USaBUSe (https://github.com/SensePost/USaBUSe) without the 32u4.
Why USB 1.1 only? ESP8266 seems to be much faster than AVR, I thought it was possible to do software USB 2.0 with it.
Timing constraints, keeping in mind that the ESP has to also service the 802.11 stack as well.
im not aware of anyone being able to get true USB 2.0 during pure bitbanging
Nothing is going to bit-bang anything at the requisite 480mbit/sec. That’s FPGA territory.
480 is right out, but 12 SHOULD have been possible except I didn’t consider the limitation of there being no queuing of GPIO reads, 17 clocks per GPIO read. No way that I can find to do it :(.
Achievement unlocked! :)
Fantastic work and respect for your perseverance. You must have learnt a lot about the USB protocol doing this making it a very worthwhile project.
well he taught himself “USB” this way and achieved his goal, so that should be worth something as well.
Wonder if it would be possible to bit-bang USB host as well, thus turning the ESP into a mouse and keyboard “logger”, except instead of logging you’re broadcasting blind across a network silent SSID. Could control it remotely as well.
*evil laugh* stick it together with a MAX3421 and put it inside a seemingly innocent USB hub.
I am beginning to realise I have a terrible curse, that prevents me from authoring 1337 hax… I seem to have this unfortunate ability to find what I want…. I go, “I need to write a …. oh there’s an app” … “I need a thing that… oh, this will work.”
Nice work! But seriously cnlohr, how do find the time for these epic hacks? Do you have a job, or are you rich?
I do have a full time regular job. I just don’t watch TV, netflix, play video games, or do much else like that. There is a LOT of free time if you’re only working 40/wk.
And there is the secret! Great job and I look forward to hearing about your next adventure.
Just out of curiosity what do you do cnlohr? :)
s/8286/8266
Or 0$ : just use a software on your PC and an app on your phone to turn your phone into a wifi touchpad/keyboard.
Props!
Why does something have to be directly profitable to be a good use of time? Would he be better off getting paid $20 an hour to stand in the supermarket and watch the self-service robots?
This is basically a 32bit DigiSpark with WiFi and integrated flash. It’s much more energy efficient than tacking on serial modules and now we can all downsize our projects.
If these start getting mass produced in china that’s saving all of us time and money. This is why we need to start using blockchains. Our money doesn’t actually signify worth anymore.
I came across this looking for a way to potentially create a wifi based KM switch. Essentially, using software on one system I would control one or more computers. While I’m aware that Synergy and other similar products exist… they all rely on communication with the remote system via IP… which may not be possible if that other system is on a VPN or not networked.
This could be a valid commercial use for something like this.