Landline Dialup Modem Configuration

My current Arduino project involves replacing an existing antiquated device with Arduino processors. The existing system (without going into too much detail) covers a large geographic area and communicates via landline phone lines and dialup fax modems. When my project came to the point that I needed to address my communications issues, I searched all over the web and found very little help because the preferred method for connecting Arduinos through the telephone system is wireless. So with some help from a co-worker, we figured it out and I’m posting this topic to help others who are in need of a similar solution.

The board that I am using is the Arduino MEGA 2560. It is connected to a MAX232 chip which is in turn soldered via cable to a male DB9 connector. Next is an adapter (female DB9 to male 25 pin) which serves at the input for a 56K Faxmodem…which connects the system to the phone line. The Faxmodem I used was USRobitics Model 5686G which is available through for $77.80 and can be seen at the following link:

That is the remote location setup. The remote locations send data to…let’s call them offices. At the office is another faxmodem connected to a PC. Ideally an event occurs at the remote site such as temperature dropping 5 degrees so the MEGA causes the remote faxmodem to call the office faxmodem and once connected, delivers a data string which in turn shows on the PC in the Hyper Terminal window.

Ok, let’s get into the wiring diagram.

On the DB9 connector pins 4 and 6 are shorted and pins 7 and 8 are shorted. The wiring of the MAX232 is pretty straight forward except that since we are connecting to a male DB9, pins 13 and 14 of the chip connect to pins 2 and 3 respectively of the DB9. This is backwards from what most online wire diagrams show (I assume because they are connection the chip to a female DB9). A cheap toggle switch is placed between Vcc and a grounded 10K resistor to turn the function on and off. I realize this could be a push button but I already had the toggle in place so that’s what I used. Lastly is a light emitting diode between ground and pin 13 of the MEGA to show you that S1 is either open or closed.

Now let’s look at the sketch. I used the example sketch labeled Digital Button and just modified it where needed

const int buttonPin = 5;     // the number of the S1 pin 
const int ledPin =  13;      // the number of the LED pin

int buttonState = 0;         // variable for reading the S1 status
int a = 0;                   // variable for keeping the program from looping repeatedly

void setup() {
  // initialize the LED pin as an output:

  pinMode(ledPin, OUTPUT);      
  // initialize the S1 pin as an input:
  pinMode(buttonPin, INPUT);     
  Serial.begin(9600);      //MEGA comunicates with PC at 9600 
  Serial3.begin(9600);   //MEGA comunicates with Faxmodem at 9600

void loop(){
  // read the state of the S1 value:
  buttonState = digitalRead(buttonPin);

  // check if the S1 is closed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
    if (a == 0)    //so we only run PrintToFax() one time per cycle
      a = 1;
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
    a = 0;

void PrintToFax(){      
      Serial3.print (F(" "));  //required to wake-up the Faxmodem
      Serial3.println(F("ATD1234567890"));  //replace numbers 1-0 with the number to be dialed
      delay(20000);   //if monitoring the receiving modem via Hyper Term
      Serial3.println(F(“testing”));   //if you are monitoring the receiving modem via Hyper Term

One other thing is that there are a series of 8 dip switches on the modem; switches 1, 3, and 8 need to be in the down position and all the rest are left in the up position.

And there you have it. I know that there are less expensive modems available and someone more experienced than me who may be able to do this better, cheaper or faster. This was just our initial shot at it with available parts.

Photos of the project did not transfer to this posting so I’ve attached my original word doc which contains those pictures and the all important diagram. :slight_smile:

Arduino Modem 01.docx (521 KB)

What is function "F" that is used for the input to Serial3?
I tried using Software Serial, and tried plain read and write
(with the characters). Didn't see anything, so am guessing
the function F does something. Does anyone know?

Towards the bottom of the page.

More information...

Thanks ...