This has been around for a long long time now so it's super mature, and it's very cool! I've used it in the past to make some esoteric keyboard adapter.
You can do a lot with it, but you may run up against a ceiling once you've committed an AVR to V-USB use as the timing requirements even at low bit rates are very strict, and you might want to consider AVRs with built-in USB transceivers if this becomes limiting.
Many moons ago I "ported" V-USB to the Arduino platform (before any Arduino used an AVR with hardware USB support) & designed a small shield to enable the required hardware side:
As I recall it, mine was not the first ever port of V-USB to the Arduino but was IIRC the first released with source & schematic.
Fun times & enabled some fun example projects (e.g. keyboards, "encryption" dongle, dynamic product/vendor ID driver fuzzing) before hardware USB support became more common & affordable.
Not to put too fine a point on it, but how can it be “usb 1.1 compliant” while ignoring “communication errors”?
Most of the devils in the usb protocol, the kind people resort to usb analyzers for are usually related to communications error states and transitions in the protocol that aren’t being handled properly.
And a shameless plug for an app that I wrote that uses an Arduino to turn your laptop into a keyboard & mouse, so you don't have to carry around an external keyboard for your Raspberry Pi.
In practice I now use CNLohr's EspUSB because it's even smaller. I dug out the old KeyMouSerial code last week to turn a mouse scrollwheel and iPod clickwheel into a rotary encoder.
V-USB can do much more besides: actuators (power switch, DMX), sensors (thermo, hygro), chip programmers, LCD displays... there are 170 projects listed on the Obdev page.
I recently built a force feedback steering wheel from scratch, and used a 32u4 as the MCU. I started the project a few years years ago, but lost interest in favor of picking up 3D printing. It was a lot easier to finish now that I can make arbitrary 3D shapes. I ended up printing an inline 80:1 two stage gear reduction. Thankfully someone in 2020 implemented the HID PID stack for the 32u4. That dropped the firmware work from probably a month to only a few days. The AVR is a bit long in the tooth; I only get a few hundred loops per second while the USB stack is running. It's plenty fast enough for all the haptic effects to feel good, though. It helped to offload the quadrature decoding to a dedicated IC.
Years ago I made a control panel for Kerbal Space Program, and I used a V-USB based MCU to drive two analog voltage meters as fuel gauges. I also had an Arduino Uno in the control panel, but I used up every single IO pin on it doing a button matrix and LEDs. Enumerating the V-USB MCU is touchy, but once it's up it seems reliable enough to gamble Jeb's life with!
Is HID PID fully implemented on Windows / Linux (i.e. does it load a generic driver like USB ACM or USB HID mouse / keyboard). I remember that I looked into this, but couldn't find any recent devices that use this.
Yes, both windows and linux have generic driver support for USB force feedback devices. All the firmware needs to do is provide the appropriate HID descriptor. The tricky bit is that the windows driver doesn't fully comply with the protocol spec, though. So, vendors that rely on the generic driver implement their firmware to be out of spec so that their products work in windows. The linux driver is rather pedantic about the spec, and errors out during initialization if the firmware doesn't conform to it.
In order to get my wheel working on linux, I had to modify the arduino library to comply with the spec. It was clearly written to work with windows. I haven't tried it on windows yet, but I suspect that it wouldn't work. There are smaller wheel vendors with stale customer support tickets regarding linux incompatibility.
I assume this is one of the reasons that larger companies like Logitech provide their own custom drivers, despite being 90% compatible with the generic HID spec.
I'm loosely involved with the HapticsIF (https://hapticsif.org). They are working towards a new haptic usage page. If I remember the sentiment of those meetings correctly, USB PID was considered very old and not easy to work with. Besides that a more recent haptics Usage page was considered limiting (only for single effects).
The USB protocol and driver are more a means for me than an end. What you linked to looks like the userspace facing API, rather than the USB PID driver specifically. My goal was to get Euro Truck Simulator 2 working. Presumably it's using the FF API, either directly or perhaps through a steam proton adaptor.
I got Dirt Rally sorta working too, but it wasn't really playable because the game doesn't seem to support multiple input devices, and I wired up my pedals through a separate 32u4 MCU.
It's on my list of things to do, but I'm about 3 hobby projects behind documenting at the moment. :-)
The most interesting bit is probably the gearbox, since it's an 8:1 stage then a 10:1 planetary stage. It's all printed PLA, stainless steel bolts, and bearings from amazon. There's two motors (to make it look cool, since one motor with the 80:1 reduction is probably already excessive), and a 1024 count encoder on the sun gear, giving 40960 counts per wheel revolution. It's all designed around the mounting holes of the steering wheel I used, too, so it's very pretty.
The electronics are "boring" in that I used an Arduino Leonardo, a quadrature decoder IC, and a 13A rated H-bridge. The trickiest bit was adding a "braking resistor" to keep the power supply voltage from shooting up when applying deceleration torque.
1. Any ATmega32U4 development board. Most commonly sold as "Arduino Pro Micro". Developing a keyboard emulator in the Arduino IDE is pretty easy; if you don't want to do that, LUFA is a great little USB stack.
2. Raspberry Pi Pico. Newer, so it's less well documented, but much more powerful.
Yes, Arduino, Raspberry Pi, and ESP8266 are the best "cheap MCUs" for personal use, quick shipping, good documentation, for a one-off USB keyboard.
For the RPi Pico specifically, the TinyUSB driver is the way to go. This also supports USB host (plugging a keyboard into the Pico), but that didn't support the mouse scrollwheel when I tried.
If you're interested in larger-scale manufacturing, and are willing to invest more time and effort in once-off R&D to reduce the per-unit cost, then there's a lot more options of other MCUs (e.g. PIC, Cypress, STM32).
Mitch Davis gave a great talk at the Embedded Online Conference this year (which my wonderful manager assigned us time to watch during working hours!), where he bridges the gap between hobbyist Arduino development and professional Embedded engineering. (It's closer than you might think)
Miro Samek also has a great series of lectures (which I learned about in the same Embedded Online Conference), which then levels up from an Arduino-style "superloop" to an RTOS, Active Object design pattern, and beyond.
Welcome to embedded development, I hope you enjoy creating new gadgets, and don't forget to share your adventures with the community so we can encourage you along!
Slightly tangential, but I recently wanted a mechanical keyboard converter dongle with QMK.. the pro micro was there only viable option due to supported stacks.
I made such a thing using a board called "Teensy LC." I'm a long time user of Teensy boards for prototyping in an R&D environment, and the LC is the cheapest. My interest was just PgUp and PgDn buttons for a foot pedal page turner.
In addition, I programmed an ESP32 board to do the same thing, but as a Bluetooth keyboard. Both the Teensy and ESP32 can be programmed via the Arduino development environment.
Now there's cheap and there's cheap. The stuff I use is cheap in terms of, it won't break the bank for a R&D or hobby project. Then there's cheap in terms of wringing cost out of a commercial product, which I know little to nothing about.
> Then there's cheap in terms of wringing cost out of a commercial product
This is a very astute distinction that hobbyists wanting to go from Arduino to production often miss.
I went from the basically cost-unconstrained world of Medical Devices to wearable consumer sensors (e.g., heart rate monitors, etc.) and it was a bit of a shock to see just how much impact cost had. I mean, you know that in a "theoretical" sense, but it's completely different when you are dealing with it on a daily basis.
Thank you for commenting to ask your question, Hacker News does have many skilled people around from a variety of backgrounds including embedded systems! So your question is related.
The Edit feature is also very useful, and I often go back to add more details, like you added the (~$1) afterwards. In future, please can you write "Edit" when doing that? It appears that duskwuff has been downvoted, because they assumed that "cheap" meant for a personal hobbyist level, not a professional mass-produced level, and now their comment makes less sense because Arduino & RPi are more expensive than $1. Please do continue to use the Edit feature, it's cleaner than writing a new comment! Just please keep in mind how that affects others.
As for me, I use Arduino, RPi, and ESP8266 for personal use, and NXP i.MX RT1050 chips at work, all of which are outside the price range, so there's not much more I can say. I imagine that the chip shortage is raising many prices these days though.
> Thank you for puting the minimal circuit diagram right there.
And I thank them for it being a proper schematic.
Far too many projects nowadays just give a drawing that is essentially a picture of how the circuit would be built on a solderless breadboard such as this [1].
You can do a lot with it, but you may run up against a ceiling once you've committed an AVR to V-USB use as the timing requirements even at low bit rates are very strict, and you might want to consider AVRs with built-in USB transceivers if this becomes limiting.