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