Small applications of ZigBee

Source: Internet
Author: User

 

ZigBee wireless temperature and humidity collection

1. Experiment Introduction

I have been learning ZigBee for almost a year. I have been learning the protocol stack for some time. This semester, because of the computer network course, therefore, I had a deeper understanding of the architecture of the ZigBee protocol stack, a deeper understanding of the operating mechanism, and a deeper understanding of the operating mechanism, combined with the teaching video of instructor Wang Feng, I used to watch the video with ignorance and no feeling at all. After this time of hard work, I was able to follow his mind to think about this process, at this time, I felt that I had a certain degree of understanding of the Protocol Stack and had a grasp of the development of applications. So I did this experiment on wireless temperature and humidity collection.

This time I used two purchased feebit BB boards, one EB board, the sensor uses dht10, and the routine uses the sensor demo provided by TI, in this example, the binding mode is used for wireless data transmission. In terms of data transmission, multicast, broadcast, and unicast are also used. system operation process: the coordinator first establishes a network and then sets it to allow binding mode. Then, the sensor starts, joins the network, establishes the binding, and then presses the S5 key of the sensor to send data and the Coordinator receives data, finally, it is displayed on the computer through the serial port.

2. Experiment Process

This process is similar to the previous am2301. The board is used as a single-chip microcomputer to debug the code. After the debugging passes, the code is added to the protocol stack.

At the beginning, we prepared the driver code for the device and sensor, and then we made the first step in modifying the hardware resources of the Apsara stack Board. In this experiment, I used the p02 pin as the clock signal, p03 is the data line. then, use the software IAR to perform a preliminary test. At this time, check the pin voltage and timing. then, we can check the signal on the data line step by step, compare it with the time series signal provided by the manufacturer, and then adjust the code. this is a long process. I will not talk about it any more. The general process is like this. It is worth noting that it is to change the direction of the pin. You need to take a look at Datasheet of, the Datasheet of the sensor also needs to be carefully viewed. Every small detail will make the sensor unable to drive. In this period, patience and attention are mainly used.

After this call, it will be added to the Protocol Stack, which is the focus and a lot of attention ,. protocol Stack is a headache, but when you understand it, you will find it very simple, just find several functions in the code, you can modify them. Of course, this is only simple application development. If you want to study the protocol stack in depth, it must be very complicated. The process should be called writing application protocols, this should be done by the IEEE Association or the ZigBee Alliance. This is like having the TCP/IP protocol. People have developed HTTP, FTP, and other application protocols on this basis, all these knowledge is provided to me by the online course, which has benefited a lot. the code may be involved next. Some may have headaches. Let me tell you where the key code is hidden. in fact, they are all in those app files. find this function void zb_bindconfirm (uint16 commandid, uint8 Status). If it is not found, use the find function of the compiler, find the differences between my and the original code...

Then we start collecting temperature and humidity. Then we can paste the adjusted code and call it below.

The position of this modification in the collection module has been modified, and then the data can be directly sent.

Here is the name of the device. You can change the name of a device. All problems are solved. in the end, the data sent by the device can be differentiated on the computer. note that you should remember to change the size of the data you want to send. Otherwise, a problem may occur, that is, the data is incomplete. This is an error I made during debugging.

Now that the Coordinator is ready, the changes here are simpler, and the received data structure is stored ..

Comment out the original one. I changed his data structure .....

Then adjust the format of the sent data .....

So the change to the Coordinator is over. Haha, isn't it very simple? I think everyone will know about these things, but they just don't know how to do it. You know how it works, you will know where to insert something...

Finally, it is displayed on the serial assistant ..

Coordinator

Collection Device

Two sensors

Data Display

 

 

 

..!!

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.