Pages: [1]   Go Down
Author Topic: Simple serial problem. . .hopefully  (Read 539 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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);
  }
  
}
Logged

0
Offline Offline
Faraday Member
**
Karma: 7
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Brazil
Offline Offline
Sr. Member
****
Karma: 0
Posts: 443
..., to learn, to know, to make, to share, to l...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

PCB Designer

0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

« Last Edit: June 21, 2008, 09:42:55 pm by ceady » Logged

Brazil
Offline Offline
Sr. Member
****
Karma: 0
Posts: 443
..., to learn, to know, to make, to share, to l...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

PCB Designer

Las Vegas, NV
Offline Offline
God Member
*****
Karma: 0
Posts: 507
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
pins 0 and 1 straight to db9 on the usb/232 adapter.
You could pretty much destroy those pins by doing this.
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Brazil
Offline Offline
Sr. Member
****
Karma: 0
Posts: 443
..., to learn, to know, to make, to share, to l...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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".
Logged

PCB Designer

Pages: [1]   Go Up
Jump to: