In the past and in the future, I have learned a lot from other people's open source projects and blogs. I really appreciate the spirit of open source. During this time, I reviewed the things I have done, and I stopped doing things in this direction after graduation. There are also many online or low-level students who have asked me to discuss related materials for the thesis. Now I open source the materials and source code of the things I did during my postgraduate study, and put them all on github https://github.com/changety/hellowsn , For reference, and to commemorate the time I spent on them during my grad school. June is a new journey. Post the readme file and related pictures here.
Wireless Sensor Networks(WSN) Monitor System Based On Android
Includes three parts:
The WSN implemented by the ZigBee protocol is composed of the sensor nodes of the ZigBee protocol, which completes data collection, processing, uploading, and executes control commands . project files
The server implemented by JavaWeb consists of modules such as RS232 communication, data parsing, persistence layer, and web communication for mobile terminals. The web part includes push services for HTTP and XMPP protocols. project files
WSN monitoring software on Android platform. project files
WSN section:
Hardware Basics
Compatible with all CC2530 evaluation boards from TI CC2530DK
CC2530 chip node running ZigBee protocol stack Z-Stack protocol stack
Software Implementation
It is built on the Z-Stack protocol stack based on the ZigBee protocol , and implements all functional logic on the AP layer.
Deployment method
Familiar with IAR and Z-Stack protocol stack ignore this part
Compile and debug in IAR Embedd Workbench ID
Use IAR to open the WSNMonitorApp.eww project file in the ..\WSNMonitorApp\CC2530DB directory, right-click the project name option to find the preprocessor option in **C/C++Compile**, and set the option box of the addtional include dir according to the project file. At a directory location in the file system, import source files for other layers of the Z-Stack. If you open WSNMonitorApp.eww directly in the pull to the source file and have not changed the default directory structure, you can directly paste the following file structure in the option box:
$PROJ_DIR$
$PROJ_DIR$\..\SOURCE $PROJ_DIR$\..\ZMAIN\TI2530DB $PROJ_DIR$\..\COMPONENTS\MT $PROJ_DIR$\..\COMPONENTS\HAL\INCLUDE $PROJ_DIR$\..\COMPONENTS\HAL\TARGET\CC2530EB $PROJ_DIR$\..\COMPONENTS\OSAL\MCU\CCSOC $PROJ_DIR$\..\COMPONENTS\OSAL\INCLUDE $PROJ_DIR$\..\COMPONENTS\STACK\AF $PROJ_DIR$\..\COMPONENTS\STACK\NWK $PROJ_DIR$\..\COMPONENTS\STACK\SEC $PROJ_DIR$\..\COMPONENTS\STACK\SAPI $PROJ_DIR$\..\COMPONENTS\STACK\SYS $PROJ_DIR$\..\COMPONENTS\STACK\ZDO $PROJ_DIR$\..\COMPONENTS\ZMAC\F8W $PROJ_DIR$\..\COMPONENTS\ZMAC $PROJ_DIR$\..\COMPONENTS\SERVICES\SADDR $PROJ_DIR$\..\COMPONENTS\SERVICES\SDATA $PROJ_DIR$\..\COMPONENTS\MAC\INCLUDE $PROJ_DIR$\..\COMPONENTS\MAC\HIGH_LEVEL $PROJ_DIR$\..\ COMPONENTS\MAC\LOW_LEVEL\srf04 $PROJ_DIR$\..\COMPONENTS\MAC\LOW_LEVEL\srf04\SINGLE_CHIP编译宏
ZTOOL_P1
MT_TASK
MT_SYS_FUNC
MT_ZDO_FUNC
LCD_SUPPORTED=DEBUGThen, select the project file corresponding to the node type under the IAR workspace. After compiling, you can use the CC Debugger to burn the program into the corresponding node hardware platform through the debug button.
The main function:
The basic functions of the three different types of nodes specified by the ZigBee protocol (by default you already know the ZigBee protocol and the Z-Stack protocol stack)
The EndDevice node implements the DS18B20 sensor's ambient temperature acquisition, processing, reporting and reporting cycle settings, alarm temperature settings, and switch control.
Communication function, RS232, point-to-point, multicast, broadcast.
Other functions refer to the source code.
Server:
Operating environment
Win7 32bit
Java serial communication configuration
This part of the configuration must be completed first!
For RS232 communication with WSN, because of the use of Java implementation, the Java serial port communication is run in Windows, and the configuration is performed first.
RXTX package download address: http://rxtx.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip
After downloading and decompressing, its configuration environment is as follows:
put rxtx-2.1-7-bins in the download package -r2\Windows\i368-mingw32\rxtxSerial.dll put under your %java_home%\jre\bin (%java_home%\jre\bin\rxtxSerial.dll) and under C:\Windows\System32 (C:\Windows\ System32\rxtxSerial.dll)
in the download package rxtx-2.1-7-bins-r2\RXTXcomm.jar put it under %java_home%\jre\lib\ext (%java_home%\jre\lib\ext\RXTXcomm.jar)
Note : %java_home% is the path where you installed JDK, such as: C:\Program Files\Java\jdk1.6.0_23
Web Deployment Method
The framework jar packages required by the web part are already included in the webroot/WEB-INF/lib directory.
In %Tomcat HOME%\conf, add the Context subtag to the Host tag of the server.xml file, such as: <Context path="/wsnmonitor" docBase="..\WSNServicePlatform\WebRoot" reloadable="true"/>.
The path attribute represents the access path in the browser, and the docBase attribute represents the directory of the project file in the file system.
Run startup.bat in %Tomcat HOME%\bin to start tomcat. If the startup log of the server is printed in the command line, and you can access http://127.0.0.1:8080/wsnmonitor/index.do, the deployment is successful.
The push service based on the XMPP protocol of the Androidpn framework is also deployed in Tomcat through integration
The persistence layer built by Hibernate ORM, the database table will be automatically built when the server program is started for the first time, and can be modified in the Spring configuration file
The main function:
Data exchange with the coordinator in WSN via RS232
Parse the data and persist it to the database
HTTP accepts data requests from Android terminals and returns corresponding data.
The XMPP service maintains a persistent connection with the Aandroid terminal, and pushes the emergency data (can be set) parsed in the WSN to the terminal in real time.
See the source code for more
Android terminal:
Operating environment
Android 2.2 and above
Related framework
libs
├ fastjson.jar
├ ormlite-android-4.41
├ ormlite-core-4.41
├ universal-image-loader-1.7.0-with-src.jar
run method
Modify the URL according to the ip of the server
Main functions (all functions are based on the server):
WSN data, node information query
Real-time topology change view
Node control
Push message reception and other functions
Push rule settings