8

The Arduino Nano (and other models) has a USB Connector on the pcb.

Can a Arduino Application (Code inside the loop() Function) communicate to a PC/Mac over the built in USB Channel?

Thomas
  • 1,545
  • 3
  • 14
  • 25
  • Absolutely, it is not difficult to take the LUFA project and turn it into a number of things. I have made the arduino look like a generic serial port so that I could communicate to my avr program on the board. Google arduino lufa... – old_timer Aug 15 '12 at 17:25
  • This is absolutely possible and there are some great suggestions below. Keep in mind that many Arduino boards have an auto-reset on serial (outside of the IDE) issue. I addressed this on a previous post here: http://stackoverflow.com/a/10921900/1440715 – ZnArK Aug 16 '12 at 15:12
  • dwelch appears to be referring to boards such as the Leonardo which use a USB-capable ATMEGA alone. More traditional Arduino boards use a dedicated USB-serial chip, or (on the Uno) an extra small USB-capable ATMEGA which is already configured to implement a USB-serial converter. The supplementary USB ATMEGA on the Uno can be reprogrammed to be a different sort of USB device either by itself or as a front end for the main ATMEGA 328p, but no work should be needed to make it appear as serial since it is programmed for that role from the Arduino factory. – Chris Stratton Aug 18 '12 at 14:45

2 Answers2

4

The board at the link you posted uses an FTDI USB to UART chip; the ATMega168 itself has no USB controller. The UART side of the FTDI chip is attached to the ATMega168's RXD/TXD UART pins. So from the point of view of the Arduino code, you are just communicating with a UART driven serial port.

From the PC end, the FTDI chip uses the USBSER.SYS driver to emulate a legacy UART serial port (A Virtual COM Port or VCP). You will be able to see this and which COM port it has been assigned to in Device Manager.

So in essence all you need to know is how to do serial port programming on both the PC and the Arduino and you are good to go.

Clifford
  • 88,407
  • 13
  • 85
  • 165
1

This is how I have done it. You also need to write a program to your computer - for POSIX-compilant OSes, this one could help you out.