Standalone Serial communication vith USB (uC -> PC)

I want to build a small PCB for doing the following thing.
I have a +5V DC trigger Signal that I want to use to start a script on my computer.

At the moment I use a multimeter with a PC Link USB cable to do so, but this I s an overkill and is really expensive if I need to set up more tests.

Now I thought about using the VUSB Library and sending e.g. the "H-Key" when the signal is high and the "L-Key" when the signal is Low, but that's not a nice solution.
I would love that the Atmega328 sends out serial data for example each 100ms.
"5.0V" for high and "0.0V" for low.

What would I need to do this.

I think I need an Atmega328, a USB-Wire for sure, and some kind of USB to serial translation. But I never did this before.

Would be great if you could help me.


Do you really want to build something, there are a few boards (also small ones) that do what you want.

The Arduino Leonardo uses the ATmega32u4, that chip has a usb interface and can be used as a (virtual) serial port, but also as a keyboard or mouse. The Arduino Micro is a smaller version of the ATmega32u4 and there are other boards, even smaller.

The Trinket is super small, and it uses the ATtiny85, which has also that usb interface. I think it can also be a keyboard. And there is a Trinket Pro with ATmega328P with V-USB, and there is more...

My advice is to use the Leonardo to make it work, and when you are happy with it, you can use a smaller board instead.

I would love that the Atmega328 sends out serial data for example each 100ms.

But that is exactly what the Arduino - such as a Nano - already does. It connects to a USB virtual COM/ serial port and sends whatever you program it to.

The only requirement is that you attach a terminal or application session to that virtual COM port, which appears to be precisely what you want - and which is what the Serial Monitor in the IDE does for the development phase.

You do not - in this case - want a virtual HID (keyboard./ mouse) because that presumes your program always has console focus, which is generally rather inconvenient as it prevents you from making any other use of the PC at the time.

What you do not want to do, is to go and make your own board for this purpose. It is not in any way worth the bother - just wire in a Nano (smaller than a UNO and immediately solderable connections)

Trinket was mentioned. There is also a new Pro Trinket that is a 328P.
The Pro Micro would do the trick as would the larger Leonardo.
You might also look into the Digispark as it, like the Trinket, is a tiny85.

IMO, the simplest small solution is the Nano.