Seeeduino XIAO keeping the height and footprint as small as possible & retrieving time from the PC over USB

Hi everybody,

as the titel says: I want a keep the height and footprint of a Seeeduino XIAO as small as possible & retrieving time from the PC over USB.

So the ideal solution for this would be to not add an RTC or any kind of battery but just keeping the supertiny footprint and 4mm flatness of the pure XIAO plug it into an USB-port and the XIAO is receiving actual time from the PC over USB.
Ideally without any special software running on the PC.

The final purpose of all this is to automate a two factor-authentification that uses Time-based One-Time Password algorithm specified in RFC 6238

into a "plug in the physical key" solution.

The time-basing requires actual time as a must. So does somebody know how to retrieve the PC-Time over USB?

I know Of course with deviating from the requirements mentioned above I can do it:

  • run a partner-software on the PC that uses a serial port to deliver the time-information

  • using an ESP32 that connects to the WiFi whIch immidiately sets the ESP32's RTC to actual time but how would I make the ESP32 make act like a USB-HID-Device?

  • increasing the footprint and the height through combining a ESP32 (for retrieving the time over WiFi) with a XIAO to act as the HID-device


  • maybe acting the ESP32 is acting as a as a bluetooth-keyboard?

best regards Stefan

I don't believe that this is possible. USB is very much a Host-side driven sort of thing. A USB device can't really "retrieve" arbitrary information from the PC, and I don't think I've seen anything that includes sending high-accuracy time.

Hi westwf,

so what approach would you recommend?

installing a small windows-App that is looking for Comports becoming available and then send some "Hello are you the XIAO-Thing?" requests waiting for answers?

best regards Stefan

Sending stuff down "Serial" ports can be dangerous (if it's NOT your device, opening the port could prevent some other program from grabbing it, and sending it data could do weird things.) (OTOH, a program should be able to identify it as a Xiao...)
I believe you should be able to get the Xiao to indentify itself as a "Human Interface Device (HID)" (basically, something mouse-like), at which point you can write a PC-side program that uses "libusb" to send it arbitrary data (this is how the "usb programmers" that don't show up as a serial port work.)
That would take somewhat more complex PC-side programming, I guess (the advantage of a serial port is that lots of programming languages can access a com port "just like a file", while dealing with libusb is harder.)

If the PC sends a request to the XIAO and the XIAO has to give a correct answer before more communication is done this is secure enough for me.

best regards Stefan