Did you know the ESP32 can be a USB host? Well it can, and [Volos] uses host mode to build this fun little word processor.
The venerable ESP32 has a well-known USB device mode. Anyone who has programmed one has used it. A bit less known is the microcontroller’s ability to host USB devices. These days, operating as a USB device is relatively simple. But acting as a host is a much more complex task. The ESP32 has a software host that works — but only for Human Interface Devices (HID). Human interface devices generally are keyboards, mice, trackballs, and similar devices that handle data relatively slowly, forming the interface with us simple humans.
[Volos] uses the EspUsbHost Arduino library for this project. The library makes USB host mode simple to use. Another piece of the puzzle is the LCD board [Volos] picked. It has a dual-role USB Type-C port, meaning the hardware to switch roles is baked in. Other boards may require some modifications or special cables to make things work.
The software is the best part of this build. [Volos] implemented a simple word processor. It can save and load files from a microSD card and, of course, edit text — all controlled by a USB keyboard. He had to use a 4-bit palette to save memory. This gives the device a retro charm that reminds us of Don Lancaster’s TV Typewriter. The source for this and all of [Volos] projects can be found on GitHub. Now, all we need is a spell check that can fit in the memory constraints of the ESP32! We have to admit the chip has a lot of potential USB tricks.
There are few ESP32 boards that have separate USB HID connector port which enable this.
I’ve used PS/2 keyboards as they can be interfaced even to 8-bit Atmegas (no need for USB HID). Pretty nice way to add versatile input to your project and without worry to run out of buttons!
Are you referring to to the boards with two USB ports (jtag and UART)? I’ve wondered what the purpose of the second port was used for.
I believe one port is usually through a serial chip. Which is nice for debugging and programming since the serial won’t disconnect when the esp32 is reset like the USB CDC ones do.
I have a RP2040 USB Host board from Adafruit, using scroll lock to toggle a USB kbd between pass through and embedded function input, have an OLED display plugged into it to use for menus and kbd input (see what you type). When switching modes with Scroll Lock, it flashes Scroll Lock LED when keystrokes are directed at embedded functions… Like Pwd hotkey mapping setup or HDMI switching (optocoupled) or “thing” interfacing.
You should clarify which esp32 chip this is.
The original esp32 (the only one that actually goes by just esp32) does not have any usb hardware on board. Programming is over a usb-serial converter board.
As such “The venerable ESP32 has a well-known USB device mode. Anyone who has programmed one has used it.” Is not accurate.
You should clarify which esp32 chip this is.
The original esp32 (the only one that actually goes by just esp32) does not have any usb hardware on board. Programming is over a usb-serial converter board.
As such “The venerable ESP32 has a well-known USB device mode. Anyone who has programmed one has used it.” Is not accurate.
Agreed, this info should have been included in the article.
Based on the EspUsbHost GitHub repo, it seems to be the ESP32-S3 variant, so it definitely has more advanced features than the OG model.
ESP32-S3 has dedicated USB pins D+ and D-. He has used ESP32-S3 for this project. We have also used ESP32-S3 for USB keyboard. ESP32Wroom can also be used for USB keyboard but it is a work around and not much reliable for excessive keyboard use. But if the use on USB keyboard is less than ESP32wroom rx tx can be a used you run a USB keyboard.
I always wanted an esp32 that could plug into a computer over USB to provide an rndis connection. Ultimately the esp32 would give a wireless bridge of sorts. I tried to build this but hardware was limited at the time. This project gives me a bit of hope for such a device.
I have a similar setup with the Lichee RV nano except it drives a LCD display and provides the necessary USB host capability to use a keyboard and hub for USB disks.
It runs Linux and does pretty well with Emacs.
It didn’t solve my perceived writers block but it is fun to use at the coffee shop on the weekend.
WOW, Don Lancaster’s TV typewriter. Now that is a blast from the past. I actually built one in the day….
What it the lowest spec microcontroller/board that can directly interface with a USB keyboard and no extra components? By low spec, I mean low power. Plus enough memory to actually run something like a minimal word processor.
Adam, please learn the difference between a text editor and a word processor.
A text editor edits text. You use it to modify plaintext config files, for example xorg.conf in older versions of Puppy Linux that use that file to set up X11, or autoexec.bat and config.sys in MS-DOS. You also use it to create things like bash scripts, or as a minimalist programming editor if you’re one of those people who just can’t code in a real IDE for some reason (and that reason isn’t that, like me, you’re hopelessly incompetent outside of, essentially, the old 8/16bit versions of MS BASIC).
A word processor processes words. It’s generally capable of simple page layout stuff, although something like Adobe InDesign is very much required for the pro-level stuff in that regard. But you can usually do (clumsy) tables and image insertion and columns. At the very least, you have something like early versions of Microsoft Write, the sort you’d see bundled with Windows 3.1 or Windows For Workgroups 3.11, an RTF-compatible word processor that had support for multiple fonts, bold/italic/underline, paragraph formatting, that sort of thing.
I have a hardware word processor from 1989. It has a Z80 CPU of… some speed, RAM, it’s basically a minimal computer, with specs somewhat comparable in the modern day to a TI graphing calculator. The display is a 9in paperwhite CRT, and it has a built-in printer that’s pretty basic, it’s a daisy-wheel job. As such, there’s only one ‘font’ (‘typestyle’ would be a more correct term, really, at that point), but you DO get bold and underline… I can’t remember if it has italic or not… and you get paragraph layout stuff as well.
What this guy’s got is a text editor that wants to be a word processor. Even HE calls it a text editor! But it’s more like one of those FocusWriter things, a text editor for authors that are too stubborn to learn that a major part of writing in this day and age really does include learning some semblance of desktop publishing, however minimal. (I’m working on a novel series myself, and I can’t STAND things like FocusWriter. Gotta have that page layout stuff, gotta have text formatting.) It’s about on par with early, early instances of EDIT.COM, from like MS-DOS 3.3 or so, in that it can edit entire text files, but you don’t get much more than a backspace key and load/save. Even my Panasonic can delete a file, and that’s more than Volos can claim in his.
But, then, the guy’s honest about what he’s got, and what he doesn’t have. I have to say, Adam, while I appreciate your enthusiasm, you’re really overselling what’s been done here — especially considering the display board he’s using has the ESP32 built in, which you don’t make clear (like many folks, I assumed it was a thing you added an ESP32 to, until I watched the video), and it’s no less than $50 plus shipping from the original manufacturer… $40ish on shAmazon and fleaBay, if you’re willing to chop a couple inches of screen size off, since they only have the 5in display and not the 7in. For that price I can get an old netbook and a copy of Xubunto 2018, or a slightly less old netbook and a copy of Linux Mint, and get a heck of a lot more for my money than just 1/4 of LibreOffice…