Code Monkey home page Code Monkey logo

blem3remote's Introduction

Arduino bleM3Remote

This library is written for ESP32 Arduino projects to interact with the BLE-M3 remote. The remote has 6 buttons and goes for ~$1 on AliExpress. The library is built using the NimBLE-Arduino library. The ESP32 will act as a BLE client, with the remote as a BLE HID server.

HID Button Press Capture

This BLE remote, much like other BLE remotes, emulates keyboard/mouse inputs. For example, the camera button emulates a volume up keypress. Some of the buttons emulate a sequence of inputs. Decoding each button press into its corresponding keyboard/mouse inputs would take a lot of code. Instead, a vector of 9 values that were found to be unique to each keypress was used to identify button presses. The button presses are captured as single presses. This library does not handle long presses.

Reconnection After Sleep

The BLE-M3 remote goes into deep sleep after 10 minutes of inactivity. This allows the remote to last many months on a single CR2032 battery. Any button press will wake the device and the ESP32 will automatically reconnect to it. Currently it takes ~0.7 seconds to establish a reconnection from deep sleep. This means any button presses within that time will not be captured. This is not ideal. Other BLE devices (firestick remote, bluetooth mice, etc) accomplish this reconnection much faster. They don't seem to miss button presses either. Any ideas on how to improve this library's reconnect time will be greatly appreciated. ๐Ÿ˜„

Multiple Connections

The library is written to handle multiple remotes connecting simultaneously. By default the max connections is set to 3. This can be changed by updating the MAX_REMOTES. The maximum BLE server connections the ESP32 can handle is something that can be found in the NimBLE-Arduino library.

Simultaneous BLE Client and Server

The BLE-M3 is a BLE HID server. So this library makes your ESP32 a BLE client to connect with it. But you can simultaneously run your ESP32 as a BLE server and client depending on your project needs. To do that, initialize your BLE server code first, then run initRemoteClient with false (initRemoteClient(false)). An example will be included in the future.

Install

download this repo and place it inside Arduino/libraries

Examples

simple

this is a simple example of using the library.

customCallback

this example shows how to create your own button press callback

whitelistMacs

this is a simple example that shows how to only allow specific mac address to connect. By default macWhitelist is empty and allows any mac address to connect.

ESP32 Devices

The library has been tested to be working on ESP32-C3 and ESP32-S3 devices.

blem3remote's People

Contributors

cylon-garage avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.