LaserCat

1.1K80

Intro: LaserCat

Simple, wanna have a happy and excited cat? Bring a laser in the game no matter where you are!

This is an open source project to make a cool looking laser turret you can control through OSC and MQTT so you can connect it to your home automation system or, well... use a mixing console if you like to control it like a pro!

STEP 1: Step 1: Electronics

The circuit here is pretty simple, so there is no need to use fancy connectors or even a board, but it helps keeping it clean and organized, so I threw in some Molex connectors to make look nice.

STEP 2: Step 2: the Body

You need a 3D printer for this step, or maybe a friend with one... or if you live nearby, text me and I'll exchange parts for beer :)

The print is pretty straight forward, so not much to say about it, but in case you want to modify my design, you can just do so on this link.

STEP 3: Step 3: the Code

The software is a bit messy at the moment, so bear with me while I clean it up.

Check out the code on GitHub

You can control your LaserCat in two ways. I happen to use both. If you don't, you may have to tweak the code a bit to make sure it doesn't run into connection loops.

  • MQTT: LaserCat will connect to the MQTT broker declared in the config.json file. This will let you integrate it with you home automation system, for example. In my case I use Home Assistant; more on that part of the configuration later.
  • OSC: I know this is less common, but if you are into music, life events, theater or professional lighting, you know how cool this can be. I'll explain more about this later, but long story short, OSC is a communications protocol commonly used in mixing boards and other devices to control lights, cameras, motors, speakers... anything to be on a stage really.

Make sure you tweak the config.json file as needed in order to get your LaserCat to connect to the proper services... starting with renaming it as config.json instead of config.json.example.

STEP 4: Step 4: OSC Panel

If you don't know about OSC, you should check it out and definitely check out the implementation of this open source controller called Open Stage Control.
I've designed a simple control panel with OSC which takes care of a couple things:

  • Control Interface: You can use the virtual joystick or the sliders to control the Pan and Tilt of your LaserCat. Code here.
  • Keep Alive Responder: This is a simple js script (laserCat-keepalive-responder.js) to respond to the keep alive signals sent by your LaserCat. Code here.

STEP 5: Step 5: Home Assistant Configuration

For this step I'm going to assume you already have and are familiar with Home Assistant; if not, you should check it out!

In case you don't have it installed already, you will need an MQTT broker. I'd highly advise using the Mosquitto Addon.

Now you can add a new switch to your configuration.yaml:

switch:
  - platform: mqtt
    name: "LaserCat"
    command_topic: "sq"
    payload_off: "0"
    payload_on: "2"<br>
Note how I'm using
payload_on: "2"

This is just because 2 is the Sequence ID I want to trigger, which happens to be a random movement at random and somehow slow speeds with the laser on.