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