Download the Positioning extension here.
Download the modified BluetoothLE extension here.
Positioning has become one of the most important applications for mobile computing because of many locational-based applications. In view of this, an App Inventor Positioning extension is created so that others can develop indoor positioning applications in a more easy way using App Inventor.
The following figure shows the general steps of a positioning technique. It often includes five steps, namely:
To develop a positioning application on App Inventor, a modified Bluetooth LE extension is needed. The modification is based on the BluetoothLE extension built by MIT (The original version can be found at https://github.com/mit-cml/appinventor-extensions/tree/extension/bluetoothle). Specifically, the GetScannedInfo
event block is added.
GetScannedInfo
- This block returns the MAC address of the broadcaster device and the measured RSSI when the scanner scans a signal. This information is necessary for positioning purposes. However, the MIT's version of the extension only updates the scanned device list when a new device is found, but the measured RSSI is not reported.
Parameters:
BeaconListString
(string) - This block returns the list of known beacons as a string, created by AddBeacon
block.
locX
(number), locY
(number) - These blocks return the x and y location calculated from the last interval.
MinX
(number), MinY
(number), MaxX
(number), MaxY
(number) - These blocks return the minimum and maximum possible x and y coordinates in the area, defined by the x and y coordinates of the known beacons.
Algorithm
- The position is calculated based on the selected algorithm using the x and y of the known beacons, and the filtered measurements from these beacons. The most commonly used method is trilateration (with least square optimization). Note that this property can only be set at the designer view.
Converter
- The filtered data is passed to the selected converter method to convert measured RSSI to physical distance. Three converters techniques were implemented. Note that this property can only be set at the designer view.
Filter
- As mentioned above, multiple raw measurements will be taken and saved temporarily. After the given interval, the device should apply a filtering technique to the raw measurements. Note that this property can only be set at the designer view.
Postprocessor
- After an estimated x,y position is calculated by the selected algorithm, post-processing correction could be done using the selected method. Note that this property can only be set at the designer view.
TimeInterval
- The position should be calculated in a given calculation interval. The reasons are that:
Based on the experimental result, it is desired that at least ten measurements from every beacon are used for calculating the position. Assuming the broadcasting interval of a beacon is 100ms, and only 50-70% of the measurements are successfully received, we propose a calculation interval of two seconds.
Note that this property can only be set at the designer view.
AddBeacon
- This block creates a reference beacon object. This block is used to define a known anchor (reference beacon) for positioning. At least three beacons are needed.
Parameters:
SetBeacon
- The block updates the X and Y of the beacon by the BeaconID.
Parameters:
DeleteBeacon
- This block deletes the created beacon by BeaconID. If the beacon does not exist, an exception will be thrown.
Parameters:
DoPositioning
- Use this block to calculate the position. This block saves the RSSI (received signal strength indicator) measured from a beacon temporarily. After the TimeInterval (defined at the designer view), the algorithm will apply Filter to the saved data. It will then calculate the location based on the chosen Algorithm (chosen at the designer view). Finally, it will publish a LocationChanged
event.
Parameters:
LocationChanged
- After the algorithm calculated the location, this event will be trigged and return the calculated location.
Parameters:
The blocks of the sample program are shown:
ScanSummaryInterval
- The scan summary interval in milliseconds can be set at the property at the designer view or the block.
AutoSave
- If this is set true (either at the designer interface or by a block), the summary data will automatically be saved when the predefined interval is reached.
SaveSummaryFilePath
- Users can optionally choose the path for saving the summary file by using this block or through the designer interface.
TrueDistance
- In order to conduct data training, the true distance where the user collects measurements must be saved. If the true distance is set, the value is saved together with the summary data in the CSV file. The true distance can be entered using a Textbox.
DoSummary
- This block accepts the device ID and RSSI. It first saves the data temporarily. When a predefined interval is reached, it calculates the RSSI summary data. The results are returned as an output by an event (see next item).
Parameters:
SaveSummaryToCsv
- This block is used in conjunction with the ScanSummaryUpdated event, to save the summary data into a CSV file for further processing and training. The user can also choose to save the data by default. The data can be found at the ScanSummaryUpdated
event.
Parameters: