News&Events
About
API Ref
API Directory
UserManual
nodeMCU
python
PC Software
EnergyMeter
WiFi HT
downloads

Tutorial 2 Control your relay in real time

This tutorial introduces how to control your relay using devicebit.com. Follow the instruction, and you will see how simple it can be.

Note: The DeviceBit E-KIT used in this tutorial is a board including an Arduino UNO and W5100. You can use Arduino UNO+W5100 to replace the DeviceBit E-KIT. 
 
You need the following devices and an account:
1. DeviceBit E-KIT(X1) with quick-plug-shield

 
2. 5v relay (X1) Purchase link:
http://www.dfrobot.com/index.php?oute=product/product&filter_name=relay&product_id=64#.U2HHCvmSyo0
 
 
3. An account on DeviceBit.com (http://www.devicebit.com/home/login)
 
 
You need to make these things ready:
1.  Add a controller on the website, and set its name to relay just below your device 01. Remember to tick YES for Controllable because we’ll control our device now. The API Address is default. Edit the name to relay, for we will need them in our codes later.
 
 
 
2.  Download the arduino IDE from www.arduino.cc . Remember to select the version 1.0.5, not the lastest version 1.5.0 by now.
 
3.  Plug E-KIT to usb port and installed the drivers using the Arduino UNO.
 
OK, here comes the tutorial.
1.  Download library from github.com for free:
 
Put them to your arduino library directory,such as d:arduino\libraries
 
2.  Open arduino IDE now,
select File->Examples->DeviceBitTcpClient->userSwitch_revertControl
replace “YOUR_API_KEY_HERE” with your user key in the user center of DeviceBit My account->Account settings.
 
 
3.  Connect 5v relay data wire to the shield D6 (not Analog foot).
 
 
4.  Upload codes to E-KIT, and plug network cable to E-KIT. Your relay is controllable on website now.
 
   
 
More tutorials later.
 
Tips:
1 You can control your relay via your mobile phone by visiting m.devicebit.com.
2 For more practical functions of DeviceBit, please refer to http://www.devicebit.com/dev/doc/167.

 

 

For any questions, please contact DeviceBit Customer Service

xujing@devicebit.comsupport@devicebit.com

Tel: 0086-10-52981332

Mobile: 0086-13911890238