text message between two arduino?

Hello i was wondering if there was a way i can text message from one arduino to display on another arduino that is on a different network? and that second arduino can text back to the first arduino?

Do they know each other's IP address ?

I'm guessing need some kind of server between them maybe? so both arduinos can connect to the same system?

well I think Wifi is out if they are on different networks. Are you going to tell us if tgese 'networks' aee connected to the Internet ,?

yes they will be connected to the internet different internet connections.

Do they know each other's IP address?

I don't have nothing setup yet as far as this. is why I'm trying to figure this all out what would i need in sketch wise i have uno boards lcds key pads but not sure how to start this?

If you have nothing then I suggest you start by researching on google.

The UDP is ment to send data from one IP address to another.
http://arduino.cc/en/Reference/Ethernet

With two Arduino boards, each with an Ethernet Shield, both have an IP address.
This is no problem within your home network, but on a different network the internet-modem prevents to connect from the outside world to an Arduino in your home network.

You can open a port in the internet-modem, so that your Arduino gets an IP number on the internet.

Or you can have them both connect to a common server. How to use a common server depends on how you are going to implement it, but it probably won’t be UDP. It can be with PHP, or FTP, with email, or something else. Both Arduinos have to check the common server for new messages by polling.

hello thank you all for the information still looking into this i have found something setting up as a chat service http://arduino.cc/en/Tutorial/ChatServer it's a start i'm looking into right now. i would like to use my lcd on this to read the messages and also use a keypad to send message back yes it be a slower way to do things then a computer keyboard and a serial monitor on the computer screen but that is what texting is all about.

Hello i was wondering if there was a way i can text message from one arduino to display on another arduino that is on a different network? and that second arduino can text back to the first arduino?

You could use combined client/server code similar to the below test code (web page would not be required). You would probably need to use a dynamic IP service for each arduino if the connection is over the internet.

//zoomkat 10-02-14, combined client and server
//simple button GET with iframe code
//for use with IDE 1.0
//open serial monitor and send a g to test client GET and
//see what the arduino client/server receives
//web page buttons make pins high/low
//use the ' in html instead of " to prevent having to escape the "
//address will look like http://192.168.1.102:84 when submited
//for use with W5100 based ethernet shields

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //assign arduino mac address
byte ip[] = {192, 168, 1, 102 }; // ip in lan assigned to arduino
byte gateway[] = {192, 168, 1, 1 }; // internet access via router
byte subnet[] = {255, 255, 255, 0 }; //subnet mask
EthernetServer server(84); //server port arduino server will use
EthernetClient client;
char serverName[] = "checkip.dyndns.com"; // (DNS) dyndns web page server
//byte serverName[] = { 208, 104, 2, 86 }; // (IP) zoomkat web page server IP address

String readString; //used by server to capture GET request 

//////////////////////

void setup(){

  pinMode(5, OUTPUT); //pin selected to control
  pinMode(6, OUTPUT); //pin selected to control
  pinMode(7, OUTPUT); //pin selected to control
  pinMode(8, OUTPUT); //pin selected to control

  //pinMode(5, OUTPUT); //pin 5 selected to control
  Ethernet.begin(mac,ip,gateway,gateway,subnet); 
  server.begin();
  Serial.begin(9600); 
  Serial.println(F("server/client 1.0 test 9/02/14")); // keep track of what is loaded
  Serial.println(F("Send a g in serial monitor to test client")); // what to do to test client
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) 
  {
    byte inChar;
    inChar = Serial.read();
    if(inChar == 'g')
    {
      sendGET(); // call client sendGET function
    }
  }  

  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string 
          readString += c; 
          //Serial.print(c);
        } 

        //if HTTP request has ended
        if (c == '\n') {

          ///////////////
          Serial.print(readString); //print to serial monitor for debuging 

            //now output HTML data header
          if(readString.indexOf('?') >=0) { //don't send new page
            client.println(F("HTTP/1.1 204 Zoomkat"));
            client.println();
            client.println();  
          }
          else {   
            client.println(F("HTTP/1.1 200 OK")); //send new page on browser request
            client.println(F("Content-Type: text/html"));
            client.println();

            client.println(F("<HTML>"));
            client.println(F("<HEAD>"));
            client.println(F("<TITLE>Arduino GET test page</TITLE>"));
            client.println(F("</HEAD>"));
            client.println(F("<BODY>"));

            client.println(F("<H1>Zoomkat's simple Arduino 1.0 button</H1>"));

            // DIY buttons
            client.println(F("Pin5"));
            client.println(F("<a href=/?on2 target=inlineframe>ON</a>")); 
            client.println(F("<a href=/?off3 target=inlineframe>OFF</a>

")); 

            client.println(F("Pin6"));
            client.println(F("<a href=/?on4 target=inlineframe>ON</a>")); 
            client.println(F("<a href=/?off5 target=inlineframe>OFF</a>

")); 

            client.println(F("Pin7"));
            client.println(F("<a href=/?on6 target=inlineframe>ON</a>")); 
            client.println(F("<a href=/?off7 target=inlineframe>OFF</a>

")); 

            client.println(F("Pin8"));
            client.println(F("<a href=/?on8 target=inlineframe>ON</a>")); 
            client.println(F("<a href=/?off9 target=inlineframe>OFF</a>

")); 

            client.println(F("Pins"));
            client.println(F("&nbsp;<a href=/?off2468 target=inlineframe>ALL ON</a>")); 
            client.println(F("&nbsp;<a href=/?off3579 target=inlineframe>ALL OFF</a>")); 

            client.println(F("<IFRAME name=inlineframe style='display:none'>"));          
            client.println(F("</IFRAME>"));

            client.println(F("</BODY>"));
            client.println(F("</HTML>"));
          }

          delay(1);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin
          if(readString.indexOf('2') >0)//checks for 2
          {
            digitalWrite(5, HIGH);    // set pin 5 high
            Serial.println(F("Led 5 On"));
            Serial.println();
          }
          if(readString.indexOf('3') >0)//checks for 3
          {
            digitalWrite(5, LOW);    // set pin 5 low
            Serial.println(F("Led 5 Off"));
            Serial.println();
          }
          if(readString.indexOf('4') >0)//checks for 4
          {
            digitalWrite(6, HIGH);    // set pin 6 high
            Serial.println(F("Led 6 On"));
            Serial.println();
          }
          if(readString.indexOf('5') >0)//checks for 5
          {
            digitalWrite(6, LOW);    // set pin 6 low
            Serial.println(F("Led 6 Off"));
            Serial.println();
          }
          if(readString.indexOf('6') >0)//checks for 6
          {
            digitalWrite(7, HIGH);    // set pin 7 high
            Serial.println(F("Led 7 On"));
            Serial.println();
          }
          if(readString.indexOf('7') >0)//checks for 7
          {
            digitalWrite(7, LOW);    // set pin 7 low
            Serial.println(F("Led 7 Off"));
            Serial.println();
          }     
          if(readString.indexOf('8') >0)//checks for 8
          {
            digitalWrite(8, HIGH);    // set pin 8 high
            Serial.println(F("Led 8 On"));
            Serial.println();
          }
          if(readString.indexOf('9') >0)//checks for 9
          {
            digitalWrite(8, LOW);    // set pin 8 low
            Serial.println(F("Led 8 Off"));
            Serial.println();
          }         

          //clearing string for next read
          readString="";

        }
      }
    }
  }
} 

//////////////////////////
void sendGET() //client function to send and receive GET data from external server.
{
  if (client.connect(serverName, 80)) {
    Serial.println(F("connected"));
    client.println(F("GET / HTTP/1.1"));
    client.println(F("Host: checkip.dyndns.com"));
    client.println(F("Connection: close"));
    client.println();
  } 
  else {
    Serial.println(F("connection failed"));
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    readString += c; //places captured byte in readString
  }

  //Serial.println();
  client.stop(); //stop client
  Serial.println(F("client disconnected."));
  Serial.println(F("Data from server captured in readString:"));
  Serial.println();
  Serial.print(readString); //prints readString to serial monitor 
  Serial.println();
  Serial.println(F("End of readString"));
  Serial.println(F("=================="));
  Serial.println();
  readString=""; //clear readString variable

}

Hello zoomkat thank you i will look into that.

i looked into it some stuff. maybe over the network from one network to another might be a little to much. is there a way that can be done in the nrf24 modules i have a few i haven't seen anything yet.

Can you tell us more ? How long is the distance between them ? How much data do you want to transmit ? In both directions ? If different networks is a problem, can you reconnect an Ethernet cable to use the same network ? Or perhaps using wifi ?

The distance is like 200ft + maybe a little more not sure have to see. not much data sending text back and forth using keypads or maybe a small keyboard no computer. i don't have wifi at all but i do have nrf24l01 modules. but i can not do a long network wire because its going between 3 buildings mine and a my neighbers then my fathers and brothers.

200ft = 61 meters

Some RF modules do 100 meters, but those buildings are the problem. That may reduce to range to 50 meters. This is the Sparkfun RF buying guide : https://www.sparkfun.com/pages/wireless_guide

Here is a range test for the NRF24L01 : http://hallard.me/nrf24l01-real-life-range-test/ That might not be enough for you.

So far I think the best option is to open a port in one of the routers, and let one Arduido talk to the other over internet. The communication will be reliable and it will work.

i have the nrf modules with the antenna's on them with long antenna i got a lot of range not sure but i did seem to do a ping from one to the other that did work. but i don't know how to do like a text message send from one to another and send text back from the second one back to the first one. or at least send from the first one to the second one just to text see if text is working.

hey peter

i found this code for chatting from between one arduino to another using the nrf modules

//the same program will run on both the nodes.here any one can initiate the chat and any node can transmit or receive any number of messages in any order.
#include<SPI.h>
#include"nRf24L01.h"
#include"RF24.h"
#include"printf.h"
RF24 radio(9, 10);
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
bool go_to_tx_mode = false;
//bool go_to_rx_mode = false;
//bool go_to_serial_mode = true;
char input[32] = "";
void setup() {
  Serial.begin(57600);
  printf_begin();
  radio.begin();
  radio.enableDynamicPayloads();
  radio.setRetries(15, 15);
  radio.openWritingPipe(pipes[1]);
  radio.openReadingPipe(1, pipes[0]);
  radio.startListening();
  radio.printDetails();
  // put your setup code here, to run once:
 
}
 
void loop() {
  if (go_to_tx_mode)
  {
    radio.stopListening();
    bool ok = radio.write(input, 32);
    if (ok)
    {
      //printf("written successfully !!!\n");
      printf("ME : %s\n", input);
      go_to_tx_mode = false;
      radio.startListening();
    }
    else
      printf("could not write....\n");
  }
  if (radio.available())
  {
    char payload[32] = "";
    bool done = false;
    while (!done)
    {
      done = radio.read( payload , 32 );
      printf("HIM : %s\n", payload);
 
      //delay(20);//see you did this when you checked the getting started example but it is NOT AT ALL required.why?because after being in rx mode it will go in serial mode and wait for our input so the other unit has sufficient time to go in tx mode !!
    }
 
  }
 
  //if(go_to_serial_mode)//having this makes the program extremely stable, just having an if block starting with serial.available is unstable.it will not take untimed serial inputs.
  //{
  if (Serial.available())
  { //try with local "input" variable too by passing a pointer to tx function.
    int len = Serial.readBytesUntil('\n', input, 31);
    input[len] = '\0';
    go_to_tx_mode = true;
    //go_to_serial_mode = false;
  }
  //}
 
}

i uploaded the sketch on both systems and then open serial monitors i typed on my dekstop and it showed on my laptop then i triend on my laptop type a text it showed on my desktop it worked the first 2 text on the desktop and 2 on the laptop but when done it for the third time i get this error ( could not write… ) and it keep coming up not stopping so i get like this

( could not write… )
( could not write… )
( could not write… )
( could not write… ) into at least 50 times then i closed out the serial monitor then i tried on my desktop a third time and same thing i get that error not sure what’s going on. i try to reupload the sketch same thing worked 2 times then does the same thing on desktop and laptop.

This library ? http://maniacbug.github.io/RF24/

I don't know that library and I can't find a simple driver yet that is simple and up to date.

this is where i got the sketch and library from

http://shantamraj.wordpress.com/2014/07/20/a-better-chat-program/

library is from https://github.com/maniacbug/RF24Network

it also uses the printf.h library too i got from

https://github.com/maniacbug/IcyArduino

i just took the printf.h file and put it into the nrf library folder