ESP32 Bluetooth Pairing To Phone - bluetooth

I am trying to make it so that my ESP32 board can detect my phone when I approach it based on RSSI. However, the ESP32 cannot see the phone unless the phone is in discovery mode, which is not super useful. To solve this, I was hoping to pair my phone with the ESP32 so that the phone would always be looking for the ESP32, and connect when it is found without any human intervention.
I decided to try the Arduino integration, but as I was working through all of the examples I couldn't find any with this functionality, so I'm kind of lost. If this is not possible or easy with Arduino, I am willing to switch, but I was unable to find anything about pairing in the normal phone interface for ESP-IDF either.
So, basically, using an ESP32, how do I pair to a phone?

The easiest way is to make the esp a gatt server and advertise a specific service. The phone will look for that specific service and connects if found.
You could make an app for your phone, like for ios its pretty easy. But keep in mind for mobile devices a continuous search for devices could be power unfriendly if misused.
If you use esp-idf instead of arduino, some examples are included. (You could use the vscode integrated esp-idd) Check learnesp32.com for an easy step into the basics, coming from Arduino.

Related

How can I receive Bluetooth audio signal and forward it to a Bluetooth speaker?

I need some help because I don´t know how to approach this challenge.
I want to build a device, that's receiving a Bluetooth audio signal and is forwarding it to a Bluetooth speaker. It´s also running some algorithms with the audio data and also simultaneously sending results via UDP to a different device.
I already thought about using two or three ESP32s, using one with an extra Bluetooth module, or searching for a whole different MCU with Bluetooth 5.0 or higher and Wifi 5GHz. But I don´t know approach the best is, or maybe a completely different one.
Some context, why we want to do it:
We want to create a real-time light show, based on the current playing song. It is already working for PC, but also want to make it accessible for phone users. Sadly there is no way to capture the internal audio on iPhone or Android phones. Our Idea to make the music sync with the phone possible is that you are connected with the phone via Bluetooth to our "sync box" which is then connected to the speaker via Bluetooth or AUX. The "sync box" is running our algorithms for creating the light shows and then sending the data to the microcontrollers from the light strips.
So maybe you have an idea how we can sync the lights to the music completely differently or how I can approach the challenge with Bluetooth.
Any help is highly appreciated.
Thanks a lot.

Make the HID keyboard with BLED112

I use the BLED112 and want to make it act like a HID keyboard.
The BLED112 receives the keystroke from the Mobile. For example, "p".
Then the dongle act like a keyboard so we can see the "p" is written on Notepad of PC.
Sending data from Mobile to dongle is not matter. I have already done.
My problem is to send the keystroke event to the PC so the dongle works like a keyboard.
I want an example or the full guide.
Thanks.
BLED112 is a Bluetooth Low Energy dongle provided by Bluegiga (Now acquired by Silicon labs). If you have studied the BLED112 user manual and bluegiga API reference documents, you'd understand that there can be two possible ways to read/write data via BLED112:
Use bgscript
use the bglib library into your C/C++ application
BLED112 is enumerated as a virual com port. I don't recall the name of the windows application that comes with BLED112 but it sounded like BLEGUI or something. This application uses the APIs to handle connections, read and write events. In a nutshell, you need to implement the same thing that this application does. For that, you can leverage the logs it spits on the console. This log will help you with all the commands you need to send and all the response that you need to handle.
Then, you need to make your application communicate with the virtual com port over which these commands will be send and responses will be received at.
Once you establish this, you'd be able to display your keystrokes.
It is a substantial work if you haven't worked with BLE. But like people say, there aren't free lunches!

Is there way to detect a certain phone from a few feet away

I am trying to build a system with a raspberry pi that allows clients access into a building depending on their membership status. Right now, it uses QR codes, but I want to know if it is possible to add a feature where it uses some technology like NFC or RFID or Bluetooth to detect their phone or RFID card from at least a foot away and confirm they have a membership.
Someone told me I could use RFID, but I am only aware of that being used in short-distance applications, like a card on a hotel door. I am not sure about Bluetooth either, because the phone would have to connect to the pi first, right? Maybe there is something I don't know about. So please offer any suggestions. Thanks
I think bluetooth does good work for tracking user. Since it's the best to handle large distances than NFC and RFID these two technologies are used for low range scenarios, check this link.
In addition, you can check distance(using Proximity and RSSI) and membership status as well. but you need to know how to handle bluetooth connectivity with raspberry pi check this link. as well create an app on that mobile phone to use Bluetooth (depending which OS you're using for Android, iOS).
Regards,

Is there a way to connect to iBeacon while my Bluetooth device is invisible?

I'm researching iBeacons. Can I connect to iBeacons while my Bluetooth is invisible (to be protected from hacks)?
I don't have beacons to test myself and can't find any clear explanation online.
iBeacons connect to mobile phones using Bluetooth, so it is essential to have that turned on. You also need to have installed an app with iBeacon support in order to receive communication from them.
If you'd wish to use a solution that does not utilize Bluetooth, you could try out IndoorAtlas. It's an indoor navigation technology based on Earth's geomagnetic fields. It's also completely hardware-free solution, just requires you to collect fingerprints in the area you are going to use for your project.
Three points:
iBeacon technology does not rely on a bluetooth connection to your phone. Beacons are one way transmitters. They do not listen to or otherwise receive any info from your device. Beacon technology following this model is inherently privacy friendly.
Mobile devices cannot detect Bluetooth beacons with the Bluetooth radio turned off. Sorry, it is just not possible.
Properly built beacon apps will not expose your mobile device's Bluetooth info because they are receive only. Of course, other apps on your phone might use bluetooth for other purposes, so your best bet is to audit apps using bluetooth and remove any that are not doing what you want.
I just bought some beacons and tested that, The answer is YES. it is possible to read beacons mac addresses while using the phone's Bluetooth connection as invisible. Using this you will get access to your beacon in any open place without getting hacked through Bluetooth.
Thanks all for your answers.

NFC handover to Bluetooth or WiFi for data transfer

I'm currently working on a project for an interactive visitor centre in Laguna Beach, CA.
There are many touchscreen devices around the space, which we are developing some cool software for, however one of the client requests is to allow visitors to transfer image, pdf and video files from an interactive coffee table touchscreen onto their phone.
The client has seen this on YouTube/CES etc.. You know, where someone puts a phone on a the interactive surface and then magically swipes images onto the phone from the screen.
Of course, if the visitor had a custom app on their phone, and was already on the same WiFi this would not be so much of a problem. I suspect this is what happens on these magic demos that we see.
In our situation, we don't want the visitor to download an app really, we just want the easiest solution and experience for the visitor. We have a public WiFi available to us, and we can install an NFC device on the touchscreen and the touchscreen also has bluetooth.
My ideal scenario would be for the user to pop their NFC enabled phone on the table, the table recognises it, pairs with BT or WiFi and away we go! I'm not sure how practical this is though having researched around. Clearly thats not going to work on an iPhone. I don't mind a couple of mechanisms i.e. one for Android/other NFC phones and one for iPhone.
Does anyone have any experience of this kind of thing and suggestions of how to handle it?!
Here's a mock up of our 32" Coffee Table touchscreen just for some context
Thanks for reading through and having a think :-)
I know that there is standardized way to pair Bluetooth device using NFC tag. I think this is the best solution for you. The authority that is standardizing this format is called NFC Forum. You can find more info about the topic in this document: Bluetooth Secure Simple Pairing Using NFC

Resources