8. The 3pi+ 32U4 USB interface
Our 32U4 family of boards are based on a single ATmega32U4 AVR microcontroller that runs the user program and also handles the USB connection to the computer. The AVR has a full-speed USB transceiver built into it and can be programmed to present almost any type of USB device interface to the computer.
USB is an asymmetric system that consists of a single “host” connected to multiple “devices”. The host is typically a personal computer. The ATmega32U4 can only act as a USB device, so an A-Star device cannot be connected to other USB devices like mice and keyboards; it can only be connected to a host such as your computer.
Programming an ATmega32U4 board using the Arduino IDE as described earlier will automatically configure it as a composite device with a single virtual serial port. If you program the microcontroller with an Arduino sketch that implements another USB device class, like HID or MIDI, you will see additional child devices as well.
On a Windows computer, you can see the virtual serial port by going to your computer’s Device Manager and expanding the “Ports (COM & LPT)” list. You should see a COM port labeled “Pololu A-Star 32U4”. In parentheses after the name, you will see the name of the port (e.g. “COM3” or “COM4”). Windows will assign a different COM port number to the device depending on what USB port you plug it into and whether it is in bootloader mode or not. If you need to change the COM port number assigned to the A-Star, you can do so using the Device Manager. Double-click on the COM port to open its properties dialog, and click the “Advanced…” button in the “Port Settings” tab. From this dialog you can change the COM port assigned to the device.
Windows 10 Device Manager showing the A-Star’s virtual COM port.
On a Windows computer, you can see the rest of the USB interface by going to the Device Manager, selecting View > Devices by connection, and then expanding entries until you find the “Pololu A-Star 32U4” COM port. Near it, you should see the parent composite device.
The Windows 10 Device Manager in “Devices by connection” mode, showing that the A-Star is a composite device.
On a Linux computer, you can see details about the USB interface by running
lsusb -v -d 1ffb: in a Terminal. The virtual serial port can be found by running
ls /dev/ttyACM* in a Terminal.
On a Mac OS X computer, the virtual serial port can be found by running
ls /dev/tty.usbmodem* in a Terminal.
You can send and receive bytes from the virtual serial port using any terminal program that supports serial ports. Some examples are the Serial Monitor in Arduino IDE, the Pololu Serial Transmitter Utility, Br@y Terminal, PuTTY, TeraTerm, Kermit, and GNU Screen. Many computer programming environments also support sending and receiving bytes from a serial port.