USB host shield on Espruino: Part 6
As it's Sunday and we've been having really great weather here in Wales lately, I spent most of the day in the garden and on the beach and not in front of the computer. This means there's no new code today, but I did want to jot down a few notes on why I decided to use a USB host controller chip (and not a Raspberry Pi) for connecting to USB devices.
I think it would be pretty easy to connect to USB devices from the Raspberry Pi's USB On-The-Go (OTG) port, and there are existing USB drivers for most serial port chips in the Linux kernel. The Pi Zero W also has Bluetooth LE and WiFi, so you can transmit data read from the USB device to a server or to a phone.
I guess I am looking for a bit more of a challenge and want to answer the question: Can a bare-metal approach to connecting USB devices work more reliably than building something on top of an operating system? Since the USB controller chip lets me develop both my own USB stack and USB drivers without having to mess around with an operating system, I'm hoping that it will result in something more reliable than the sometimes flaky USB support on desktop computers.
Modern computers are optimised for USB 3, with USB 2 support usually quite buggy, especially on new MacBooks. Many diabetes devices are still USB 2, due to the long product life cycles of medical devices, so not having good USB 2 support can be a problem.
Of course, there is power consumption as well. A Raspberry Pi consumes a significant amount of power compared to a little microcontroller with a USB controller chip. I want to see if I can build something that runs off a small LiPo battery, or maybe even a couple of coin cell batteries, that can eventually fit into a small dongle form factor. Let's see what happens.