Arduino+PC modem

Hi, I would like to connect an Arduino to a serial PC modem. My idea is sending AT command by the use of Arduino's serial interface. I have read something about RS-232 and I think there should be a problem if I try to make the connection directly (PC serial port works at higher voltage than Arduino's one, so serial modem should work at higher voltaje too) However, I found this link (http://www.arduino.cc/es/Tutoriales/SMS) where there is a direct connection between Arduino and a serial gps modem. Can I try a direct serial connection or do I try using a max232 or something like that.

Thanks in advance.

Can I try a direct serial connection

Depends on the model of Arduino; with the current NG (USB interface) model, only if you'd like a serving of fried Arduino. Well, you may not damage it, but at the very least it won't work.

Can I try a direct serial connection or do I try using a max232 or something like that.

Yes, you need something to convert both the levels (rs232 levels are inverted compared to TTL) and the voltages. The MAX232 is my favorite chip for doing that, but there are other chips and other methods, including using transistors and stealing the correct voltage from the other device (look at the arduino serial for an example of this).

However, I found this link (http://www.arduino.cc/es/Tutoriales/SMS ) where there is a direct connection

The Arduino in this example is the serial Arduino, and it has a true rs232 interface.

-j

Thanks kg4wsv a lot. I will use MAX232 (my first time) As you pointed out, If I try to make the connection using a MAX232, levels are inverted. Does it mean if I want to send an AT command to the modem I will have to invert the ASC buffer? I mean (not tested code):

char a = "A";
char t = "T";
char s = " ";
...
a = ~a;
t = ~t;
s = ~s;
...
Serial.print(a); Serial.print(t); Serial.print(s); ...

Bye

Does it mean if I want to send an AT command to the modem I will have to invert the ASC buffer?

No! The MAX232 doesn't invert the signal, it converts it from TTL to RS232 levels, and vice versa. When I mentioned inverting, I mean that the logic 1 for TTL is +5V, but the corresponding signal for rs232 is MARK, at -10V (and a TTL 0 is +10V rs232); we tend to think of that as inverted.

Do nothing in software; the hardware deals with it.

For an example connection between and Arduino serial and a computer's COM port, a typical serial logic high signal will start out as a +5V TTL signal leaving the Atmel's pin 3 (arduino pin 1). The transistor network on the Arduino serial will convert that +5V TTL signal to the corresponding RS232 MARK -10V, making the -10V signal available on the DB9 connector. At the PC end, the -10V rs232 MARK will be converted back to a TTL level logic 1 (probably not +5V on modern systems, probably 3.3V or less).

All you want in software is Serial.print("AT ");.

-j

Ok. I have just bought a MAX232 and I'm going to start the test. I forgot to say I have a NG Arduino (USB) so I will use TX an RX pins. Thanks a lot.

Finally I connect Arduino to a MAX232 and MAX232 to a serial PC modem. But... It doesn't works because there isn't any comunication between Arduino and Modem. I don't know where the problem is.

Arduino is feeded with USB and I have connected:

| [u]Arduino[/u] | [u]MAX232[/u] | [u]PC modem (DB9)[/u] | | - | - | - | | RX | Pin 9 | | | TX | Pin 10 | | | | Pin 7 | Pin 2 | | | Pin 8 | Pin 3 | | | | Pin 5 to GND | | | | Pin 1, 4 and 6 (together) | | | | Pin 7 and 8 (together) |

It's more or less like this scheme: http://www.gsmhacking.com/help/cables/alcatel/AlcatelOneTouchEasy-db.gif

This is the program:

void setup()                    // run once, when the sketch starts
{
  beginSerial(9600); 
}


void loop()                     // run over and over again
{

    if(digitalRead(pinSwitch) == LOW) {
        Serial.println("ATDT 555123123");
    }

}

But RD and SD leds in the modem don't blink. However, If I connect the modem to the PC serial port, open HyperTerminal and send the same command, leds blink (At least, there is a comuntication)

Modem model is an external US Robotics and Arduino is NG model.

:(

hi

it's probably protocol-related. every time I have tried to make something like this work, I've had to spend time researching the particular requirements of the thing I want to talk to. So the modem in this case probably needs some set up characters to open the connection, or some particular hardware configuration. Do you have specs on the modem?

D

The modem may be expecting some hardware flow control signals that the Arduino doesn't provide. If it does expect hardware flow control, it's either waiting for the arduino to give it permission to transmit, or it's ignoring what the arduino is transmitting because the arduino isn't announcing that it's going to transmit.

You may want to construct a cable with pins 1-4-6 connected and pins 7-8 connected on the modem end of the cable as shown here. If you are using a 25 pin connector those pin numbers will be different.

-j

it's probably protocol-related. every time I have tried to make something like this work, I've had to spend time researching the particular requirements of the thing I want to talk to. So the modem in this case probably needs some set up characters to open the connection, or some particular hardware configuration. Do you have specs on the modem?

Yep, it's pobably a particular hardware configuration problem because when I use HyperTerminal (COM1) sending "ATDT 555123123", the modem tries to dial that number.

The modem may be expecting some hardware flow control signals that the Arduino doesn't provide.

I think this is the problem but...

You may want to construct a cable with pins 1-4-6 connected and pins 7-8 connected on the modem end of the cable as shown here.

The cable has already 1-4-6 and 7-8 pins connected (loop back handshaking) so I may take a look at the "Compatibility Issues" on the web that you pointed out.

Thanks.