Project

General

Profile

ComputerCommunication

If you want to have your project communicate with a computer, there are a number of ways to go about it.

Serial

The easiest and most common way is to use Serial (often called RS-422, TTL Serial). This will usually involve USB on the computer side. If your microcontroller has a USB serial port built in (most dev boards do), then it is as simple as plugging them in with a USB cable. If not, you will need the appropriate USB-Serial adapter. You will need some program on the computer to connect to.

Serial Connections

Both USB and Bluetooth support Serial. With USB, you can simply plug it in (and install drivers if necessary). With Bluetooth, once you've paired (and installed drivers), you may have one or more Bluetooth serial ports created. However, this will only work if your bluetooth device also supports Serial (not all do).

Serial Programs

(Software) Serial ports on the computer

On Windows, the serial ports will be named COM*, where * is some whole number. Every time you plug in a new device to a computer (or the same device to a different port), it is possible to get a new number. If you plug in the same device to the same port, it is likely to keep the same number.

On Linux, serial ports will show up as /dev/ttyUSB*, where * is some whole number.

Changing Port Number/Speed/Settings in Windows

  1. Open the start menu. Type and select Device Manager.
  2. Scroll down to Ports (COM & LPT) (if there is nothing connected, this won't be visible).
  3. Right click on the port you want to change. Select Properties.
  4. Switch to the Port Settings tab. From here, you can change the baud rate (Bits per second), and other control bits. The default for most devices is 9600 8-N-1, or 9600 Bits per second, 8 Data bits, None Parity, and 1 Stop bit.
  5. To change the port number, select Advanced, and pick the new number from the dropdown. Values marked as (in use) have been used by other devices plugged into your computer, but you are still free to use them (as long as that device is not currently plugged in).

Text/Mouse/Gamepad entry to a computer (HID)

Some embedded devices are capable of emulating a Keyboard, mouse, gamepad, or joystick. This could be useful if you want to have your device input text into arbitrary (or already existing) programs without having to modify the program on the computer. Tis is a protocol in USB and Bluetooth called HID (Human Interface Device). All existing keyboards & such support it, and a number of development boards do too. Read the documentation for each board (and it's language of choice) to send the relevant commands.

HID capable Dev boards (not all inclusive)

  • Arduino Leonardo
  • Arduino Due
  • TI Stellaris/Tiva C Launchpad
  • Teensy 2.0/2.0++/3.0/3.1
  • STM32 Discovery
  • Most ARM based dev boards