Indoor Positioning System
Project aimed to build proof of concept level solution to indoor positioning by using ultrasound. Ultrasound positioning can be used for example robot navigation in buildings. Ultrasound postitioning is independent of satellite systems and availability of signals from them. If using assisted satellite positioning is impossible ultrasound positioning can provide more accurate option. Ultrasound triangulation provides easier alternative compared to radio triangulation because traveling speed of soundwaves is significantly slower. This makes time frames bigger and therefore time measurements can be less accurate.
In this project has been built hand-held positioning device and indoor installable beacon system. Positioning device features LCD-display to present coordinates and graphical presentation of location. Beacon system provides reference points to location calculations. Time synchronization between positioning device and beacon system has been implemented utilizing radio transceivers.
Ultrasonic positioning system is based on measuring traveling time of sound between transmitters in known position and a receiver in unknown position. Traveling time is multiplied by speed of sound to obtain distance between transmitter and receiver. When distances are known, position of receiver can be calculated based on transmitter locations.
In this solution ultrasound sending time can be known because sending starts when positioning device sends radio signal to beacon controller, which sends ultrasound pulses in predetermined sequence. Receiving time of pulses is naturally obtained, when positioning device receives ultrasound pulses. Distance calculation is based on assumption that speed of sound is 340 m/s. For determining location, positioning device has information about beacon locations.
Sequence of operation
- Sending radio signal from positioning device
- Receiving radio signal to beacon controller
- Beacon controller sends predetermined sequence of ultrasound pulses from beacons
- Ultrasound pulses are received to positioning device
- Position is calculated and presented on positioning device
Mechanical structure of device consists of Arduino units, printed circuit boards and display module.
Arduino Uno microcontroller is used to drive the beacon controller unit. The main functions for it are to control the radio module and interpret its messages, and produce a 40 kHz square wave to a corresponding ultrasound transmitter. It uses an ATmega328 controller and was chosen for this project for its easy usability and for the fact that it was available.
Arduino Uno R3.
Arduino Mega 2560
Arduino Mega 2560 microcontroller is used to drive the positioning unit. The main functions for it are to control the radio module, control the LCD, read the ultrasound receiver signal and calculate the position of the device. It uses an ATmega2560 controller and was chosen for this project for the number of pins it has. Arduino Uno was originally considered for this job but the LCD combined with the radio module uses more digital pins that Arduino Uno can handle, therefore the Mega were required.
Arduino Mega 2560 R3.
Hope Microelectronics RFM12B radio transceivers were used to send and receive serial data between positioning device and beacon controller. The specific modules used were the SMD (Surface Mount Device) version with 868 MHz frequency. The connection to Arduino is done via SPI-bus. The module and its logic requires 3.3 V which is a bit lower that the Arduino’s default voltage of 5 V. The problem was avoided by using voltage division with 10 k and 4.7 k resistors which lowered the logic output voltage to the required limits. The main voltage for the device itself was conveniently obtained from Arduino’s 3.3 V ouput.
Hope Microelectronics RFM12B SMD radio transceiver.
The function of the ultrasound transmitter is to transform electrical pulses to ultrasound, and in this project to provide the sound signal for the distance calculation. The ultrasound transmitters used in this project were model 400ST160 and they operated at 40 kHz and had a beam angle of 55°.
Ultrasound transmitter 400ST160.
The function of ultrasound receiver is to transform ultrasound to electrical pulses and in this project receive the sound from ultrasound transmitters. The ultrasound receivers used in this project were model 400SR160 and they operated at 40 kHz and had beam angle of 55°. The voltage produced by the receiver is usually measured in millivolts. From outside the used ultrasound receiver and transmitter components are virtually identical.
Main power sources
The beacon controller unit is powered by a standard usb cable connection with computer. The positioning unit is powered by a 9 V battery because it needs to be mobile for the positioning. The 9 V battery was connected to the Arduinon Mega via battery adapter and 2.1 mm DC male connector.
9 V battery with adapter and 2.1 mm DC male connector.
24 V power source
To increase the range of the system an external power source is used to drive the ultrasound transmitters. Higher voltage level means higher amplitude of the transmitted signal. High amplitude is needed to provide high enough transmit power to ensure proper measurements even at greater distances. In this project an old laptop power source, model DA-42H24, is used to provide the external 24 V power source. Transistors are used to separate the external power source from Arduino’s own 5 V rail. A resistor is also connected parallel with the ultrasound transmitters to increase the current draw, this means that smaller value resistor increases the transmit power of the ultrasound transmitter. A limiting factor of the configuration's transmit power is the 20 V RMS limit of the used ultrasound transmitters and the power limit of the resistor and transistor used. In this project bottleneck of the transmit power is the excessive heat generated in the resistors.
Ultrasound receiver amplifier
The ultrasound receiver itself gives rather low voltages and therefore an amplifier was needed to make the reading of the receiver possible with Arduino. In this project that the only purpose of receiver is detect the exact arrival moment of the ultrasound signal so the form of the received signal is largely irrelevant. Consequently a simple non-inverting amplifier connection was used since we didn’t have problems with unacceptably large noise levels or clipping of the signal didn’t matter. To make the receiver’s voltage output readable with Arduino a big amplifier gain is needed. Big gain introduced a problem with offset voltage and electrical interference from other circuits of the device. To get rid of the aforementioned problems an offset voltage adjustment is used. In this project a gain of 100 is used to get nice detection while still having a manageable offset. Like the transmitters the receiver also requires a parallel connected resistor, this time though a higher value resistor is better, up to a point of course, because without the resistor the connection won’t work.
Dual operation amplifier TLC272CP from Texas Instruments.
The function of the LCD is to provide graphical presentation of the current position. A 128 times 64 pixels Raystar RG12864B-BIW-V LCD is used in this project. It was chosen for its easy connection with Arduino and for its low cost.
Raystar RG12864B-BIW-V LCD.
Ultrasound beacon controller shield
To incorporate and connect all the components needed to drive the ultrasound transmitters a custom made shield for Arduino Uno was designed. It had the power electronics and connection spots for the transmitters and it also had one RFM12B radio module. The connection schematic of the aforementioned PCB can be found in the picture below. There is also a picture of the finished product.
Connection schematic of the ultrasound beacon controller shield.
Top and bottom of the ultrasound beacon controller shield.
Beacon unit. Arduino Uno at the bottom and shield on top of it.
To incorporate and connect all the components in the positioning unit a custom made shield for Arduino Mega 2560 was designed. It has the mounting pins for LCD, radio module and ultrasound receiver and its amplifier circuit. The connection schematic of the aforementioned PCB can be found below and below that are pictures of the finished product.
Connection schematic of the positioning shield
Top and bottom of the positioning shield
Positioning unit. Arduino Mega at the bottom, shield in the middle and LCD on the top.
Software used in this project consisted of open source libraries and own made code. Open source libraries were used for the Hope Microelectronics RFM12B radio transceiver and Raystar RG12864B-BIW-V LCD. Own code was implemented to run the whole orchestra and own functions was made to provide the position calculations.
Library used for radio module was Jeelib RF12 drivers, which provided us an easy access to the features of the radio module. In our project only functions required from the radio module was to be able to send and receive radio messages. The library used provided a lot more functionality than that, but that functionality was useful for configuring the radio modules. The configuring is done by uploading the necessary settings to the EEPROM of the radio module. These setting were the transmission frequency of the module, local group used and node id. Once the radio module was configured properly, sending and receiving radio messages between nodes was a matter of a couple simple functions.
Library for the LCD was glcd which is configured for KS0108 LCD driver. It has user friendly API to provide an easy access to the LCD panel. In our project the LCD was used to provide feedback, of the calculated location, to the user. This was done by having a graphic and text based indication of the position. The graphic feedback was done by drawing a rectangle to the other half of the LCD and then turning single pixel on, based on the location. Text based feedback was implemented to compliment the graphical feedback. It simply displayed the calculated x and y coordinates on the right side of the system. Also a signal strength indicator was implemented in the lower right corner of the LCD display. It displayed signal strength as bars depending on how many of the four available distances were read.
The implemented function that calculated the position of the device based on distances read to known positions, it functioned on triangulation basis. At first a trilateration method was considered to provide the position, but as it works by calculating the contact point of three spheres in space, the radiuses of the spheres, in this application the measured distances, needs to be exactly right for it have a singular solution. Of course in this application the measured distances are never exactly correct and to correct the error of the measurements trilateration would require heavy iteration. Therefore a bit more error free solution of triangulation was used to provide an easier way to control number of iteration loops and therefore the computing load caused by the calculations on the system. Also a method to calculate the distance with only 2 position reading was implemented to increase the operation reliability. This was done by guessing the height of device from the ceiling.
Components and budget
|RFM12B radio module||2||5.6||11.2|
|US receiver 400SR160||1||5.5||5.5|
|US tranmitter 400ST160||4||5.5||22.0|
|Arduino Mega 2560||1||44.0||44.0|
|Final sum||154.0 €|
As can bee seen from the table above that the price for the whole project and its components is about 150 €. But we received the both of the Arduinos from school and the price of the other components was about 70 € which is nicely in the original budget.
Ultrasonic beacons should be placed one in the each corner of the room. They also need to be adjusted so that they point downwards to the middle of the room so that maximum range can be attained.
Wiring beacon controller
All of the beacons should be connected to the beacon controller unit in such a fashion that origin beacon is plugged to first pin hole and the opposite corner beacon is connected to the third pin hole and the remaining beacons to the remaining pin holes however the user wishes.
Programming beacon locations
Defines for the room dimensions can be found at the beginning of the source code. With that information the program automatically sets the correct coordinates for each beacon.
Preparing positioning device
After all the wiring is done connect the positioning unit to 9 V battery and adjust the contrast of the LCD, from the corner potentiometer, so that text can be seen clearly. Connect the beacon controller unit to the computer via usb cable after this, connect the 24 V laptop power source to the corresponding connector in the shield. It is very important that the 24 V power is not connected to the Arduino's own 2.1 mm female connector because this will break the board.
Reading results from positioning device
After the system has been set up the current position can be seen from the positioning unit. LCD shows both numerical position and graphical position. Origin in the graphical demonstration is the upper left corner. In the lower right corner a number of bars indicate the current signal strength.
Conclusions and suggestions
With the current system in good conditions a position can be read at about +- 10 cm accuracy. However there are numerous problems that can hinder the accuracy of the system, such as blockage or reflection of the sound wave. Another problem area is the borders of the room where the angle between the receiver and transmitter are the largest which greatly weakens the power of the received sound wave. The ultrasonic sensors used in this project have a beam angle of 55° and this proved to be a bit too low for the system. Having sensors with bigger beam angle increases the accuracy and reliability of the system because stronger signal can be received which increases the operation area and reduces the effects of reflections. Reflections are only problem if the direct signal is so weak that it does not exceed the detection threshold value but the reflection does because it reaches the receiver in a much better angle. Reflections between different signals can be easily avoided by using a delay between signals. Blockage of the signals is a problem that can be only solved by using a larger number of transmitter beacons so that always three beacons can be read.
To improve the current system several steps can be made. Ultrasonic sensors with larger beam angle should be used to increase reliability and operation range. More powerful amplification of the signal, for better readability. Faster trigger mechanism for signal detection to increase the accuracy. A more sophisticated algorithm for detection of bad reading and to further average the measured results.