Wiki source code of Example of BLE indoor positioning python
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | ~1. open the application | ||
2 | |||
3 | Enter the following information: | ||
4 | |||
5 | * Subscribe to topics:MQTT Subscription Topic of TTN-V3 | ||
6 | |||
7 | Example: v3/litest@ttn/devices/eui-70b3d57ed0058a17/up | ||
8 | |||
9 | * v3: Unchanging | ||
10 | |||
11 | litest@ttn:’litest 'is the ID of the application,’@ttn’ unchanging.If you use your own TTN platform, @ ttn doesn't need | ||
12 | |||
13 | * devices:Unchanging | ||
14 | * eui-70b3d57ed0058a17:End device ID | ||
15 | * Up:Unchanging | ||
16 | |||
17 | server address:Server address of TTN-V3() | ||
18 | |||
19 | Application ID:Application ID of TTN-V3() | ||
20 | |||
21 | APIKEY:APIKEY of your own account() | ||
22 | |||
23 | |||
24 | [[image:image-20221221144423-1.png]] | ||
25 | |||
26 | |||
27 | [[image:image-20221221144423-2.png||height="534" width="1081"]] | ||
28 | |||
29 | |||
30 | [[image:image-20221221144423-3.png]] | ||
31 | |||
32 | (% style="display:none" %) (%%) | ||
33 | |||
34 | **2. (% style="display:none" %) (%%)Click the save button after writing** | ||
35 | |||
36 | |||
37 | [[image:image-20221221144423-4.png]] | ||
38 | |||
39 | **Warning:** | ||
40 | |||
41 | When the save button is pressed, it cannot be pressed again to prevent data confusion。 | ||
42 | |||
43 | If you want to modify the subscription topic, (% style="display:none" %) (%%)you need to restart the application。 | ||
44 | |||
45 | |||
46 | **3. (% style="display:none" %) (%%)Click the location button** | ||
47 | |||
48 | |||
49 | Just press once | ||
50 | |||
51 | [[image:image-20221221144423-5.png]](% style="display:none" %) | ||
52 | |||
53 | |||
54 | When the BLE node sends information, the application will display the located base station | ||
55 | |||
56 | |||
57 | (% style="display:none" %) (%%) | ||
58 | |||
59 | |||
60 | **4. About how to set the base station point and insert the floor plan** | ||
61 | |||
62 | Place the floor plan in the same path as the python script | ||
63 | |||
64 | Change the file name to office_ map(The picture pixel is 800x600) | ||
65 | |||
66 | [[image:image-20221221144423-7.png]] | ||
67 | |||
68 | |||
69 | Open source code | ||
70 | |||
71 | [[image:image-20221221144423-8.png]] | ||
72 | |||
73 | |||
74 | Remove comments | ||
75 | |||
76 | [[image:image-20221221144423-9.png]] | ||
77 | |||
78 | |||
79 | |||
80 | Run Script | ||
81 | |||
82 | The cursor position is the data pointed by the arrow, x=323 y=503 | ||
83 | |||
84 | [[image:image-20221221144423-10.png]] | ||
85 | |||
86 | cv. create_ Image is changed to (323,483)~-~-(x y-20 above) | ||
87 | |||
88 | cv. create_ Image is changed to (323,503)~-~--(x y above) | ||
89 | |||
90 | [[image:image-20221221144423-11.png]] | ||
91 | |||
92 | |||
93 | |||
94 | After clicking Save, a log.txt will be generated in the same directory as the script | ||
95 | |||
96 | [[image:image-20221221144423-12.png]] | ||
97 | |||
98 | |||
99 | [[image:image-20221221144423-13.png||height="176" width="1080"]] | ||
100 | |||
101 | |||
102 | Back to script | ||
103 | |||
104 | Modify (% style="display:none" %) (%%)the data obtained in log.txt to the script | ||
105 | |||
106 | “0” Changed to “10006” | ||
107 | |||
108 | “60245” Changed to “79”(% style="display:none" %) | ||
109 | |||
110 | [[image:image-20221221144423-14.png]] | ||
111 | |||
112 | |||
113 | (% style="display:none" %) (%%) | ||
114 | |||
115 | 5. Package the py file into an exe | ||
116 | |||
117 | Step 1:Installing the pyinstaller module | ||
118 | |||
119 | Step 2:Open cmd and switch to the directory where the script is located | ||
120 | |||
121 | [[image:image-20221221144423-15.png]] | ||
122 | |||
123 | |||
124 | Step 3:Enter the following command | ||
125 | |||
126 | [[image:image-20221221144423-16.png]] | ||
127 | |||
128 | |||
129 | See the following certificate packaging completed. | ||
130 | |||
131 | [[image:image-20221221144423-17.png]] | ||
132 | |||
133 | |||
134 | The following files will be generated in the same directory of the script. | ||
135 | |||
136 | In addition to dist, the other two files can be deleted. | ||
137 | |||
138 | [[image:image-20221221144423-18.png]] | ||
139 | |||
140 | Finally, put the office_ Map.png and icon.png Put the into the dist folder. | ||
141 | |||
142 | Just run the program in dist. | ||
143 | |||
144 |