Two Arduinos or arduino and PC ??? Serial receive....

I have a pair of Arduinos sending/receiving environmental data using RF24. Unfortunately the RF24 library and the Arduino Ethernet shield libraries collide and I haven't gotten them to coexist.

What I want to do is create a webpage that displays the data that is accessible from my smartphone browser on the home network. I could send the data to the home PC, and using a database and a Web Server accumulate and display the data, but that seems like way to much overkill.

I know someone has done something like this with the Ethernet shield, but i just can't find it on the web. The sticking point for me is receiving the serial data on the Arduino with the Ethernet shield.

Arduino/radio receiver --serial--> Arduino/Ethernet shield--HTTP--> smartphone.

Any examples?

You can get RF24 and the Ethernet library to work together. Show us your code and we try to help you. Most probably you just have to make sure the SPI bus is in the correct configuration for each device when accessing it.

The sticking point for me is receiving the serial data on the Arduino with the Ethernet shield.

Test code with client, server, and serial functions.

//zoomkat 7-03-12, combined client and server
//simple button GET with iframe code
//for use with IDE 1.0
//open serial monitor and send an g to test client and
//see what the arduino client/server receives
//web page buttons make pin 5 high/low
//use the \ slash to escape the " in the html 
//address will look like http://192.168.1.102:84 when submited
//for use with W5100 based ethernet shields
//note that the below bug fix may be required
// http://code.google.com/p/arduino/issues/detail?id=605

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
IPAddress ip(192,168,1,102); // ip in lan
IPAddress gateway(192,168,1,1); // internet access via router
IPAddress subnet(255,255,255,0); //subnet mask
//IPAddress myserver(208,104,2,86); // zoomkat web page
EthernetServer server(84); //server port
EthernetClient client;
String readString; 
char serverName[] = "web.comporium.net"; // zoomkat's test web page server

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

void setup(){

  pinMode(5, OUTPUT); //pin 5 selected to control
  Ethernet.begin(mac,ip,gateway,gateway,subnet); 
  server.begin();
  Serial.begin(9600); 
  Serial.println("server/client 1.0 test 7/03/12"); // keep track of what is loaded
  Serial.println("Send an g in serial monitor to test client"); // what to do to test client

  /*if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }*/

}

void loop(){
  // check for serial input
  if (Serial.available() > 0) 
  {
    byte inChar;
    inChar = Serial.read();
    if(inChar == 'g')
    {
      sendGET(); // call 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.println(readString); //print to serial monitor for debuging 

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

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

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

            client.println("<a href=\"/?on\" target=\"inlineframe\">ON</a>"); 
            client.println("<a href=\"/?off\" target=\"inlineframe\">OFF</a>"); 

            //client.println("<IFRAME name=inlineframe src=\"res://D:/WINDOWS/dnserror.htm\" width=1 height=1\">");
            client.println("<IFRAME name=inlineframe style=\"display:none\" >");          
            client.println("</IFRAME>");

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

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

          ///////////////////// control arduino pin
          if(readString.indexOf("on") >0)//checks for on
          {
            digitalWrite(5, HIGH);    // set pin 5 high
            Serial.println("Led On");
          }
          if(readString.indexOf("off") >0)//checks for off
          {
            digitalWrite(5, LOW);    // set pin 5 low
            Serial.println("Led Off");
          }
          //clearing string for next read
          readString="";

        }
      }
    }
  }
} 

//////////////////////////
void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0");
    client.println();
  } 
  else {
    Serial.println("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();
    Serial.print(c);
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop();

}

zoomkat thank you for the serial example - it will be most useful

Pylon: Trust me - I have spent days looking into why the nrf24l01/RF24 Library and the Ethernet library won't work together, you are correct it has something to do with the SPI setup, if both libraries are included and you try to start the Ethernet card - you get one string(sometimes) - then nothing - total lock. The nrf24l01 or the Ethernet card grabs or holds some signal line and/or in general do not play nice with each other (kinda like two three year old and a new toy). I finally admitted defeat and am coming at the problem from a different angle.

Pylon, Can you give us suggestions or example of running Ethernet and RF24 libraries together. I need to do this very soon for another project.

Thanks! And maybe Maniacbug is listening??

I don't have the hardware to try RF24 but I had a project where I needed two different SPI devices running in different modes and speeds (Ethernet shield and a FastSPI_LED string in this case). This is how I realized that:

byte saved_spcr = 0;
byte saved_spsr = 0;
byte led_spcr = 0;
byte led_spsr = 0;

void setup() {
  Ethernet.begin(mac, ip, dnss, gw, subnet);
  server.begin();
  saved_spcr = SPCR;
  saved_spsr = SPSR;
  digitalWrite(LED_SS, LOW);
  FastSPI_LED.setLeds(NUM_LEDS);
  FastSPI_LED.setChipset(CFastSPI_LED::SPI_WS2801);

  FastSPI_LED.setDataRate(3);
  FastSPI_LED.init();
  FastSPI_LED.start();
  digitalWrite(LED_SS, HIGH);
  led_spcr = SPCR;
  led_spsr = SPSR;
}

void loop() {
  SPCR = saved_spcr;
  SPSR = saved_spsr;
  
  EthernetClient client = server.available();
  if (client) {
    // ...
  }
  SPCR = led_spcr;
  SPSR = led_spsr;
  digitalWrite(LED_SS, LOW);
  FastSPI_LED.show();
  digitalWrite(LED_SS, HIGH);
}

So, effectively it's just saving the content of the two SPI registers (SPCR and SPSR) after the initialization of each library and resetting them to that value before every call to one of the library's functions.