Bluno Accessory Shield 扩展板

简介

W5500以太网扩展板是DFRobot Ethernet家族的新成员,其集成PoE电源和W5500以太网芯片,能够满足一般IoT项目的应用要求。

在性能上,W5500 集成了 TCP/IP 协议栈,10/100M 以太网数据链路层(MAC) 及物理层(PHY),使得用户使用单芯片就能够在他们的应用中拓展网络连接。支持全硬件TCP/IP协议栈,支持TCP,UDP,IPv4,ICMP,ARP,IGMP 以及 PPPoE 协议。内嵌 32KB收发缓存以供以太网包处理。这将会比其他嵌入式以太网方案,更加快捷、简便。此外W5500主控板使用了一个新的高效SPI协议,支持80MHz通信速率,从而能够更好的实现高速网络通讯。而且W5500还提供了网络唤醒模式(WOL)及掉电模式,能够有效减少系统能耗,供您更方便的选择使用。

在外形和功能扩展上,W5500 PoE以太网扩展板集成了符合IEEE 802.3at行业标准的PoE Class 0电源等级,MicroSD卡座以及标准的Gravity-4 Pin I2C接口2个,UART 接口1个,Gravity-3 Pin数字模拟接口各4个,产品大小与UNO尺寸相等。

产品使用注意事项

特性

应用领域

技术规格


接口定义

板子已额外引出pin11,12方便连接w5500复位引脚。板子附带跳帽,如果不使用w5500复位功能请拔除跳帽,以免影响引脚的正常使用。

以太网使用教程使用教程

准备

连线

烧录程序

在WebServer 样例代码起始处添加复位管脚初始化代码并烧录。


/*
  Web Server

 A simple web server that shows the value of the analog input pins.
 using an Arduino Wiznet Ethernet shield.

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 * Analog inputs attached to pins A0 through A5 (optional)

 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe

 */

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

#define SS     10U    //W5500 CS
#define RST    11U    //W5500 RST

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 1, 177);

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup() {

  pinMode(SS, OUTPUT);
  pinMode(RST, OUTPUT);

  digitalWrite(SS, LOW);

  digitalWrite(RST,HIGH);  //Reset this module
  delay(200);
    digitalWrite(RST,LOW);
  delay(200);
  digitalWrite(RST,HIGH);
 delay(200);
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  //while (!Serial) {
  //  ; // wait for serial port to connect. Needed for Leonardo only
  //}


  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
}


void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    //Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");// the connection will be closed after completion of the response
          client.println("Refresh: 5");  // refresh the page automatically every 5 sec
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            int sensorReading = analogRead(analogChannel);
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(sensorReading);
            client.println("<br />");
          }
          client.println("</html>");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    Serial.println("client disconnected");
  }
}

POE功能接线图

非POE功能接线图

结果

打开浏览器->输入IP地址->回车打开网页就可以看到板子6路模拟口输入值在网页上按5S/次的频率自动刷新显示,此时说明我们创造的一个小型Web Server已经正常工作了。

异常情况解决办法

对于计算机浏览器出现“网页无法加载”问题的小伙伴儿先不要着急,请按照以下步骤配置你的网络适配器:

1、打开控制面板-->网络和 Internet-->网络和共享中心-->更改适配器设置

2、找到你连接模块的网络-->右键-->属性-->在网络选项卡中找到“Internet协议版本4(TCP/IPv4)"并双击进入属性设置

3、输入下图所示参数并点击确定。在此之后再打开浏览器输入IP地址回车打开网页就行了....

接下来....... 小伙伴儿们,充分发挥你们的想象吧.....

单独使用MicroSD卡教程

准备

连接示意图

烧录程序

打开Arduino SD库中自带的样例程序 "examples\SD\CardInfo",点击上传。


    /*
      SD card test

     This example shows how use the utility libraries on which the'
     SD library is based in order to get info about your SD card.
     Very useful for testing a card when you're not sure whether its working or not.

     The circuit:
      * SD card attached to SPI bus as follows:
     ** MOSI - pin 11 on Arduino Uno/Duemilanove/Diecimila
     ** MISO - pin 12 on Arduino Uno/Duemilanove/Diecimila
     ** CLK - pin 13 on Arduino Uno/Duemilanove/Diecimila
     ** CS - depends on your SD card shield or module.
            Pin 4 used here for consistency with other Arduino examples


     created  28 Mar 2011
     by Limor Fried
     modified 9 Apr 2012
     by Tom Igoe
     */
     // include the SD library:
    #include <SD.h>

    // set up variables using the SD utility library functions:
    Sd2Card card;
    SdVolume volume;
    SdFile root;

    // change this to match your SD shield or module;
    // Arduino Ethernet shield: pin 4
    // Adafruit SD shields and modules: pin 10
    // Sparkfun SD shield: pin 8
    const int chipSelect = 4;

    void setup()
    {
     // Open serial communications and wait for port to open:
      Serial.begin(9600);
       while (!Serial) {
        ; // wait for serial port to connect. Needed for Leonardo only
      }


      Serial.print("\nInitializing SD card...");
      // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
      // Note that even if it's not used as the CS pin, the hardware SS pin
      // (10 on most Arduino boards, 53 on the Mega) must be left as an output
      // or the SD library functions will not work.
      pinMode(10, OUTPUT);     // change this to 53 on a mega


      // we'll use the initialization code from the utility libraries
      // since we're just testing if the card is working!
      if (!card.init(SPI_HALF_SPEED, chipSelect)) {
        Serial.println("initialization failed. Things to check:");
        Serial.println("* is a card is inserted?");
        Serial.println("* Is your wiring correct?");
        Serial.println("* did you change the chipSelect pin to match your shield or module?");
        return;
      } else {
       Serial.println("Wiring is correct and a card is present.");
      }

      // print the type of card
      Serial.print("\nCard type: ");
      switch(card.type()) {
        case SD_CARD_TYPE_SD1:
          Serial.println("SD1");
          break;
        case SD_CARD_TYPE_SD2:
          Serial.println("SD2");
          break;
        case SD_CARD_TYPE_SDHC:
          Serial.println("SDHC");
          break;
        default:
          Serial.println("Unknown");
      }

      // Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
      if (!volume.init(card)) {
        Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
        return;
      }
      // print the type and size of the first FAT-type volume
      uint32_t volumesize;
      Serial.print("\nVolume type is FAT");
      Serial.println(volume.fatType(), DEC);
      Serial.println();

      volumesize = volume.blocksPerCluster();    // clusters are collections of blocks
      volumesize *= volume.clusterCount();       // we'll have a lot of clusters
      volumesize *= 512;                            // SD card blocks are always 512 bytes
      Serial.print("Volume size (bytes): ");
      Serial.println(volumesize);
      Serial.print("Volume size (Kbytes): ");
      volumesize /= 1024;
      Serial.println(volumesize);
      Serial.print("Volume size (Mbytes): ");
      volumesize /= 1024;
      Serial.println(volumesize);


      Serial.println("\nFiles found on the card (name, date and size in bytes): ");
      root.openRoot(volume);

      // list all files in the card with date and size
      root.ls(LS_R | LS_DATE | LS_SIZE);
    }


    void loop(void) {

    }

打开串口监视窗:

免责声明

DFRobot致力于为广大客户提供最好的各类电子套件,在上文中所描述的所有参数均为我们在自己的实验环境下测出的“典型”参数值,这意味着在不同的应用环境中上述参数会有所不同。因此,DFRobot对上述描述之完整性与准确性将不作任何承诺。应用实例所描述也仅为作为演示。DFRobot保留进行更改而不另行通知的权利。 未经DFRobot书面许可,该产品禁止于任何可能造成人身威胁或生命维持系统中使用,若因此造成重大人身伤害或死亡,DFRobot将拒绝承担任何责任。 DFRobot产品一般不用于军事应用,产品尤其不得应用于大规模杀伤性武器系统之中,包括(但不限于)核、生物化学武器或导弹等各种大规模杀伤性武器。

常见问题

还没有客户对此产品有任何问题,欢迎通过qq或者论坛联系我们!

更多问题及有趣的应用,可以 访问论坛 进行查阅或发帖。

更多

DFshopping_car1.png DFRobot商城购买链接