Supporting Secondary Development of the ZigBee module (SNAP Technology)

Source: Internet
Author: User

A project recently involved in planning requires a large amount of ZigBee (about 5000) data collection. Because of the wide-area layout and the mesh network architecture, many nodes are so-called routing nodes, which raises a problem. The routing node usually needs continuous power supply, because only batteries can be used for power supply in the field, this is in great conflict with the Requirements for battery use for one to two years. Therefore, ZigBee technology is required to support synchronous sleep.

In the initial scheme, we considered the ZigBee chip + ipv8l chip. By programming in a single chip, we realized synchronous sleep using the program logic. The idea was relatively simple: the master node broadcast a sleep command. After receiving the MCU, control ZigBee to sleep and sleep. After a preset period of time, the chip will be awakened by the clock, and then the chip will wake up ZigBee to send relevant data. Because ipv8l is a low-power chip, the power consumption of sensor data acquisition is much lower than that of the ZigBee module, and ZigBee is enabled only when data is sent. The overall power consumption is lower, however, the complexity and cost of the circuit increase a lot.

A successor of heli News Corporation has implemented a so-called synchronous sleep Technology in the architecture of heli news ZigBee chip technology. The above sleep logic is implemented in the ZigBee module, because it is directly implemented in the ZigBee module, the execution efficiency will be higher, and the peripheral circuit will be simpler, but the reliability and stability of the implementation will be improved, external development and configuration capabilities need to be further tested.

When studying Zhou ligong's ZigBee chip, we found that Zhou ligong's ZigBee chip supports a snap technology. Its biggest feature is its support for secondary development by users, this is the first time that I have discovered a ZigBee module that supports Secondary Development of users. This technology implements a python virtual machine in the ZigBee module. users write Python scripts for Secondary Development (this is the second time to study Python-related languages, for the first time, I used the Python script to implement the special display effects on the LED big screen many years ago. For more information, see ironpython script application-led image system.

Snap is a wireless mesh network protocol developed by synapse. It provides script development tools and related firmware. Authorization fees are required for use (six tools are available for free, and about 30 yuan for one license ). The snap network is described as follows:

 

The ZigBee kit directly purchased by Zhou ligong is deployed by default with a point-to-point firmware. You can use the zigbeecfg tool to upgrade the firmware or change it to an equivalent network firmware. To deploy firmware supporting snap, use the portal software of synapse (for example ).

 

Warning:This step requires careful consideration, because after the deployment, the snap option on the zigbeecfg tool provided by Zhou ligong cannot access this module. In this case, if it is restored to the original firmware, it needs to be returned to the factory for processing.

Currently, the latest version of snap Python script supports 72 system functions. It can operate on AD, gpio, serial port, SPI, I2C and other related interfaces, and can also execute sleep, restart, and other related commands.

The following code is an example of a script that controls the flashing of LED lights. The content is as follows:

"""Cycle the LEDs on the ZIC2410 eval board"""led = 0def start():    # Initialize LED pins as outputs    setPinDir(0, True)    writePin(0, False)    setPinDir(1, True)    writePin(1, False)    setPinDir(2, True)    writePin(2, False)    setPinDir(3, True)    writePin(3, False) def timer100msEvent(currentMs):    """On the 100ms tick, increment led count and pulse next LED"""    global led    led = (led + 1) % 4    pulsePin(led, 75, True) def remoteLQ():    """As an added bonus, respond to Link Quality Ranger requests too"""    rpc(rpcSourceAddr(), 'remoteLQ') # Here's where we specify any "Event Handlers" we need.snappyGen.setHook(SnapConstants.HOOK_STARTUP, start)snappyGen.setHook(SnapConstants.HOOK_100MS, timer100msEvent)

After the deployment is run, you will find that the rxd/txd and err lights will flash in turn.

 

However, because the firmware is developed by foreign companies, such as the underlying layer for custom development, such as the support for single-Bus Temperature and Humidity collection, it is difficult to achieve. If we think of this, we have a suggestion. If we use the megaw ZigBee chip as the ZigBee module in China, we can consider integrating a simple one. net MF framework, so that users can use C # Or VB.net for Secondary Development of ZigBee, it feels easier to write than python, and more powerful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.