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.
Continue reading “ESP32 Hosts A USB Keyboard In This Typewriter”