my project is about wireless sensor-based, I m using 3 nano Arduino and 1 uno Arduino board. considering node1, node 2, node 3 and base node, below I mentioned all the details.
node 1- nano arduino+nrf24l001+PIR motion sensor
node 2-nano arduino+nrf24l001+ultrasonic sensor
node3 -nano arduino+nrf24l001+flame sensor
base node -uno arduino+nrf24l001+lcd display+ ethernet shield
I succeeded in sending and receiving text messages through nrf24l001 wireless communication through pipes ., the problem I faced is how to display it through ethernet shield to HTML, below mentioned link is the code details for the base node and transmitter node.
https://drive.google.com/open?id=1qWMLheqx-Ks_I2Hz0Ee3OhYn1OIqMKfx
error is
https://drive.google.com/open?id=13jAkb03uJ09mc7LtDs7SB8Qfi2fHyqYE
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Ethernet.h>
#include <RF24_config.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
RF24 radio(7, 8); // CE, CSN
char Data1 = "";
char Data2[32] = "";
char Data3[32] = "";
char Data4[32] = "";
const uint64_t pipes[4] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL, 0xF0F0F0F0E4LL };
//int LEDpir = 4; // green
//int LEDultra = 2; // red
//int BUZfire = A0; // Fire
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x85, 0xD9 }; //physical mac address
byte ip[] = { 192, 168, 137, 177 }; // ip in lan
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
byte gateway[] = { 192, 168, 137, 1 }; // default gateway
EthernetServer server(80); //server port
void setup()
{
lcd.begin(16, 2);
Serial.begin(9600);
digitalWrite(10,HIGH);
radio.begin();
radio.setDataRate(RF24_250KBPS);
radio.openReadingPipe(1, pipes[1]);
radio.openReadingPipe(2, pipes[2]);
radio.openReadingPipe(3, pipes[3]);
radio.startListening();
Ethernet.begin(mac,ip,gateway,subnet); // initialize Ethernet device
server.begin(); // start to listen for clients
}
void loop()
{
if (radio.available())
{
char text1[32] = "";
radio.read(&text1, sizeof(text1));
Serial.println(text1);
Data1=text1;
}
{
EthernetClient client = server.available(); // look for the client
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connnection: close");
client.println();
/*
This portion is the webpage which will be
sent to client web browser one can use html , javascript
and another web markup language to make particular layout
*/
client.println("<!DOCTYPE html>"); //web page is made using html
client.println("<html>");
client.println("<head>");
client.println("<title>Ethernet Tutorial</title>");
client.println("<meta http-equiv=\"refresh\" content=\"3\">");
/*
The above line is used to refresh the page in every 1 second
This will be sent to the browser as the following HTML code:
<meta http-equiv="refresh" content="1">
content = 1 sec i.e assign time for refresh
*/
client.println("</head>");
client.println("<body>");
client.println("<h1>Sensor network</h1>");
client.println("<h2>Monitoring</h2>");
client.println("<body bgcolor=#354166 text=white>"); client.println("</body>");
client.println("<table border=1 cellpadding=10 bgcolor=blue>");
client.println("<tr><th>Node Number</th><th>---------Status----------</th></tr>");
client.println("<tr><th>");
client.println(1);
client.println("</th><th>");
client.println(Data1);
client.println("</th></tr>");
client.println("<tr><th>");
client.println(2);
client.println("</th><th>");
client.println(Data2);
client.println("</th></tr>");
client.println("<tr><th>");
client.println(3);
client.println("</th><th>");
client.println(Data3);
client.println("</th></tr>");
client.println("</table>");
client.println("</body>");
client.println("
");
client.println("</html>");
delay(1); // giving time to receive the data
/*
The following line is important because it will stop the client
and look for the new connection in the next iteration i.e
EthernetClient client = server.available();
*/
client.stop();
} }
Thank you
Ranjith