> Next The Guile environment
< Previous Ubuntu

4.2 Connecting a USB-serial device

Bad things have been observed with USB serial devices. Suffice to say, one was bought for this project, and it works perfectly. The Ubuntu operating system had to be beefed up a little bit with a driver obtained over the internet.

To start with, plug your device in, and then type


at a terminal prompt. Look for a string along the lines of /dev/ttyUSB, and if you find one you are in business! Make a note of the exact file name.

The only thing left to do is check the speed of the serial link, and adjust if it is not correct. Find the speed by typing

stty -F /dev/ttyUSB0 (or whatever) speed

and set it if necessary with a command like

stty -F /dev/ttyUSB0 speed 115200

There are two problems with this scenario. First, you don’t want to have to go through this rigmarole every time you start the computer up or plug the serial device in. Second, the exact /dev/tty\* device used for the robot connection will vary depending on what other devices (memory sticks, mice) happen to be plugged in to USB ports at the time. So we want to arrange for the device to be attached to a file called /dev/robot0 (we append the ‘0’ just in case we ever get another of these things!), and for the baud rate to be set automatically by the Ubuntu operating system.

Locate the file /etc/udev/rules.d/robot.rules, and add the line (note this is a single line, and should not be broken up as seen here).

SUBSYSTEM=="tty", ACTION=="add", ENV{IDVENDOR_ID}=="067b", ENV{ID_MODELID}=="2303", SYMLINK+="robot", RUN="binstty -F $root$name speed 115200"<div>

< Previous Ubuntu
Copyright © 2010, 2012 DM Bespoke Computer Solutions Ltd
All rights reserved