DIY mechanics and electronics projects

DIY mechanics and electronics projects

Google Search

WebThis site

Buy me a Beer :)

This web page is run by me on my spare time. If you find any of the information useful and worth a couple of bucks, I will be very grateful if you buy me a beer by donating a small amount using the PayPal link below :)

Amount: 

DIY Roomba USB interface cable
DIY Roomba USB interface cable - USB adapter Print E-mail
User Rating: / 3
PoorBest 
Article Index
DIY Roomba USB interface cable
USB adapter
SCI control software
Connecting to STK500
All Pages

USB adapter

More and more computers now are delivered without an RS232 serial port as USB has been the preferred serial interface for years. One option for interfacing the Roomba to a USB port is to use a USB-to-RS232 adapter. This would convert the USB protocol to RS232 protocol and signal levels. Then you must use a RS232 interface to convert from RS232 levels to the Roombas 5 volt logic.

A more elegant solution would be to convert directly from USB to the 5V logic required by the SCI interface. Several dedicated USB to UART bridge ICs that do exactly this are available, for instance from FTDI chip. But as an hobbyist it is of course even more fun to make this using only a standard microcontroller.

On Atmels web page you can find the AVR309 application note implementing an USB (1.1) to UART bridge using only passive components and software running on an ATtiny2313 AVR microcontroller. The implementation does not support the windows CDC class, so it requires a dedicated driver. But both the driver and an sample application are available from Atmel so it is very easy to get started. Also as the Rooma commands are outside the ASCII table (ASCII use the values 0 to 127, Roomba 128-256) you would in any case need a dedicated application, as a terminal and keyboard only can input codes from 0 to 127.

The schematic of the AVR309 solution is shown below (cut from Atmels Appnote).

 

AVR309 schematics

 

Note that this schematic has one error: There should be a couple of 12-22pF capacitors connected to the crystal to ensure oscillation. Connect one capacitor to each end of the crystal. One pin at the crystal and the other at ground.

 

Xtal capacitors

 

Also it is recommended to connect a pull-up resistor to the reset line of the AVR. Anything from 1 to 47Kohms would be fine.

Note that the AVR will drive its pins at 3,5V, not 5 V, but as the SCI interface use TTL levels any voltage above 2,0V will be detected as a logic '1'. As the TxD pin from the Roomba is driven at 5 V a current limiting resistor bust be connected between SCI TxD and the USB interface RxD to avoid destroying the AVRs input protection diodes. The voltage difference between Roomba and the AVR is 1,5V. So if we add a series resistor of 1K-1,5Kohm this would reduce the current flowing into the AVR input protection diode to 1,5-1mA, low enough to ensure no damage to the AVR from the 5V TxD signal.

 

connections

 

Compile the assembly code from the AVR 309 zip archive and program the resulting hex file into the AVR. Or you can download the compiled hex file here:

download
AVR309.hex

Note: Remember to select the correct fuse settings, especially to set the clock option to external crystal>8MHz.

Now plug the circuit to your PCs USB port. You will be asked to install a driver, and this can be found in the same archive file as the source code in the folder \code\AVR309_USB\Driver.

On the next page I will present a control software that I have made to control the Roomba trough the SCI interface.



 
 
Joomla 1.5 Templates by Joomlashack