Skip to content

Repository files navigation

LEDToggles

Quick BLE control tile for the LED Lights made by Lotus Lantern, built by reverse engineering the original mobile application.

🚀 Setup & Installation

To run this project on your own device, you will need Android Studio installed on your computer to compile the application, and a text editor to update the hardware configuration.

1. Clone and Open the Project

Clone this repository and open it using Android Studio.

2. Configure Your Device MAC Address

Since Bluetooth MAC addresses are unique to each physical hardware device, you must replace the hardcoded placeholder with your own LED controller's MAC address.

  1. To find the own MAC Address of your device firt you must open the app and tap on the top left menu button. That will display your "Home" and below it the list of devices that are connected to it. (Like shown below) alt text

Grab the set of numbers below the desired device.

  1. Open app/src/main/java/com/fishwarrior06/ledtoggle/LedTileService.kt using Android Studio or any text editor.

  2. Locate the DEVICE_MAC constant inside the companion object:

    private const val DEVICE_MAC = "XX:XX:XX:XX:XX:XX" // <-- Replace with your BLE device MAC address, e.g., "1A:2B:3C:4D:5E:6F"
    

🎨 Customizing LED Colors

The application is currently hardcoded to output a specific orange color that i use on my LEDs. If you want to change this to Red, Blue, Yellow, or any other color, you need to modify the payload array inside LedTileService.kt.

  1. Locate the Color Command Find the commandColor byte array inside the companion object:
    private val commandColor = byteArrayOf(0x7E, 0x07, 0x05, 0x03, 0xFF.toByte(), 0x28, 0x00, 0x00, 0xEF.toByte()) 
    
  2. Protocol Color Mapping The hex positions 0xFF (Red), 0x28 (Green), and 0x00 (Blue) represent the RGB channels of the light.

Red Channel (Position 4): 0xFF (Decimal 255)

Green Channel (Position 5): 0x28 (Decimal 40)

Blue Channel (Position 6): 0x00 (Decimal 0)

  1. Using AI to Generate the RGB values you have in your App Since hex conversion in Kotlin arrays requires specific formatting (like adding .toByte() for values above 0x7F), the fastest way to customize your color is by asking an AI.

You can copy and paste the following prompt into ChatGPT or Gemini to get your exact byte array:

"I have this Kotlin byte array for an orange BLE LED strip: byteArrayOf(0x7E, 0x07, 0x05, 0x03, 0xFF.toByte(), 0x28, 0x00, 0x00, 0xEF.toByte()). The RGB values are at positions 4, 5, and 6. Please generate a new byteArrayOf for a [INSERT YOUR COLOR HERE, e.g., Solid Blue or Bright Yellow], making sure to apply .toByte() to any hex values above 0x7F."

Simply replace the commandColor line with the output generated by the AI, recompile the app in Android Studio, and your tile will instantly update the hardware to your new color scheme.

About

Quick BLE control tile for the LED Lights that came with my Desk, built by reverse engineering the original mobile application.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages