Imre Himpli portrait

Hello! I'm Imre Himpli

Automotive technician & Web developer

imre.himpli@sigterm.hu

Turning a Multi-Laser Cat Toy into an Alexa-Controlled Playmate (ESP32 mod)

Sep 12, 2025

Sometimes the simplest gadgets are the most fun to hack. Case in point: a battery-powered multi-laser cat toy that originally only had one feature — press a button, and chaos (lasers) ensues. Inside, the PCB was refreshingly minimal, just a single tactile switch wired to do all the heavy lifting. That was my cue: hijack the button's signal line and let an ESP32 dev board take over. Now, instead of me crawling across the floor to press a button, Alexa does it for me.


Why this mod?


Sure, voice commands are cool, but the real magic is automation. With Alexa routines, I can schedule daily play sessions so the cats get their laser chase time whether I'm home, asleep, or stuck in a meeting. Even better, I can fire up the toy remotely from the Alexa app — which means the cats think I'm some kind of omnipresent laser wizard. It's like running a feline amusement park from anywhere in the world.


The hack itself



#define ESPALEXA_DEBUG

#include <Arduino.h>
#include <WiFi.h>
#include <Espalexa.h>

const char* ssid = "myWifiSSID";
const char* password = "myWifiPass";

// Central repeater BSSID
uint8_t target_bssid[6] = {0x60, 0xB5, 0x8D, 0x43, 0x77, 0xCF};

const int maxAttempts = 10;   // max Wi-Fi connection attempts before reset
const int laserPin = 2;       // GPIO connected to cat laser button

Espalexa espalexa;

void laserTriggered(uint8_t value) {
    Serial.printf("[ESP ALEXA] Device triggered, value=%u → %s\n",
                  value, value > 0 ? "ON" : "OFF");

    digitalWrite(laserPin, LOW);
    delay(50);
    digitalWrite(laserPin, HIGH);

    Serial.println("[ESP ALEXA] Button press simulated");
}

void setup() {
    Serial.begin(115200);
    pinMode(laserPin, OUTPUT);
    digitalWrite(laserPin, HIGH);

    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(500);

    int attempt = 0;
    Serial.print("Connecting to ");
    Serial.println(ssid);

    while (WiFi.status() != WL_CONNECTED) {
        WiFi.begin(ssid, password, 1, target_bssid);
        delay(1000);
        Serial.print(".");

        attempt++;
        if (attempt >= maxAttempts) {
            Serial.println("\nFailed to connect after 10 attempts. Restarting...");
            ESP.restart();
        }
    }

    Serial.println("\nConnected!");
    Serial.print("Local ESP32 IP: ");
    Serial.println(WiFi.localIP());

    espalexa.addDevice("Cat laser", laserTriggered);
    espalexa.begin();

    Serial.println("[ESP ALEXA] Espalexa started, waiting for Alexa discovery...");
}

void loop() {
    espalexa.loop();
}




The modification was almost too easy. The toy already runs on 3× AA batteries, which also happen to be perfect for an ESP32 dev board. By wiring the ESP32 to simulate a button press, the toy can be toggled on command without touching the original circuitry much. No custom PCB, no complex reverse-engineering — just one well-placed hijack of the tactile button's line, and suddenly a dumb toy became part of my smart home.





End result


Now my cats have an automated, voice-activated entertainment system, and I've upgraded my own life by never having to bend down to push that button again. The ESP32 didn't just make the toy smarter — it also saved me from being the unpaid laser operator in my household. The cats are happy, I'm happy, and Alexa gets to feel like she's part of the pet care team.

Imre Himpli