Xboard Relay - An Ethernet Controllered Relay
SKU:DFR0222
Contents
1 Introduction
2 Specification
3 Pinout
4 Sample Code
4.1 Preparation
4.2 Step 1: Connections
4.3 Step 2:Download
4.4 Check that it works
5 Relay module Application examples
Introduction
Internet of thing is becoming so easy. With Xboard Relay, you can not only monitor data through
internet, but also control it through internet. The Xboard Relay combines an Atmega 32u4
microprocessor and wiz5100 chip which is fully compatible with Arduino Lendardo and Ethernet
library, it has build-in Xbee socket and 2 Relays which allow an easy play sensoring and controlling
over internet.
Not like previous X-board, X-board relay has no programming adapter required. A micro usb cable is
the only hardware needed to upload sketch.
Specification
MCU:Atmega 32u4
Clock Speed:16 MHz
Flash Memory:32 KB (ATmega32u4) of which 4 KB used by bootloader
SRAM:2.5 KB (ATmega32u4)
EEPROM:1 KB (ATmega32u4)
Ethernet Chip:Wiz5100
Power Supply:7.2-12V
USB Supply:Micro USB@5V
Pin out:2 Analog/1 I2C/4 Digital Pin Out
Relay Information:
Rated through-current: 10A (NO) 5A (NC)
Maximum switching voltage: 150VAC 24VDC
Control signal: TTL level
Contact Rating (Res. Load):10A 277VAC/24VDC
Max. switching voltage 250VAC/30VDC 250VAC/30VDC
Max. switching current 15A
Max. switching power 2770VA 240W 2770VA 240W
UL Rating: 10A 120VAC /10A 277VAC
Operate tiem (at nomi. Vot.): 10ms
Release time (at nomi. Vot.): 5ms
Pinout
Relay's connected to pins D7 and D8
Sample Code
Preparation
You will need:
1.
2.
3.
4.
W5500 Ethernet with POE Mainboard
Micro USB cable
PC
RJ45 network cable
Step 1: Connections
1.The X-Board Relay module access the Internet line into any router LAN port,
2.Micro USB cable plugged into the X-Board relay module, and the other end to the computer USB
port.
NOTE: After uploading the sketch below successfully, you have to open Arduino Serial
Monitor to get the card run. This is to ensure the initialization done, you could also delete
or comments those three lines of code and add a delay(1000) instead.
Step 2:Download
Programming code:
//while (!Serial) {
//
; // wait for serial port to connect. Needed for Leonardo only
//}
/*
DFRobot X-board V2 Sample Code
A simple web server with DHPC capbabilty.
1)Get IP address from router automatically
2)Show the value of the analog input pins
created 28 Sep 2012
by Ricky
*/
#include
#include
EthernetServer server(80);
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
0xDE, 0xCD, 0xAE, 0x0F, 0xFE, 0xED };
// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
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
}
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for(;;)
;
}
// print your local IP address:
Serial.print("My IP address: ");
for (byte thisByte = 0; thisByte < 4; thisByte++) {
// print the value of each byte of the IP address:
Serial.print(Ethernet.localIP()[thisByte], DEC);
Serial.print(".");
}
Serial.println();
// start the Ethernet connection and the server:
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("Connnection: close");
client.println();
client.println("");
client.println("");
// add a meta refresh tag, so the browser pulls again
every 5 seconds:
client.println("");
client.println("");
client.println(" ");
client.println("");
client.println("");
// 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("");
}
// output the value of each digital input pin
for (int digitalChannel = 2; digitalChannel < 10; digitalChannel
++) {
int sensorReading = digitalRead(digitalChannel);
if(digitalChannel!=7&&digitalChannel!=8)
{
client.print("Digital input ");
client.print(digitalChannel);
client.print(" is ");
client.print(sensorReading);
client.println("");
}
else
{
client.print("Relay ");
client.print(digitalChannel);
client.print(" is ");
client.print(sensorReading);
client.println("");
}
}
client.println("");
client.println("");
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 disonnected");
}
}
Check that it works
1. After burning is complete, open the serial monitor. Window displays your IP address.
2. Open a browser -> Enter the IP address -> Enter to open the page.
3. Serial Monitor has a corresponding feedback data
Relay module Application examples
Note that the actual parameters.
Relay Information:
Rated through-current: 10A (NO) 5A (NC)
Maximum switching voltage: 150VAC 24VDC
Control signal: TTL level
Contact Rating (Res. Load):10A 277VAC/24VDC
Max. switching voltage 250VAC/30VDC 250VAC/30VDC
Max. switching current 15A
Max. switching power 2770VA 240W 2770VA 240W
UL Rating: 10A 120VAC /10A 277VAC
Operate tiem (at nomi. Vot.): 10ms
Release time (at nomi. Vot.): 5ms
Powered By DFRobot © 2008-2017
很抱歉,暂时无法提供与“DFR0222”相匹配的价格&库存,您可以联系我们找货
免费人工找货- 国内价格
- 1+524.97849
- 3+494.92921
- 国内价格
- 1+313.96734
- 3+301.89351
- 国内价格 香港价格
- 1+304.832581+36.60274