Overview
Using an ESP32 as a Bluetooth Low Energy (BLE) Human Interface Device (HID) opens up creative options for remote control, including emulating mouse swipes to control scrolling on phones, tablets, or PCs. However, each operating system handles these inputs differently, and what works on Android may completely fail on iOS or macOS. This guide covers the methods, compatibility, and best practices for emulating swipe/scroll inputs from an ESP32 using BLE.
1. How Swipe Emulation Works
Swiping is not a simple button press. On real devices, it’s a touch gesture. The closest BLE HID input available is a mouse movement, which can be combined with a tap/click to simulate a swipe.
Common techniques:
- Mouse move + click: Emulates a finger dragging across the screen
- Mouse move only: Moves the cursor without interaction
- Keyboard arrow keys: Used in web-based UIs or text-based apps for scrolling
- Mouse wheel reports (not supported by most BLE libraries for ESP32)
2. Platforms and Behavior
iOS (iPhone, iPad)
- BLE Mouse: Works only if AssistiveTouch is enabled in Accessibility settings
- Mouse move + click: May scroll content in Safari or PDF viewer
- Arrow keys / Space: Ignored in most apps (Telegram, Messages, etc.)
- BLE Keyboard input: Works only in input fields or apps with text input focus
Best Option: BLE Mouse mode with AssistiveTouch enabled, performing controlled directional movement and tap.
Android
- BLE Mouse: Works natively
- Arrow keys / Page Down / Space: Scrolls in browsers, apps, PDF viewers
- Tap after movement: Triggers swipe-like actions
Best Option: BLE Mouse or BLE Keyboard, depending on app. Android supports both well.
Windows / macOS
- Full HID support
- BLE mouse works out of the box
- Scrolling via mouse movement and click is effective
- Keyboard input (arrows, page up/down) scrolls as expected
Best Option: BLE Mouse or Keyboard, depending on context
Web Apps (browser-based UIs)
- BLE Mouse movement and click can scroll content
- Arrow keys and PageDown work in most editors, viewers, and pages
Best Option: BLE Keyboard with arrow keys or BLE Mouse with smooth move+tap
3. Best Practices for Smooth Swipe Emulation
- Use small step movement loops instead of a single large jump
for (int i = 0; i < 5; i++) {
bleMouse.move(0, 10);
delay(20);
}
- Add a short click after movement to simulate a drag
bleMouse.press(MOUSE_LEFT);
delay(100);
bleMouse.release(MOUSE_LEFT);
- Avoid abrupt motion: iOS may interpret it as system gesture
- Delay between actions: Prevents double-tap recognition or accidental app switching
4. Alternatives and Limitations
Limitations:
- BLE HID can’t send actual multi-touch gestures
- BLE Mouse doesn’t emulate wheel scroll by default
- iOS is restrictive and inconsistent outside AssistiveTouch
Alternatives:
- Use Wi-Fi based remote control UI (ESP32 web server)
- Use a physical HID device with USB-C (for Android)
- For iOS: Custom app with BLE GATT service if native input is blocked
Conclusion
BLE-based swipe emulation via ESP32 can be surprisingly effective—but only when used with awareness of the platform’s limitations. Android and desktop systems are generally friendly. iOS remains a problem child unless you adapt your design around it. Smooth motion, modest timing, and strategic tapping are key to success.
Choose your approach wisely—and remember, if it worked yesterday but not today, check your BLE stack and OS version before burning your dev board.