Go Down

Topic: Serial over USB? (Read 1 time) previous topic - next topic


I just got an Arduino USB Board.  Since the board has a built in usb to serial converter, is it possible to interface with the board over the USB connection?  Or do I need to build my own RS232 circuit and hook into the ATmegas TX/RX pins?

I am trying to get the arduino to talk to a perl program on a linux box.



The USB on the Arduino is connected to an FTDI USB to serial bridge chip which is in turn connected to the RX and TX pins of the ATmega8. You will need the FTDI driver as well as the general USB drivers on your linux box. It will depend on your distribution, but you probably need to insmod the usbserial and ftdi_sio kernel modules. These will create new serial devices in your /dev directory.

If you do decide to connect RS232 to the tx and rx pins, then you will need a level shifting circuit to handle the relatively high voltages of rs232.

(Caveat: I haven't actually attached an Arduino to any of my linux machines.)


On many distributions, the needed drivers/kernel modules are installed and loaded, so you just need to plug the Arduino board in and you'll get a serial device in /dev (usually ttyUSB0, I think).  Can you program the board from Linux?  


I can program it from linux.  No problem.  I am using the code from:

I fired up minicom.  When I type in minicom, the RX led on the arduino lights up, but the TX led never lights up.  I am using pin 7 for TX.  does that sound correct?



Got it to work with this:
#include <stdio.h>
#include <string.h>

char incomingByte;              // for incoming serial data
char str1[50];
int count = 0;

setup ()
 beginSerial (19200);
 digitalWrite (13, HIGH);      //turn on debugging LED

loop ()
 // send data only when you receive data:
 if (Serial.available () > 0)
     // read the incoming byte:
     incomingByte = Serial.read ();
     str1[count] = incomingByte;
     if (count > 49 || incomingByte == 10 || incomingByte == 13)
         Serial.print ("\nmy string is ");
         Serial.print (str1);
         count = 0;

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131