Serial Communication

See practical how-to for USB-serial conversion

Serial= bits traveling one by one over a line

Aynchronous= no clock line,

Two parties know several communication parameters:

Then they can coordinate some communication

Many devices connected to desktop computers today are serial: phones, PDAs, etc. So you can connect to these as well.

Voltage level

2 lines (serial and ground) needed for 1-way communication

3 lines (RX, TX, ground) needed for 2-way communication


Typical serial setups


DB9 connector


Serial monitors


Serial Communication in Java

In java, setting up almost any kind of communication boils down to getting an InputStream and an OutputStream.

http://java.sun.com/products/javacomm/

A how-to:

Example

Arduino serial

Arduino uses its serial port for programming (during bootloader run), and communication (incl. debugging)

If you need more serial ports, use SoftwareSerial (has limitations!)

The led blink counting blinks out on serial

If using the standard 0 and 1 ports (not USB)


BASIC Stamp serial


SunSPOT serial communication

 

SunSPOT radio communication

See example , save it in se/kth/csc/CommLecture.java

Several protocols accepted:

Radio properties can be changed per connection, or only for the whole system:

Other issues

Data format (binary, ascii)

Synchronization, protocol

Serial timeout / freeze, buffers


Other communication modes

Many boil down to serial.

IRda

Bluethooth

Ethernet-serial, WLAN-serial

I2C