Pular para o conteúdo principal

Seeeduino Ethernet

enter image description here

Seeeduino Ethernet é uma plataforma de desenvolvimento compacta e multifuncional, que reúne registro e processamento de dados, controle de dispositivos e comunicação Ethernet em um único produto. Ela é equipada com um chip MEGA328P e um Wiz5100: o primeiro fornece um estilo de controle tipo Arduino e o segundo fornece capacidade de comunicação Ethernet TCP e UDP. Além do módulo de cartão SD integrado, é conveniente e organizado para registro remoto de dados, processamento ou transferência via rede.

Nesta versão, reduzimos a altura do RJ45 para equilibrá-lo com os headers. Além disso, com uma porta Grove I2C e uma UART populadas, é conveniente conectar os módulos Grove correspondentes a esta placa.

enter image description here

Especificação


  • Tensão: 6,2–13 V

  • Corrente: 140–550 mA

  • Tipo de cartão compatível: cartão Micro SD(deve ser SanDisk), FAT/FAT32 (mais de 2G não é garantido)

  • Conexões compatíveis: TCP/UDP

  • Peso líquido: 23±2 g

  • Conector Ethernet: RJ45 padrão

Demonstração


Vamos testar as funções do Seeeduino Ethernet de gravar ou ler informações do cartão SD e enviar dados A/D para a rede. enter image description here

Etapa 1: Instalar o hardware

Primeiro, instale o hardware. Temos duas alternativas para conectar a alimentação.

Método 1: você pode usar um Passive PoE Cable Set para fornecer alimentação e conexão Ethernet ao mesmo tempo, como na imagem abaixo.

enter image description here

Método 2: usar cabo de alimentação e cabo Ethernet separados.

enter image description here

Etapa 2: Programação

Após a instalação do hardware, vamos continuar e testar o código de exemplo. Este programa foi escrito para testar as funções de gravação ou leitura de dados do cartão SD e de envio de dados A/D para a rede. Este código de demonstração pode ser usado como um programa de teste, bem como referência caso você queira explorar mais funções da placa.

AVISO:
  1. Todos os arquivos ".h" necessários já foram pré-instalados na Arduino IDE(1.0).

  2. Instale um cartão Micro SD. Certifique-se de que o cartão Micro SD não esteja cheio e de que o formato seja FAT ou FAT32.

/*
SD card read/write

This example shows how to read and write data to and from an SD card file
The circuit:
* SD card attached to SPI bus as follows:
** MOSI - pin 11
** MISO - pin 12
** CLK - pin 13
** CS - pin 4

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 4 Sep 2010
by Tom Igoe

*/

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

// 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);

File myFile;

void setup()
{
Serial.begin(9600);
Serial.print("Initializing 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);
// pinMode(4,OUTPUT);
if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");

// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.

myFile = SD.open("test.txt",FILE_WRITE);
// if the file opened or created okay, write to it:
if (myFile) {
Serial.print("Writing to test.txt...");
myFile.println("testing 1, 2, 3.");
// close the file:
myFile.close();
Serial.println("done.");
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}

// re-open the file for reading:
myFile = SD.open("test.txt");
if (myFile) {
Serial.println("test.txt:");

// read from the file until there's nothing else in it:
while (myFile.available()) {
Serial.write(myFile.read());
}
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
}
unsigned char buff[6];
void loop()
{
EthernetClient client = server.available();
if (client) {
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
// 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();

// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(analogRead(analogChannel));
client.println("<br />");
buff[analogChannel] = analogRead(analogChannel);
}
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();
myFile = SD.open("test.txt", FILE_WRITE);
if (myFile) {
Serial.println("test.txt:");
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
myFile.print("analog input ");
myFile.print(analogChannel);
myFile.print(" is ");
myFile.println(analogRead(analogChannel));
}
// read from the file until there's nothing else in it:
myFile.close();
}
else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}

myFile = SD.open("test.txt");
if (myFile) {
Serial.println("test.txt:");

// read from the file until there's nothing else in it:
while (myFile.available()) {
Serial.write(myFile.read());
}
// close the file:
myFile.close();
}
else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}
}

Etapa 3: Fazer o download do programa

Como não há conector USB na placa, o Seeeduino Ethernet requer um UartSBee para fazer o download do programa.

Conecte o UartSBee ao Seeeduino Ethernet como abaixo:

enter image description here

enter image description here

nota

Selecione Seeeduino V3.0 como placa no menu Tool para fazer o download do programa.

Etapa 4: Teste de resultado

AVISO: Certifique-se de que o Seeeduino Ethernet e o seu computador estejam na mesma rede local. Depois que o programa for baixado, abra o Serial Monitor. Você irá verificar o status da placa.

enter image description here

Abra um navegador web e digite o endereço:192.168.1.177, então você poderá verificar os dados enviados pelo Seeeduino Ethernet:

enter image description here

Visualizador online do esquemático

Recursos

Suporte Técnico & Discussão de Produto

Obrigado por escolher nossos produtos! Estamos aqui para fornecer diferentes formas de suporte para garantir que sua experiência com nossos produtos seja a mais tranquila possível. Oferecemos vários canais de comunicação para atender a diferentes preferências e necessidades.

Loading Comments...