Introduction: Arduino Nano LED Strip Cat Toy

About: I want to be an inventor when I grow up.

This is an Instructable for creating an LED strip cat toy. A single LED will run along the length of the LED strip for the cat to chase. This means that this project can easily be powered by the Arduino 5V pin. The colour of the LEDs can be changed with the knob in the lid of the box that contains the Arduino. The knob cycles through the full spectrum (blue-purple-red-orange-yellow-green-blue).

Supplies

  • LED strip WS2812B or another type supported by the FastLED library.
  • Arduino code (cat_toy_v6.ino)
  • 3D-printed Arduino box from Thingiverse: https://www.thingiverse.com/thing:4575459
  • Arduino Nano
  • Tiny screws (M1.2 4mm or similar)
  • Potmeter WH148
  • 3 wires 9 cm long to hook the potmeter up to the Arduino

Tools:

  • Soldering iron
  • Wire cutters
  • Screwdriver for the tiny screws

Step 1: Step 1: Connecting LED Strip to Box

1. Your LED strip should come with some wires already soldered on. You will only need 5V, GND, and Din (see picture). You don't need the separate power source wires.

2. Slide the strip into the box a little. Take the little fastener and screw it over the strip to properly secure it. The purpose of the fastener is to prevent the strip from being pulled from the box wires and all.

Step 2: Step 2: Soldering Strip to Arduino

1. Presolder the ends of the wires so it's easier to solder them to the Arduino.

2. Start with the 5V wire (red). Poke it through the Arduino 5V hole from the back to the front. Make sure there's a bit of the wire sticking out at the front because we will need to solder the 5V wire of the potmeter to this pin as well. Apply a tiny bit of solder and check whether you have a nice shiny connection (see picture 1).

3. Continue with the ground wire (white). This one goes into the GND hole. Apply a bit of solder.

4. Finish with the Din wire (green). This one goes into the D3 hole. Apply a bit of solder.

5. Carefully bend the wires to fit under the Arduino snugly and press the Arduino in its place (see picture 2).

6. Screw in the Arduino in 2 places. You will need to unscrew these 2 screws later. Alternatively, you can just leave the Arduino out. I like having it secured for the first part of step 4.

Step 3: Step 3: Secure Potmeter

Insert potmeter into lid as shown above and presolder the legs (see picture 2).

Step 4: Step 4: Connecting Potmeter to Arduino

1. Cut your 3 wires to length (9 cm) and strip both ends.

2. Presolder the ends.

3. Solder the leftmost leg of the potmeter to one of the wires (red in picture). Solder the other end of this wire to the 5V wire sticking out of the front of the Arduino.

4. If applicable: unscrew the Arduino.

5. Solder the rightmost leg of the potmeter to another one of the wires (grey in picture). Solder the other end of this wire to the GND hole that is still free on the Arduino. Stick the wire into the hole from front to back.

6. Solder the middle leg of the potmeter to the last of the wires. Solder the other end to the A0 hole on the Arduino. Stick the wire into the hole from front to back.

7. Screw the Arduino in place using 2 screws.

This was the most difficult part! You are more than halfway done!

Step 5: Step 5: Testing Your Strip

Now is a good time to test your LED strip. Go ahead and upload the sketch to your Arduino. If you haven't done so before, install the FastLED library. Here's a handy tutorial: https://learn.adafruit.com/adafruit-dotstar-leds/arduino-library-installation

Make sure you enter the correct LED type and correct number of LEDs on your strip in the sketch.

If you're up for it, you can play around a little with the variables in the sketch and see what they do. You can use the comments in the code to help you along.

Step 6: Step 6: Finishing Up

If your sketch worked, go ahead and screw in the final 2 screws. This is important because a properly secured Arduino will be more resilient to a usb cable being inserted and removed.

Carefully twist in the potmeter cables and carefully close the lid. Make sure no potmeter cables are pinched!

If you're confident the cables are all in their proper position, firmly press down on the lid. It should snap closed. The first few times it helps to first angle in the longer side of the lid and then pressing down on the other side of the lid.

Power up the Arduino by connecting a mini or micro usb cable (depending on your type of Arduino) to the Arduino and a phone charger, for example.

You're all done! Enjoy watching your cat chase the LED!