Forum >How to build a wifi connection between 2 wifi shield TEL0079
ArduinoGeneral

How to build a wifi connection between 2 wifi shield TEL0079

userHead Grey.CC 2015-08-04 23:54:43 2451 Views1 Replies

Generally, a lot of customers met a problem with how to make a wifi connection between two wifi shield TEL0078/TEL0079. I checked the shield and did a test with the new firmware. Yes, you're right. It is a trick firmware.
This firmware makes the web setting different to the old version. That was very confused in the first time.
O.K. Let's begin.

What you need:
wifi shield x2
DFRduino Uno x2
USB cable x2




STEP 1: Set your network parameter (This part would be finished on my phone browser)
Follow the wiki guide to set the STA mode: AP+STA
Scan the around network, and input the wifi password
Save and Restart



STEP 2: Connect to your PC
In the first step, I change the default setting with my phone browser. Now I will get its IP address in the SYSTEM menu.

Input Ip address on your PC browser. You'll get the same interface.




Step 3: Set Network parameter
Go to NETWORK menu,(It should be Other Setting in the old version), and change the SOCKET_A SETTING and disable SOCKET_BSETTING
It will be a trick time now. You need to set the different parameter for the different character.
For Server:

For Client

Save and reboot
Now, you will get a confusion with Socket_B. But I have to say, I also have no idea about it. I guess this firmware makes it support master and slave in the same time, it should be a new feature. I guess it will be very interesting, since maybe it support a mesh network (Just guess!)



Step 4: Testing Code
Server:
 

Code: Select all//server testing code
#include <Metro.h>
Metro server = Metro(500);
int ledPin=13;   // LED pin: D13
int val;         
int count=0;


void setup()
{  
  Serial.begin(115200);  //baudrate
  pinMode(ledPin,OUTPUT);  
}

void loop()
{
  if (server.check() == 1)
  {
    Serial.print("a");
  }

  if(Serial.available()>0)
  {
    char val=Serial.read();
    if('b'==val){
      if(count==0)count=1;
      else if(count==1)count=0;
    }


    if(count==0){
      digitalWrite(ledPin,HIGH);  // Turn ON
      //     Serial.println("LED ON");
    }
    else if(count==1)
    {
      digitalWrite(ledPin,LOW);  // Turn OFF
      //   Serial.println("LED OFF");
    } 
  }
}

 



Client:

 

Code: Select all//server testing code
#include <Metro.h>
Metro server = Metro(1000);
int ledPin=13;   // LED pin: D13
int val;         
int count=0;


void setup()
{  
  Serial.begin(115200);  //baudrate
  pinMode(ledPin,OUTPUT);  
}

void loop()
{
  if (server.check() == 1)
  {
    Serial.print("b");
  }

  if(Serial.available()>0)
  {
    char val=Serial.read();
    if('a'==val){
      if(count==0)count=1;
      else if(count==1)count=0;
    }


    if(count==0){
      digitalWrite(ledPin,HIGH);  // Turn ON
      //     Serial.println("LED ON");
    }
    else if(count==1)
    {
      digitalWrite(ledPin,LOW);  // Turn OFF
      //   Serial.println("LED OFF");
    } 
  }
}
 




Actually they are almost same, just change the interval time and sending char.

STEP 5 Watch the result
For now, everything has been prepared. Just watch will be enough.
When you find Server LED lights each second, but Client LED lights twice each second. It means they are working now. If you power off client port. Server LED status will be also stop changing

icon client.png Download(0)
icon information.png Download(0)
icon wifi testScreenshot_2015-08-04-14-50-05.png Download(0)
icon wifi testScreenshot_2015-08-04-14-50-11.png Download(0)
icon wifi testScreenshot_2015-08-04-14-33-25.png Download(0)
icon wifi testScreenshot_2015-08-04-14-38-15.png Download(0)
2015-08-05 01:08:50 ATTENTION:

1. The Switch should be in the "ARduino" side, when you run the code
2. In the sample test, there are two shields in all: 192.168.1.3 and 1.92.168.1.4
3. Most people are stuck in the NETWORK setting!
4 Please leave your comments If I dfrobot something.
userHeadPic Grey.CC