Go Down

Topic: Simple serial problem. . .hopefully (Read 638 times) previous topic - next topic

ceady

I have two push buttons which when pressed send a set of commands out the serial port.  When the arduino is connected via usb cable and viewing the serial communications in hyperterminal everything looks great.  When I connect the arduino through the tx and rx pins to a usb to serial connector and view in the hyperterminal I get this "_aÖö+?å" or this "_aÖö+?å" depending on which button is pressed.  Any ideas on what is going on here?  Bad usb to serial converter (I just bought it, a Belkin F5U109)?  Here is the code which I think is fine but just in case.

Thanks in advance for any help.  

int sensePin2 = 2;
int sensePin3 = 3;
int value2=0;
int value3=0;  



void setup() {
 Serial.begin(9600);
 // read from the sense pin
 pinMode(sensePin2, INPUT);
 pinMode(sensePin3, INPUT);

}

void loop() {
 value2 = digitalRead(sensePin2);
 value3 = digitalRead(sensePin3);
 if (value2==1) {
   Serial.print("A=01 M=0");
   Serial.print("\r");
   value2=0;  
  delay(1000);
 }
 if (value3==1) {
   Serial.print("A=01 M=3");
   Serial.print("\r");
   value3=0;
   delay(1000);
 }
 
}

kg4wsv

Did you wire the USB/232 adapter's DB9 straight to Arduino pins 0 and 1, or did you use a level converting transceiver?

-j


Adilson Akashi

Quote
When I connect the arduino through the tx and rx pins to a usb to serial connector and view in the hyperterminal I get this "_aÖö+


Did you connect only tx and rx pins? Did you forget to connect the GND pin?
PCB Designer

ceady

#3
Jun 22, 2008, 04:36 am Last Edit: Jun 22, 2008, 04:42 am by ceady Reason: 1
pins 0 and 1 straight to db9 on the usb/232 adapter.  proper pins are grounded.  I did not use a level converting transceiver. . .didn't think I needed one.  Do I?

Thanks

On second thought the Belkin has a ADM211 chip which is a "+5V CMOS RS-232 200kBPS Transceiver with 4 Drivers, 5 Receivers" so that should take care of the transceiver i would think.


Adilson Akashi

Sorry,
I didn't understand before.

The TX and RX of Arduino is TTL level (0 or 5 volts).
The RS232 is -15/+15 volts
The USB is (+5volts) data.

Your connections won't  work because you must convert the TTL to RS-232 level. You cannot connect RX and TX directly to your RS232-USB adapter.
You're working with 3 types of signal (TTL/RS232/USB), but you have only one adapter (RS232 to USB).
You must use a TTL to RS232 converter between TX/RX and your RS232/USB adapter, or use a TTL/USB adapter, directly from Arduino RX/TX to USB.
PCB Designer

bens

Quote
pins 0 and 1 straight to db9 on the usb/232 adapter.

You could pretty much destroy those pins by doing this.

ceady

Thanks for the help.  So if I understand correctly the FTDI chip on the arduino takes care of the TTL to USB conversion.  The serial communications from the atmel can only communicate directly with another serial port using TTL.   Finally I need to convert TTL to RS-232 if I want to use the USB to serial adapter.

So one last question. . .any recommendations for a TTL to RS232 IC?

Thanks

Craig


Adilson Akashi

The cheapest IC for TTL to RS232 is the MAX232. You can find many circuits using this IC in this forum or in google search.

In this forum you can find discreet components (without IC) solutions too, like this:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1200792122

And if you don't need/want to use the USB to Serial adapter, you can find TTL to USB cables. Just google "serial to ttl".
PCB Designer

Go Up