Difference between revisions of "Esp8266 Wifi Module"

From Wiki
Jump to: navigation, search
(Use Arduino Board)
(Resource)
 
(5 intermediate revisions by the same user not shown)
Line 89: Line 89:
  
 
Log in on the website (http://www.devicebit.com/). Click Sign Up on the top right corner of the page. <br>
 
Log in on the website (http://www.devicebit.com/). Click Sign Up on the top right corner of the page. <br>
 
[[File:Signuo.jpg]]<br>
 
  
 
The following page will appear, enter your username, password, and Email. Then log into your mailbox to activate your account.<br>
 
The following page will appear, enter your username, password, and Email. Then log into your mailbox to activate your account.<br>
Line 179: Line 177:
 
SIG of sensor Module connect to A5, VCC to 5V, GND to GND.<br>
 
SIG of sensor Module connect to A5, VCC to 5V, GND to GND.<br>
 
   
 
   
Step2: Open esp_ devicebit.ino under.Before upload, you need to change some parameters. <br>
+
Step2: Open [http://wiki.sunfounder.cc/images/9/96/Esp_devicebit.zip esp_ devicebit].Before upload, you need to change some parameters. <br>
 
1) Change the SSID and password into your own ones (see Line 8 and 9).<br>
 
1) Change the SSID and password into your own ones (see Line 8 and 9).<br>
 +
 
[[File:Juhao.png]]<br>
 
[[File:Juhao.png]]<br>
 +
 
2) You need to know your password on Devicebit. Go to User Center, click My Account ->Account Settings, and then you can see your Userkey. <br>
 
2) You need to know your password on Devicebit. Go to User Center, click My Account ->Account Settings, and then you can see your Userkey. <br>
[[File:Userkey.png]]<br>  
+
 
 +
[[File:Userkeyuoi.png]]<br>  
 +
 
 
Copy and paste the value of Userkey in the following code. The gateway number is your device ID on the Devicebit platform. You can click MyDevices ->Devices in User Center. Select your device ID (here the device is Smart Home, and ID: 01)<br>  
 
Copy and paste the value of Userkey in the following code. The gateway number is your device ID on the Devicebit platform. You can click MyDevices ->Devices in User Center. Select your device ID (here the device is Smart Home, and ID: 01)<br>  
 +
 
[[File:Arduino01.png]]<br>
 
[[File:Arduino01.png]]<br>
 
[[File:Userkey andga.png]] <br>  
 
[[File:Userkey andga.png]] <br>  
 +
 
and then download it to the SunFounder Mega 2560 board.<br>
 
and then download it to the SunFounder Mega 2560 board.<br>
 
Experimental phenomenon: Open the serial monitor, it will display configuration information about ESP8266. <br>
 
Experimental phenomenon: Open the serial monitor, it will display configuration information about ESP8266. <br>
 +
 
[[File:Light1 Value.png]]<br>  
 
[[File:Light1 Value.png]]<br>  
 +
 
Login to www.devicebit.com, enter into your homepage, check sensor data, and you will see light data uploaded from the Gateway shield<br>
 
Login to www.devicebit.com, enter into your homepage, check sensor data, and you will see light data uploaded from the Gateway shield<br>
 +
 
[[File:Devicebit light1.png]]<br>  
 
[[File:Devicebit light1.png]]<br>  
Note: if you use a uno board, before you upload the code, you need to modify the line 6 #define MEGA2560 to #define UNO in the esp8266.h<br>
+
 
 +
<font color="red">Note: if you use a uno board, before you upload the code, you need to modify the line 6 #define MEGA2560 to #define UNO in the esp8266.h</font><br>
 +
 
 
[[File:Uno12.png]]<br>
 
[[File:Uno12.png]]<br>
 +
 
And connect RXD to Pin 3 , TXD to pin 2 <br>
 
And connect RXD to Pin 3 , TXD to pin 2 <br>
 +
 
[[File:Uno esp8266.png]]<br>
 
[[File:Uno esp8266.png]]<br>
  
Line 234: Line 245:
  
 
=Resource=
 
=Resource=
 +
[http://wiki.sunfounder.cc/images/9/96/Esp_devicebit.zip Esp_devicebit][[File:ZIP.jpg]]<br>
 
[http://wiki.sunfounder.cc/images/3/3e/ESP8266EX_AT_Instruction_Set.pdf ESP8266EX_AT_Instruction_Set][[File:PDF.jpg]]<br>
 
[http://wiki.sunfounder.cc/images/3/3e/ESP8266EX_AT_Instruction_Set.pdf ESP8266EX_AT_Instruction_Set][[File:PDF.jpg]]<br>
 
[http://wiki.sunfounder.cc/images/8/8a/0a-esp8266ex_datasheet_en.pdf ESP8266_Module_User_Guide][[File:PDF.jpg]]<br>
 
[http://wiki.sunfounder.cc/images/8/8a/0a-esp8266ex_datasheet_en.pdf ESP8266_Module_User_Guide][[File:PDF.jpg]]<br>
 
[http://wiki.sunfounder.cc/images/b/b2/Sscom32E.zip Sscom32E][[File:ZIP.jpg]]
 
[http://wiki.sunfounder.cc/images/b/b2/Sscom32E.zip Sscom32E][[File:ZIP.jpg]]

Latest revision as of 08:13, 9 October 2017

Introduction

Esp8266 and pin .png
ESP8266 is an UART-WiFi transparent transmission module with ultralow power consumption, specially designed for the needs of a new connected world. It offers a complete and self-contained Wi-Fi networking solution, allowing it to either host the application or to offload all Wi-Fi networking functions from another application processor.
ESP8266 has powerful on-board processing and storage capabilities that allow it to be integrated with the sensors and other application specific devices through its GPIOs with minimal development up-front and minimal loading during runtime. Its high degree of on-chip integration allows for minimal external circuitry, and the entire solution, including front-end module, is designed to occupy minimal PCB area. ESP8266 Serial Wifi Wireless Transceiver Module is suitable for Uno, Mega 2560 and Nano.

Pin Functions

Pin Name Description
1 TXD 1) UART_TXD, sending;

2) General Purpose Input/Output:GPIO1;
3) Pull-down is not allowed when startup;

2 GND GND
3 CU_PD 1) Working at high level;

2) Power off when low level is supplied

4 GPIO2 1) It should be high level when power on, hardware pull-down is not allowed;

2) Pull-up by default;

5 GPIO16 External Reset signal, reset when low level is supplied; work when high level is supplied (high level by default);
6 GPIO0 1) WiFi Status indicator;

2) Operation mode selection:
Pull-up: Flash Boot, operation mode
Pull-down: UART Download, download mode

7 VCC Power Supply(3.3V)
8 RXD 1) UART_RXD,Receiving

2) General Purpose Input/Output: GPIO3;

Schematic

Esp8266 schematic.png

Features

• 802.11 b/g/n
• Integrated low power 32-bit MCU
• Integrated 10-bit ADC
• Integrated TCP/IP protocol stack
• Integrated TR switch, balun, LNA, power amplifier and matching network
• Integrated PLL, regulators, and power management units
• Supports antenna diversity
• Wi-Fi 2.4 GHz, support WPA/WPA2
• Support STA/AP/STA+AP operation modes
• Support Smart Link Function for both Android and iOS devices
• SDIO 2.0, (H) SPI, UART, I2C, I2S, IR Remote Control, PWM, GPIO
• A-MPDU & A-MSDU aggregation & 0.4s guard interval
• Deep sleep power <10uA, Power down leakage current < 5uA
• Wake up and transmit packets in < 2ms
• Standby power consumption of < 1.0mW (DTIM3)
• +20 dBm output power in 802.11b mode
• Operating temperature range -40C ~ 125C
• FCC, CE, TELEC, Wi-Fi Alliance, and SRRC certified

How to Test and Debug Esp8266

Use Arduino Board

In this experiment, you will learn same simple operations about ESP8266 – transfer the data collected from sensors to devicebit.com.
Introduction to DeviceBit Platform

The DeviceBit platform (http://www.devicebit.com/home/publicsensors) is a real-time data brokerage platform for the Internet of Things (IoT), providing most of its functionality via its Application Programming Interface (API). It is quick and easy to add Devices and Applications to the DeviceBit platform. It provides real-time data storage and remote control at scale. The DeviceBit platform is not just an easy way to prototype new Internet-enabled sensors; it's also a service that helps companies bring products to market at scale.
The DeviceBit platform provides basic data analysis tools for rapid data evaluation, as well as real-time alerts and notifications if sensors report “abnormal” conditions.
You can realize your own ideas and develop your own devices relying on this platform. You can focus on hardware instead of software infrastructure.
The DeviceBit platform also communicates with existing social network, such as Twitter and Facebook, allowing you to share what you do with your friend, which might be very helpful to their research on similar field.
Operate on DeviceBit Platform

Log in on the website (http://www.devicebit.com/). Click Sign Up on the top right corner of the page.

The following page will appear, enter your username, password, and Email. Then log into your mailbox to activate your account.

Login.jpg

Add a New Device

Log in to your account,then go to User Center, and go to My Devices -> Devices -> Add A device.
Add device.png
Fill in the related information and then click Save.
The related parameters are explained as follows:
1) ID: The ID of the device, allocated by system automatically. It is unique for each device.
2) Type: The type of the device. Click the inverted triangle and the following options will appear.
 Arduino: Arduino Board.
 Lw-board: The board developed by DeviceBit.
 Other: Other boards.
3) Name: The name of the device. For example, Smart Home
4) Description: Description of the device.
5) Public: If your devices are public, other users can also view them and their measurement.
6) Location: The location of your device. Click the location point on the Map.

Add a New Sensor

The next step is to add a new sensor connected to your device.
Go to My Devices -> Sensors&Controllers -> Sensors, and then click Add to create a new sensor.

Sensor add.png

Now, the following page will appear:

Add sensor.png

Fill in the related information and then click Save.
The related parameters are explained as follows:
1) ID: The ID of the new sensor. It is unique for each sensor.
2) Type: The type of the new sensor.
3) Unit: The unit of the measurement.
4) Device: Select the device which the sensor is to be connected to.
5) Name: The name of the new sensor.
6) Data Conversion: To calibrate your sensor’s measurement. You can enter Coefficient and Offset if applicable.
7) Picture: Upload the picture of your sensor.
8) Public: If your sensors are public, other users can also view them and their measurement.
9) Normal range: The normal range of the sensor’s measurement. You can set it according to your actual need.
10) Overrange alarm: Turn it on and you will receive the alert by SMS or email when the sensor’s measurement is out of the range.
11) Data post period: The system indicates that the sensor is OFFLINE if it does not get the data posted by the sensor within every data post period set here.
12) Remark: Remark of the sensor.
Here we use a photoresistor to collect data and then transfer them to the platform. Add a sensor now. Remember to save every time after you finish filling in the information.

Light1.png

Components
-1 * ESP8266 Module
-1 * Arduino Board
-1 * Several jump wires
-1 * Breadboard
-1 * USB Cable
- 1* sensor Module
Experimental principle
SunFounder Uno collects light data by photoresistor, and then uploads the data to network server. Here we use the third party server www.devicebit.com.
Some functions in the code:
ESP_Begin(unsigned long baudRate): Set the communication baud rate between the ESP8266 module and SunFounder Mega2560 as 115200 (In esptodevicebit library provided, the communication baud rate between the ESP8266 module and SunFounder Mega 2560 currently only support 115200.).
ESP_Init(): ESP8266 module initilization configuration.
ESP_Send(String server, String gateWay, String userKey, String name, String value): The sending function of the ESP8266 module. Its parameters are decided by the DeviceBit platform. Server is the IP address of sending website (For example, www.devicebit.com we used); gateWay is a gateway number for a user, and you can get it from User Center of the DeviceBit platform; UserKey is obtained from User Center of the DeviceBit platform; Name is the name of the sensor you upload, which is named by you on the DeviceBit platform; Value is the data from the sensor you upload, and it should be of string type.
Experimental Procedures
Step1: Connect the circuit

ESP8266 Mega2560
TXD Pin 19(RX1)
RXD Pin 18(TX1)
CH_PD 3.3V
GND GND
VCC 3.3V

Esp8266mega2560.png

SIG of sensor Module connect to A5, VCC to 5V, GND to GND.

Step2: Open esp_ devicebit.Before upload, you need to change some parameters.
1) Change the SSID and password into your own ones (see Line 8 and 9).

Juhao.png

2) You need to know your password on Devicebit. Go to User Center, click My Account ->Account Settings, and then you can see your Userkey.

Userkeyuoi.png

Copy and paste the value of Userkey in the following code. The gateway number is your device ID on the Devicebit platform. You can click MyDevices ->Devices in User Center. Select your device ID (here the device is Smart Home, and ID: 01)

Arduino01.png
Userkey andga.png

and then download it to the SunFounder Mega 2560 board.
Experimental phenomenon: Open the serial monitor, it will display configuration information about ESP8266.

Light1 Value.png

Login to www.devicebit.com, enter into your homepage, check sensor data, and you will see light data uploaded from the Gateway shield

Devicebit light1.png

Note: if you use a uno board, before you upload the code, you need to modify the line 6 #define MEGA2560 to #define UNO in the esp8266.h

Uno12.png

And connect RXD to Pin 3 , TXD to pin 2

Uno esp8266.png

Use AT Command

Preparation

-1 * PL2303HXD
-1 * SunFounder Uno Board
-1 * ESP8266

Procedures Step 1: wire Connect UTXD of ESP8266 to RXD of PL2303, URXD to TXD, CH_PD to 5v(recommend 3.3v), GND to GND, and VCC to 3.3v. The Uno board here is used to supply 3.3v power. PL2303 is a USB to Serial Bridge Controller. You can also use other components, such as FTDI.

CONNECT.jpeg


Step 2:set parameters After wiring, open the serial port debug tool sscom32. Set parameters at first.
1) Open the serial port, click Open Com. Select the correct port, as shown below.

Ssc4.png

2) Select the correct baud rate. Here select 115200 bps. Click SendNew, as shown below.

Ssc3.png

Step3:AT instructions Now, you can start to send instructions. Enter "AT+RST" in the text box. It’s used to restart the module. If ESP8266 goes well, OK will be sent, as shown below:

Ssc2.png

You can also send other instructions, such as "AT+GMR". It is used to check the version of AT commands and SDK that you are using, the type of which is "executed".

Ssc1.png

For more information about ESP8266 AT Instructions. please refer to ESP8266EX_AT_Instruction_Set.

Resource

Esp_devicebitZIP.jpg
ESP8266EX_AT_Instruction_SetPDF.jpg
ESP8266_Module_User_GuidePDF.jpg
Sscom32EZIP.jpg