-
Notifications
You must be signed in to change notification settings - Fork 63
Advanced User Guide
Wio Link is designed to simplify your IoT development. It is an ESP8266 based Wi-Fi development board for you to create IoT applications with open-source, plug and play electronics, mobile APPs and RESTful APIs.
- Input Voltage:Battery holder: 3.4~4.2V; MICRO USB: 5V
- Output DC Current: VCC: 1000mA MAX
- Operating Voltage : 3.3V
- Charge Current: 500mA MAX
- Flash Memory: 4MByte
- Size: 55mm*48mm
- Weight: 26g
- CE/FCC/IC Certified
The BLUE led is the network status indicating led. It has the following blink patterns:
- breathing - Under configuration mode
- blink twice quickly then off 1s - requesting IP address from router
- blink once quickly then off 1s - connecting to the server
- on 1s then off 1s - The node is online
- on constantly - the node is dead for not getting IP or not connecting to server.
- blink quickly (on 100ms then off 100ms) - OTA
Note: The BLUE led is attached to GPIO2 which is also the TX pin of UART1. When downloading firmware, the UART1 dumps the data transmitting on UART0 by instinct. So the BLUE led will blink while downloading firmware. After startup the GPIO2 will be configured as a GPIO not TX of UART1.
The RED led is another status led which indicates the power status of Grove modules. All the six Grove interface's VCC converge together and can be controlled with GPIO 15. When the node is in deep sleep mode, all the grove modules lose their power too. The RED led will light on when Grove modules are powered and will go off when Grove modules aren't powered.
Note 2: The description here for status leds are not applicable for the hardware in engineering prototype version. For engineering prototype, BLUE and RED reverse.
Assuming that user has finished the configure operation and Wio Link can join WiFi router now, the following are steps Wio Link will take to connect to the server:
The GPIO2 is the TX of UART1 (UART1 only has TX). UART1 is used as the default console of ESP8266 SDK. So the bootloader's debugging messages will be printed at UART1 when booting up. If you want to view the debugging messages, connect the GPIO2 to a UART RX port, then configure the baud rate of your terminal software to 74880.
The printed debugging messages will be something like this:
load 0x40100000, len 1396, room 16
tail 4
chksum 0x89
load 0x3ffe8000, len 776, room 4
tail 4
chksum 0xe8
load 0x3ffe8308, len 540, room 4
tail 8
chksum 0xc0
csum 0xc0
2nd boot version : 1.4(b1)
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 32Mbit(1024KB+1024KB)
jump to run user1 @ 1000
RüþAfter the firmware is booted up, it will use GPIO2 to drive the status led. There's a method to enable debug message printing: change ENABLE_DEBUG_ON_UART1 (in user_config.h) to 1, but this will subsequently disable the network status led.
Follow the steps below:
- Download files:
- Flash tool: http://bbs.espressif.com/download/file.php?id=856 (only works with Windows)
- Firmware: user1.bin user2.bin
- Bootloader binary and other binaries: http://www.seeedstudio.com/wiki/images/4/4b/Esp8266sdk1.4.1.zip
- Unzip .rar and .zip files
- Install the driver for CP2102 ( Windows 7+ may install automatically)
- Open ESP FLASH DOWNLOAD TOOL
- Configure like picture below
- Click START
- Press and hold FUNCTION key, then press RESET key, then release both
- The download should begin, if not, please redo step 6~7.
After this, you may add this node as a new one to your account with the mobile App.
Please refer to https://github.com/esp8266/Arduino
The whole project's source code provides a good framework to native program instead of programing directly based on SDK. The benefits are:
- C++ environment
- Grove drivers ready
- Arduino style programing(setup and loop)
- Non-Makefile modification
- Download the whole project
- Enter users_build/local_user_00000000000000000000
- Programe. Edit Main.cpp, you can also create new header files and source files in this directory. You can use the APIs from ESP's official SDK, also you can use the grove drivers delivered along with the project. Including of Grove driver's header file will not need your modification of Makefile, the include path will be handled by the default Makefile in the background.
- Compile. Please refer to "How to compile" in the section below.
There are two ways to get grove driver compiled into the firmware.
No.1 is to edit connection_config.json. See "How to edit connection_config.json" below.
This is also how the drag-n-drop configuration works. After being added into connection_config.json, the grove will be virtualized into web of things with many APIs exposed.
No.2 is to use the grove drive as native code.
In this way, you can just copy the files under the grove's folder into users_build/local_user_00000000000000000000, then include the header file in your code and call functions. The makefile will automatically search the files under users_build/local_user_00000000000000000000. In this way, the grove will not be acting as web of things. The grove drivers are only function resources which can be called by your code.
An example of connection_config.json file:
{
"board_name": "Wio Link v1.0",
"connections": [
{"sku": "111020001", "port": "UART0"},
{"sku": "101020050", "port": "I2C0"}
]
}The value for "board_name" and "port" comes from this API call: https://github.com/Seeed-Studio/Wio_Link/wiki/API-Documentation#get-v1boardslist
Valid value for "board_name" is currently only "Wio Link v1.0". Valid value for "port" can be one of D0,D1,D2,A0,I2C0,UART0. The "connections" field is a list with each item a dictionary structure describes what module is connected to which port.
The value for "sku" can be get by viewing the header file of each grove driver. Usually the sku comes from the SKU number of the product in http://www.seeedstudio.com/depot/, but for 3rd party modules, the sku can be a UUID value or any string which is exclusive.
There's a python script 'build_firmware.py' which helps to compile the project. build_firmware.py calls make to do the compilation and generates the variables needed by Makefile. It also reads in connection_config.json to determine which grove driver should be compiled and generates required files for compilation based on drivers.json. drivers.json is a database of all the grove drivers and can be regenerated by script scan_drivers.py.
e.g. Execute from users_build/local_user_00000000000000000000 :
../../scan_drivers.py
scan_drivers.py will also pre-compile all the grove drivers into a static library file, to skip the pre-compiling part and speed up this operation, you can execute like this:
../../scan_drivers.py -k
By default, build_firmware.py will compile both user1.bin and user2.bin. In some developing cases, you just want to compile user1.bin or user2.bin, you can do this by:
../../build_firmware.py 1
or
../../build_firmware.py 2
In detail the script build_firmware.py accepts several parameters in the order showed below:
../../build_firmware.py APP_NUM USER_ID NODE_SN NODE_NAME
Default values for those parameters:
APP_NUM: ALL
USER_ID: local_user
NODE_SN: 00000000000000000000
NODE_NAME: esp8266_node
scan_drivers.py will also pre-build all the common source codes into static library except for the exclusive codes in node's build directory. This will speed up the compilation process significantly. But in the driver dev stage, you may not want to do the 2 steps testing build (scan_drivers.py -> build_firmware.py) again and again. You may want every compilation performed from source code. You get this by modifying config.py:
ALWAYS_BUILD_FROM_SRC = True
After the driver is developed and fully tested, change ALWAYS_BUILD_FROM_SRC back to False to enable the acceleration for firmware build.
- Never delay the loop over 20ms, that will cause the watchdog timeout
- You can use Serial1.printf to print debugging messages, and view the messages through UART1 whose TX pin is 2. You need to change the macro in user_config.h: #define ENABLE_DEBUG_ON_UART1 1. This will enable console output but also will disable the BLUE status led.


