DaPetToy - an Automated Cat-laser-pointer-toy




Introduction: DaPetToy - an Automated Cat-laser-pointer-toy

I guess all cat owners know the struggle: the moment you sit down and
want to enjoy your favorite TV-show, the cat thinks “I need someone to play with me”.

Would it not be awesome if you could just pull auto your smartphone and start an automagically rotating laser pointer?

I thought so and therefore build one. It consist of two motors which can move the laser pointer on two axis. One can set via a web-server the degrees which the motor is allowed to rotate.

If I caught your attention read further and build your own!



  • 3D printer
  • basic wood working tools



Step 1: Building and Assembling the Necessary Parts

First we need to print the mounts for the motors. To do this print
the files which were mentioned in the introduction.

A little bit harder will be the making of the base case. I made the case out of wood to provide more structural rigidity (and I think it looks nicer too). The base case has one large hole on the top and a small one on the side. The large hole is for the stepper motor and the small one for the power input. Make sure that the motor-hole is large enough to fit the cables of two stepper motors and also the two wires of the laser pointer (they need space to move freely as the wires will move due to the rotation).

Now it is time to assemble it. First put the laser pointer in the mount and use the M4x10 screw and nut to fix it in place.

Next up is the power jack. Put it in the small hole and fasten it with its nut.

The first motor has to be put in the 3D printed mount and secured with the two M4×20 screws, nuts and washers.

In the second last step the other motor has to be placed in the large hole of the wood case while routing all the cables through the hole too.

Finally put the motors in their holes and also stick them together. If they do not fit tightly put some hot glue on them to secure everything in place.


Double check that the cables have enough space to move while the motors are rotating.

Step 2: Connecting the Electronics


Please follow the instructions on the GitHub page.

The motor which rotates the laser pointer needs to be connected to the pins D5, D6, D7 and D0 of the esp. The pins of the other motor need to be connected to the pins D1, D2, D3 and D4. Also do not forget to connect the 5V and GND of both motors, the ESP and the laser pointer to the barrel jack.

Step 3: Flashing the Firmware

To flash the firmware download it from my github repository. You need to rename the file “REMOVE_credentials.h” in the “src” folder to “credentials.h”. And replace “YOUR SSID” and “YOUR PWD” in this file with your wifi SSID and password.
After completing this first step you have to upload the file system to the esp and than compile and upload the software.

Because the procedure of flashing does differ from software to software you are on your own regarding this point. But here are guides for Visual Studio Code using PlatformIO:

Step 4: Using the Device

we have reached the point where we can use the device!
When the esp is powered up and you visit its IP-address you will see an interface like the image shown here. There is basically just one mode. This moves the motors randomly around. However you can limit their movement.
Firstly, one starts the movement by pressing the “ON”-button and stops it with the “OFF” button. This button also stops other movements. The “LEFT”-button moves the matching motor “left” and the “RIGHT”-button “right”.

You can limit the movement for every motor like the following:

  • press “LEFT” for the motor you want to limit
  • wait until the motor reaches the position you want to set and press “OFF”
  • press the “MINIMUM” button of the motor, this sets the current position as the origin
  • now press “RIGHT” of the same motor and wait until it reaches the second position
  • press “MAXIMUM” this saves the current position as the end point
  • press on and the motor will only move in the set bounds

The origin and the endpoint are the maximum values the motor can move to and thus limiting the rotation.

Some notes:

  • When power is removed from the esp the calibration has to be redone
  • watch out that the cables always have enough space to move around
  • Do NOT move the motors by hand as you will damage them

Step 5: Watch Uninterrupted Your TV Show

Was it worth all the effort just to watch TV without you cat?
Maybe not.

Can this device help bring some joy to your cat?

I hope so.

Pets Speed Challenge

Participated in the
Pets Speed Challenge

Be the First to Share


    • Crayons Challenge

      Crayons Challenge
    • Back to School: Student Design Challenge

      Back to School: Student Design Challenge
    • Halloween Contest

      Halloween Contest



    1 year ago

    Made everything and programmed a esp8266 with dapettoy 1.2 shunju bin file.
    Connected to the AP and to
    I get a empty webpage?
    Progemmed with NodeMCU firmware programmer with no errors.

    What am I doing wrong??


    Reply 1 year ago

    thank you for your interest!
    Did you also flash the SPIFFS.bin?

    Its always hard to remote diagnose problems.
    If this doesn't help the best would be if you could open an issue on GitHub.


    Reply 1 year ago

    Yes I had to learn this first..
    But I found the problem..
    I use a esp8266 MOD
    Memory from these chip is 4mB and the wemos d1 has 16mB onboard..
    So my cats have to wait for the christmas present 😉


    Reply 1 year ago

    Hello Matchless11,
    I am pretty sure that the flash size is not a problem.
    The firmware was tested on a D1 mini (not pro!) which has 4mb of flash.

    I used a fresh ESP D1 mini today to check that the firmware works for me.
    I also get a white page when I do not flash the SPIFFS.bin before flashing the firmware.

    How do you flash the software?
    Do you compile from source or do you flash via ESPtool?


    Reply 1 year ago

    I am using the bin files because I'm a beginner with programming esp modules.
    Tried with different programs esp easy and nodeMCU firmware flasher. Also with the arduino ide for the spiffs file.
    Firmware.bin is no problem..flashes perfect and I get a empty webpage.
    With arduino ide I did tried a esp file_check sketch. A test.txt upload worked good. when I upload the spiff.bin file every seems good but still no succes. When I upload the spiff file the firmware.bin is not working anymore ,even if I try a different memory adress.
    On what adress have I write the spiff.bin?


    Reply 1 year ago

    I am sorry I updated the README on GitHub but forgot to update the guide here. I will have to do this.
    You can take a look at the flashing process here (I always use ESPtool):

    You have to flash the firmware at 0x0 and Spiffs at 0x00300000.
    Example with ESPtool:
    esptool -b 921600 write_flash 0x0 firmware.bin 0x00300000 spiffs.bin

    Hope this helps.


    Reply 1 year ago

    SUCCES!! 😁

    I opened a dos shell in windows 10 and went to the path where esptool.exe was installed.
    Then I tried the program line you give. Didn't worked but by reading the help file I came out with this line:
    "Esptool -br 921600 -cp com10 -ca 0x0 -cf firmware.bin -ca 0x00300000 -cf spiffs.bin"

    Then he programmed good 😁

    My cats can get their christmas present thanks to you ..
    Thanks for your patience and help. When the toy is completely build I post a picture ..


    Reply 1 year ago

    I am glad that it works for you now!
    I hope the further build will go smooth for you!

    Stay save and a have a nice holiday season with your cats.

    Penolopy Bulnick
    Penolopy Bulnick

    2 years ago

    That sounds fun! Do you have a video showing it working?


    Reply 2 years ago

    Hello :)
    Thank you for the reminder! I added the video to the instructable.


    Reply 2 years ago

    Yes, I have :)
    I totally forgot to upload it! I will do it today and update it here.