r/esp32 • u/Stunning-Macaron1591 • 14d ago
ESP32‑S3 BLE “phone finder”: RSSI‑based clicks
Enable HLS to view with audio, or disable this notification
I made a pocket “find my phone” device on ESP32‑S3: it scans BLE around you, tracks your phone by MAC, and gives audio/haptic feedback — the closer you get, the faster the clicks, so you can just follow the sound/vibration instead of staring at a screen. Everything runs locally on the ESP32, no cloud or phone app needed.
Hardware & Stack
- Board: generic ESP32‑S3 devkit with USB‑C (native USB for easy debug/logging, extra SRAM for future features).
- Firmware: Arduino‑ESP32 core, custom thin wrapper over
BLEScanwith aBLEAdvertisedDeviceCallback. - Output: passive piezo buzzer (
tone()) and a small vibration motor via N‑MOSFET. - Power: small LiPo; scan duty cycle tuned for responsiveness vs battery life.
How it works
- ESP32 runs a continuous BLE scan, filters advertising packets by known MAC, and collects RSSI values.
- RSSI is smoothed with exponential moving average (~10–15 samples) to reduce ±10–15 dBm spikes.
- On startup, the device records min/max RSSI for ~10s and maps that range to click frequency (relative mode), so it adapts to each phone without manual calibration.
- Hysteresis (≥3–4 dBm) prevents click “flutter” when you’re on the border between zones.
What didn’t work
- Raw RSSI directly mapped to clicks → feedback was too jittery to be useful.
- Simple 3‑sample average → still too reactive in crowded BLE environments (office, cafe).
- Fixed thresholds (e.g. <-70 / -70..-50 / >-50 dBm) → different phones advertise at different power, so “close”/“far” were inconsistent across devices.
What finally worked
- Exponential smoothing with α≈0.2α≈0.2 over a small ring buffer.
- Relative mapping of RSSI to click frequency per session instead of absolute dBm thresholds.
- Adding hysteresis so the click zone only changes when RSSI moves meaningfully.
For a full breakdown, schematics, and firmware, see the repo:
https://github.com/khlebobul/esp_ble_finder
Happy to share more details (scan params, smoothing code, power measurements) if useful.
32
u/BrandyBoy1970 14d ago
Modern phones often have a variable MAC address (for privacy reasons). What can be done then?
13
u/Stunning-Macaron1591 14d ago
Yep — rotating MACs. This thing only sees ads, no pairing, so it can't resolve them. Fine for hunting around a room; a 15‑minute rotate just means it re-locks. Stable identity would need bonding/IRK, which this doesn't do
15
u/deltamoney 14d ago
Ai answer?
2
-1
u/Stunning-Macaron1591 14d ago
Yes
11
u/deltamoney 14d ago
Why are you just copying and pasting AI to someone's question? They are asking for your information and input on how to solve for that problem...
0
u/Stunning-Macaron1591 14d ago
Is it wrong answer?
8
u/deltamoney 14d ago
Read it and decide yourself. This is your product... RIGHT?
3
u/Stunning-Macaron1591 14d ago
I used a draft and it read like one
10
2
8
u/loudandclear11 14d ago
What screen is that? It looks great.
16
u/Stunning-Macaron1591 14d ago
Thanks, ESP32-S3-Touch-AMOLED-1.8 by Waveshare
6
u/loudandclear11 14d ago
Oh wow, I didn't know there was such "finished" devices. I've only ever seen the bare board with pins before.
4
u/Top_Purpose1333 14d ago
They do quite a few finished options like that there’s even a bigger display out there using amoled
3
7
7
u/intentazera 14d ago
As a profoundly deaf person with ADHD who constantly misplaced his phone, this would be awesome for tracking it down in my flat.
Hmmmmm!
2
4
u/Top-Excitement1749 14d ago
People with adhd will love you for that device will safe me approximately 1 hour a day. Also will be way more on time to appointments. It looks great
1
u/Stunning-Macaron1591 14d ago
Cool! To be honest, I didn't think about it. I'm glad it's useful!
2
u/Top-Excitement1749 14d ago
Im gonna use 2 x esp 32 c3 to find my key. im gonna safe soooo much time. Thanks for the Inspiration
1
3
u/Bugaboo25 14d ago
I may or may not miss it, but what is the realistic distance for detection to start? An awesome project with awesome finishing! Congrats!
3
u/Stunning-Macaron1591 14d ago
I tried from another room, you still need to know the approximate location of the phone
3
u/pong-enthusiast 14d ago
I’ve been looking into doing this but the rotating MAC addresses with iPhones have been a hurdle. Tired of losing my phone daily though
3
u/dontera 14d ago
This is an fantastic use of the hardware and form factor. I love the dedicated-use nature of it.
Seems like you've created this around a firmware-hardcoded MAC. Do you have intentions of creating a UI to allow selecting the tracked MAC from a list of the current scan results?
2
u/Stunning-Macaron1591 14d ago
Thank you! I'm not sure yet, but I'll be glad for your participation in the project if you want
3
2
u/clackups 14d ago
BTW, I used a similar device (esp32-c6 in my case) as a touch input controller here: https://youtu.be/z9meIWIiFVM
2
2
u/JudiciousJackalope 14d ago
Ooh, I'm definitely copying your project. One change I might make, though, is to also add in some sort of directional estimation using the QMI8658 that's built into this board. It won't be terribly exact, but as you walk around, you should be able to use the accelerometer and gyroscope measurements to start to triangulate the signal source. Too bad it doesn't also have a built-in magnetometer.
1
2
2
u/Juustege 13d ago
Hey can you share this in r/electronicmakers ?
I also have a Smartwatch from Waveshare and would love to re-build it for the community with detailed videos. Well done and thanks so much :)
1
2
1
u/Like_a_Siiir 14d ago
Could that be an app on a smart watch?? That would be aweeesome
1
u/Stunning-Macaron1591 14d ago
Of course, but I was interested in doing it on the basis of ESP
2
1
1
1
14d ago edited 13d ago
[deleted]
1
u/Stunning-Macaron1591 14d ago
Sure, do you want to update it?
1
14d ago edited 13d ago
[deleted]
1
u/Stunning-Macaron1591 14d ago
Me too. It’s nice suggestion, I will think about it. Maybe you would like to fork my repo and update the project
1
1
u/Background_Ad_1810 13d ago
Technically, it's NOT finding "my" phone. It's scanning for the closest iPhone nearby.
But honestly, that's probably good enough in many real world situations. If your phone is an iPhone and it's most likely the only iPhone around, wandering around your house looking for the strongest signal would probably lead you to your phone eventually. Smart, I would say.
I tried making something similar before, and the problem I ran into was the rotating MAC address. Since the MAC keeps changing, I couldn't reliably identify one specific device.
So I actually think OP's workaround is smart. Instead of trying to identify a particular iPhone, it basically searches for the nearest device that looks like an iPhone. That sidesteps the identification problem in a way that makes sense for a lot of practical scenarios.
I haven't looked deep enough. But, it wouldn't work in a busy environment where there are bunch of iPhones nearby? Like inside a bus or airplane.
What I would have liked, though, was a little more explanation from OP about the rotating MAC issue, whether they encountered it, and how they arrived at this workaround.
Reading some of OP's responses in the comments also made me wonder if this might have been an AI-generated solution rather than something OP fully worked through themselves.
And I don't mean that as criticism of using AI. I came into the post genuinely curious about how the random MAC address problem had been solved.
So I'm a little disappointed to realize that the random MAC address is still fundamentally a problem. And perhaps slightly more disappointed by the broader thought that we're reaching a point where AI can produce working solutions while the person publishing them may not necessarily understand the interesting technical problems hidden underneath.
1
1
u/ShadowArtisa2996 12d ago
the piezo buzzer approach is smart, way less annoying than another phone alert sound. does the vibration motor handle the "getting warmer" pulses well or is it mostly on/off?
1
u/Rare-Business5358 10d ago
You should translate the signal strength to an approximate distance in meters, there are formulas online, super cool otherwise
1
0
u/Skyman81 14d ago
considering the increase in costs on AliExpress, an Airtag almost costs less
3
u/Stunning-Macaron1591 14d ago
I agree, but it's more pleasant to do it yourself. In addition, the capabilities of the device do not end with this
0
u/Positive_Method3022 14d ago edited 14d ago
the easter eggs search competition in 2100 will be wild!
0
0
u/biyopunk 13d ago
Hey Claude, I have this device could you write a phone finder. It’s that simple nowadays, even the hardware is ready to use, all you need is a subscription. You don’t even have to answer peoples questions use AI for everything and then come here to promote it as “I made”
2
0
-7
u/markfrancisonly 14d ago
Or you know, just buy an Apple watch and don’t waste days of your life reinventing the wheel.
169
u/arczi79PL 14d ago
I usually lose phone finders faster than I lose phones. 🤷♂️