It's important for our dogs to be visible and safe -- especially at night. Putting lights on your dog is a great solution. By making your dog a custom-made LED leash and vest, not only will your dog be seen in the dark and get a lot of attention, it's also a great project for getting started with making LED wearables.
RGB LEDs are made out of a red (R), a green (G) and a blue (B) LED as well as a tiny driver chip. The RGB LED is smarter than a regular LED because the driver chip is addressable, which means that each LED's chip knows its own color and position on the LED strip. Therefore, virtually any imaginable color and pattern can be programmed. Each LED has four soldering contacts: power, ground, data input, and data output. The data input tells individual LEDs when and how to light up, while the output transmits the data for the following LEDs to the next LED. Refer to the picture to see the pins with labels. The ground pin is marked with a cutout edge on top of the LED.
This picture shows four different microcontrollers which are great choices for wearable projects. The main difference is the power of the microprocessor, the number pins and — especially for wearable projects — the size of the board.
The purple board is the LilyPad, from Sparkfun. The microcontroller has enough flash storage for large programs (connecting multiple sensors, microphones, and so on.). The board comes with a JST-connector (explained in step 3) as well as a button switch and an on/off switch. Around the board you'll find 11 metal-coated, conductive pins. 9 pins are for data, 1 pin is for ground and 1 pin is for power. A small extra board with a USB port needs to be attached to the LilyPad to connect it to a computer in order to upload programs. The LilyPad is good for wearable projects with conductive thread due to its big conductive holes (not to mention that it's waterproof).
The Flora is a larger black microcontroller from Adafruit Industries. The Flora has a powerful microprocessor and is also great for bigger projects. On the board there's a USB port, a JST-connector, an on/off switch, and 14 pins. 8 pins are for data, 3 are for ground, and 3 pins are for power.
The smaller black board is the Gemma from Adafruit Industries. The microprocessor does not have as much processing power as the first two boards but it’s great for smaller LED projects. Around the board are 6 pins: 3 for data, 1 for ground, and 2 for power. The Gemma comes with a USB port and a JST-connector.
The red Wattuino Nanite85 from Watterott is one of the smallest boards available. Although it doesn't have big holes for sewing, it's easy to attach to fabric. On the board is a USB port and 6 pins. 4 pins are for data, 1 is for ground and 1 is for power.
Each board has advantages and disadvantages. Here are some things to consider when choosing the right board for your project: Gemma and Nanite are small and cheap but Arduino IDE (Integrated Development Environment -- the program for uploading programs onto the board) needs extra modification and some bigger programs won’t fit. The Arduino IDE doesn’t need extra modification when working with the LilyPad or Flora and they are good for beginners because they work for most wearable projects. However, the LilyPad and Flora are larger and more expensive.
Lithium Polymer batteries (LiPo batteries) come in a variety of sizes depending on their capacity (measured in mAh). LiPo batteries can be connected to the microcontroller with a 2-pin JST connector (the white plug seen on the two LiPo batteries in the picture) or a USB cable. The LEDs should run on a 5 V power supply but they also work with a 3.7 V battery. (Never go higher than 5 V, though.) One RGB LED draws about 60 mA (milliamps) of current at full brightness. The dog vest and leash have 29 LEDs in total: 29 X 60mA = 1740 mA
If the battery has a capacity of 3200 mAh (milliamps per hour) the LEDs will light up for about 2 hours or more: 3200 mAh / 1740 mA = 1.84 hours.
LiPo batteries can be quite dangerous when unprotected and not handled properly. A great alternative is using a power bank because the LiPo battery is protected within an aluminum case and less likely to get damaged. Power banks come with a USB cable to power/charge small electronics like your smartphone or in this case, microcontroller.
Now that we've discussed all the major components, it's time to get started. Lay out out the LED design on the dog vest. Remember that all LEDs need to be connected in a line and the first LED should be close to the metal ring, which attaches to the dog leash. Mark those spots on the back of the vest with fabric chalk.
Now cut a small hole at every marked spot and secure it with a 1/4-inch eyelet. Place the deeper eyelet on the outside of the vest and the shorter, wider eyelet on the inside of the vest. Then put the black, round shaped rubber underneath the deeper eyelet and the metal leg on top of the wider eyelet. With a hammer, carefully tap the eyelets closed.
Now we'll solder the LEDs together into a string. Prepare three long wires: one for ground, one for power, and one for data in/out. The power and ground wire is continuous, while there is an individual data wire in-between every LED. Leave 8 inches of wire before the first LED. Use small scissors to strip off about 2 mm of plastic around the ground wire. I used a Helping Hand soldering aid to hold the LEDs and wire in place. It's optional, but it makes soldering much easier. Now, place the first LED in one of the helping hands' soldering clips and the wire in the opposite clip. Move the clips until the stripped wire is right next to the ground pin. Next, put the hot soldering iron on the wire and LED and heat up for about 2 seconds. Hold the soldering wire onto the LED, wire and soldering iron and wait until some solder has melted onto the wire and pin. Remove the soldering wire first and then the soldering iron, and then wait until the solder joint is cold. Measure the space between the first two eyelets on the vest. This is the distance between the first and second LED on the wire. Again use scissors to strip the wire and solder the ground pin to the wire. Repeat until all ground pins of the LED are soldered onto the wire.
Now repeat step 6 for the power wire. The power pin is diagonal across from the ground pin.
To connect the data pins of the LEDs, cut individual wires for each distance between two LEDs. Solder wire between the data output of each LED to the data input of the next LED. Also, as with the power and ground wires, solder an 8-inch wire to the first LED's input.
It is important to test the strip to make sure all of the LEDs are working before gluing them into the eyelets (which we'll get to in Step 11). Once they’re glued, it is quite difficult to fix a cold (bad) solder joint, so let's make sure everything is working right to start with.
To get started, you need to program the microcontroller. First download and install the Arduino software from the Adafruit website. The software comes with the modifications needed when working with the Adafruit Flora or Gemma. The Arduino IDE is the program you'll use to write and upload programs onto microcontrollers.
Select the board model you want to upload to. Click on Tools > Board and select the board you’ll be working with like, Flora or LilyPad. Connect your microcontroller to the computer with a USB cable.
The Adafruit NeoPixel library has nice LED patterns and is easy to work with. Download the Neopixel zip file and install the library by clicking Sketch > Import Libray... > Add Library...
In the window that appears, select the Adafruit zip-file you just downloaded and click Choose. Now open an example program by clicking _File > Sketchbook > Libraries > AdafruitNeoPixel-master > Strandtest. A program (called a "sketch" by Arduino IDE) called Strandtest will open. In the sketch, change the pin number to the pin you’ll be using on your board (the data wire will be soldered to this pin) and also change the number of LEDs to the number of LEDs you will be using. Upload the program onto the microcontroller by clicking the top left button which looks like an arrow.
Now that your microcontroller has a program, you need to connect it to your LED strip. It's dangerous to connect your strip to power without ground, so to be safe, unplug your microcontroller from the computer/power. Use crocodile clips to connect the wires with the board: ground with ground (usually "GND"), power with power (usually "V," "Vout") and data with the pin number you chose in the code before. Now that it's all connected properly, it's safe to plug the microcontroller back into a power source (computer or battery). Your LED strip should light up in different colors. If an orange error shows up at the bottom of the sketch window, copy the error and do search for a solution using Google or another search engine.
If all LEDs are working properly, the LED strip can be glued into the eyelets. Place the first LED into the corresponding eyelet on the inside of the dog vest. Make sure the LED with the 8 inches of extra wire is glued into the first eyelet, which is close to the metal ring. Apply some hot glue around the eyelet, then push the LED into the eyelet and apply more glue on top of the LED. Make sure all soldering joints are secured by hot glue as well. Repeat for all LEDs.
Turn the vest on its right side. Slowly push more and more hot glue into the eyelets on top of the LED until the eyelets are filled with glue. Wait until the glue is dry and repeat for the other eyelets.
To connect the vest to the leash, we need to add metal snaps at the beginning of the LED strip. Cut tiny holes through the dog vest and pull the 8-inch long wires through those holes. Cut the 3 wires and solder a metal button snap onto each wire. Sew the button snaps onto the vest. On my vest, the power snap is on the left, data in the middle, and ground on the right.
Use a needle and thread to secure the wires onto the vest. Loop around the wire and stitch through the vest for more support.
Now repeat steps 4 through 13 for the leash. The beginning of the LED strip should be on top of the leash because the microcontroller will be sewn onto the handle. Hook the leash onto the metal ring on the vest and measure the distance between the last LED on the leash and the button snaps on the vest. This is the minimum length of the wires coming from the last leash LED. Now solder the opposite button snap onto those wires, leaving some extra wire length to be safe. Always make sure to connect the power with the power snap button, data with data and ground with the ground.
Now all you need to do is modify the number of LEDs in the Arduino sketch to the correct number of LEDs you’re using in this project. You might have noticed that the LED patterns are changing. By deleting different patterns in the sketch, you can remove patterns you don’t want to light up on your dog vest. In the Strandtest sketch there are 6 patterns to choose from.
Use the other unused pin holes to sew the microcontroller onto the dog leash. Now connect the leash to the vest and the battery tank to the microcontroller.
Now neither the leash nor your dog can disappear in the dark. If you only want your dog vest to light up, simply skip step 13 and 15 and sew the microcontroller onto the vest. I’d recommend sewing a small bag for the microcontroller and battery, which can be attached onto the dog vest with some Velcro.