Bluetooth Beacon Triangulation in 3D Space

Dimensional triangulation.
I set up a small lab using Node.Js and three Raspberry Pis to determine the smartphones physical location within a 3D space environment. Before delving into the mechanics, let’s briefly examine the lab setup. To view a quick demo of the project, simply scroll to the bottom of the page.
If you’re interested in learning more about this topic check out this article.
Hardware
- The Arduino acts as the consumer
- Three Arduino Raspberry Pi micro controllers
- one Samsung Note 9 to consume the Received Signal Strength Indicator as distance
- Three Ethernet cables and one Wireless router networked to my laptop.
Software:
- The smartphone acts as the producer
- Node.JS installed on all micro controllers
- Linux installed on the Raspberry Pi
Web To The Rescue
The main goal of this experiment was to use accessible web technologies and inexpensive Hardware to solve an indoor tracking position solution. To piece it all together I first began to ask the question, how do I get sensor data from all three Raspberry Pi’s inside 3D space.
To accomplish this task I needed three objectives:
- I needed a device to produce a signal, a Producer.
- A device that would consume the data being produced, a Consumer.
- And finally, an Application that will present the data, or the UI in this use case.
Given my background in web, IoT, and mobile app development, the most optimal solution I came up with was to utilize Node.js, the A-Frame web framework, a Samsung Note 9 smartphone, and a web application. Networking was facilitated through the Wi-Fi router and internet connection for software package installation.
Putting All The Pieces Together
The first step I took was to install Raspberry Pi and Node.JS on all three Raspberry Pis. Then, I began to install all necessary packages to enable Bluetooth Beacon sensors so they can start Consuming the Bluetooth Beacon data. To communicate with the client and server, I used socket.io to create a quick and dirty two way communication pipe. Side note, In hindsight, I could have deployed a Kubernetes cluster, but one step at a time.
Next, I configured the IP Addresses of each Raspberry Pi with a static IP so I would know where the data was coming from and it also helps with debugging and troubleshooting down the line. This next step was straight forward; I downloaded the best mobile application from the Google Play store that transmits a Bluetooth Beacon signal. The next step was where the challenges started to arise.
This is where my hamster wheel in my brain started to turn. Which web UI framework should I use to show what I was trying to do and which algorithm would provide best results for triangulation? Good thing for me I had some experience with a web 3D framework. called A-Frame, but when it came to triangulation I needed some help so I turned to Stack Overflow, Pre ChatGPT, for some answers.
Now, I have all the data being sent to all three Arduino’s the next step is to deploy a local Node.JS web server to host the client and A-Frame. If you noticed in the video there are three Raspberry Pi icons. The green icons next to it indicate that all servers are up and running. If one of them fails the check mark turns red.
Final Results
At this stage everything “Looks Great”. The problem now is to find a way to translate, transform, and calculate the position of our physical space into the 3D space. What!? Because this was a new frontier for me I did my best to chose the best algorithm that triangulates three points, then I tried to match two of those points in 3D space. The main challenge here was accuracy and I was far from it.
The final results moved the 3D square but the distance posed a challenge to get right. As you can see in the video, I got pretty close. Not PERFECT, but close. Well, it was a fun head scratching experiment and I hope you enjoyed my journey into the unknown.
Until next time, happy coding.