STM32W108 Wireless sensor network node location technology

Source: Internet
Author: User

Use stm32w108 Wireless node to complete N based on received signal strength indication (RSSI:Received signalstrength Indication) Second, three-side centroid weighted positioning, the mobile nodes in real-time positioning, and the positioning results sent to the collection center. Figure 15.1 is the actual scene of the positioning experiment, all experiments are done indoors, using 9 nodes,1 mobile nodes,8 beacon nodes.

Figure 15.1. Locating the actual scene

Based on the simplemac protocol stack introduced in chapter VII, the program is changed and the code is changed in the following section:

File solar-system.c related content:

function Processrxpacket ():

/**************************************************************************

Function Description: Parsing and decoding the received packets and performing different operations according to different types of packets, the packet information is stored in the structure variable rxData by the packet callback function.

Input parameters: None

Output parameters: None

***************************************************************************/

void Processrxpacket (void)

{

......

// Check to determine the packet frame type, only the ft_data type is used in the code

Switch (rxdata.packet[1]&0x7) {

Case Ft_data:

Rx_details (printf ("ft_data\r\n");)

Packettype = (ft_data<<4);

Break

Case Ft_mac_command:

Rx_details (printf ("ft_mac_command\r\n");)

Packettype = (ft_mac_command<<4);

Break

Default

Rx_details (printf ("Unknown frame type\r\n");)

Goto stopprocessing;

};

// determine if the data packet has PAN ID Information

if ((rxdata.packet[1]&0x40)!=0x40) {

Pkthassrcpanid=true;

Srcaddroffset = 2;

}

// four different address types

Switch (rxdata.packet[2]) {

......

}

Rx_details (

if (Pkthassrcpanid) {

printf ("src pan = 0x%04x\r\n", Srcpanid);

}

)

// determine if the packet length satisfies sufficient length to hold the payload type

if (Rxdata.packet[0]<payloadstart) {

Rx_details (printf ("Length byte Too short\r\n");)

Goto stopprocessing;

}

// calculate packet type by frame type and load type

Packettype |= (rxdata.packet[payloadstart]<<0);

Rx_details (printf ("Packet type = 0x%02x\r\n", packettype);)

// different packet types perform different operations

Switch (packettype) {

Case (Generic_data_packet):// normal type packet,Sun node and Planet node will receive

Rx_details (printf ("generic_data_packet\r\n");)

printf ("%d\n", Rxdata.rssi);//rssi output

Break

......

Default

Rx_details (printf ("Unknown payload type\r\n");)

Goto stopprocessing;

}

Stopprocessing:

rxdata.packetbeingprocessed = FALSE;

}

function joincmd ():

/**************************************************************************

Function Description:Planet broadcast search Sun node, complete join network

Input parameters: None

Output parameters: None

*************************************************************************/

void Joincmd (void)

{

......

#ifdef Planet_role

autosendrate = 1;// set node to send packet frequency to Sun node, speed up frequency, calculate RSSI

halsetled (LED_D4);// light LED4

#endif

......

}

This article is from "stm32w108 embedded wireless sensor network" Tie Qiu, Xiafeng, newcomer authoring . Tsinghua University Press , year 5 months

STM32W108 Wireless sensor network node location technology

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.