The Trinket has a USB port that is used for bootloading. But the Trinket can only become a low-speed USB device because of its limited hardware. USB standards prevents low speed USB devices to truly act as virtual serial ports, which is why we cannot use a serial terminal to communicate with the Trinket directly.
However, there's a work-around for this problem. In Windows, you can emulate a fake serial port bridge using a utility named com0com. In this tutorial, you'll see how we can write a middle-man program that communicates with the Trinket and com0com, so that a serial terminal (such as the one built into Arduino IDE) can talk with the other end of com0com.
The com0com code will only work on Windows computers - but we have some code that *might* work for Mac/Linux, check the last step of this tutorial
This code requires running at 16MHz, so it is only suggested for use with 5V Trinktets - 16MHz is overclocking on 3V and may not work or may be flaky!
There are two pieces of code involved here:
- Arduino library named TrinketFakeUsbSerial
- A PC app named TrinketFakeUsbSerialHostSW
The other pieces of software involved
LibUsbDotNet, which makes it easy for me to use libusb-win32 to write TrinketFakeUsbSerialHostSW for Windows
com0com, which emulates the two fake serial ports (only required on Windows)
- Some sort of serial terminal (Arduino IDE, Hyperterminal, Teraterm, RealTerm, Putty, etc)
Below is a diagram showing how data flows between the different components:
Below is a demonstration video (the code sketch is in the Usage Demo section of this tutorial, the video should be viewed in 720p and full screen if you want to read the text on screen)
Last updated on 2014-04-05 at 05.13.03 PM
Published on 2013-10-15 at 06.33.48 PM