Building a Custom Dog Training Collar

A step-by-step guide to create an IR-controlled vibration collar for man’s best friend

t’s easy to take for granted how simple it is to communicate with a dog: we make noise, they respond. But the fact is, most dogs will suffer from some form of hearing loss as they age. Some dogs, like mine, are born deaf. This is why dog trainers recommend that we train our dogs using a combination of techniques. These typically include hand signals, auditory commands, and body language. But what happens when your trusty companion can’t hear as well as he used to?

This problem can be rectified with the use of a vibration training collar. For some owners of deaf dogs, like myself, this is an integral part of training. It’s a simple way to signal your dog when you don’t have eye contact with them. Additionally, some dogs can even be trained to respond to different combinations of vibrations to perform commands such as “sit” or “come”.

Unfortunately, finding a collar that suits your dogs particular needs and situation is more difficult than it seems. It’s shocking how pricey such a simple device can be. In addition, many collars incorporate an electrical shock component, even though knowledgeable dog trainers strongly discourage using any form of pain during training. Luckily, it is quite easy and inexpensive to build your own custom dog collar using off-the-shelf components for an Arduino Uno.

Introduction

I mentioned, I’m a deaf dog owner. My pup, Felix, is pictured above. I’ve struggled to find a dog collar that meets my needs for training my dog. I set out to build a custom collar for my pup, and this article describes the first stages of that process: basic vibration and remote control.

This project will explore using a simple IR receiver to control a vibration motor disc that can be housed inside of a dog collar. The focus of this article will be on setting up, wiring, and coding your new dog collar. It will also explore possible extensions that will allow you to customize your work. As a note, I am quite new to electronics, and I am still learning, so this guide may not be fully comprehensive.

What You Need

ere is a list of the components I used when building this system. You may adjust them as you see fit to customize the collar for your dog.

  1. Arduino Uno: You are welcome to use another microcontroller, possibly one that is smaller, especially if you’re designing for a toy breed. I chose the UNO because I had one on hand, and my dog is part Great Dane, so size was not a concern. Note: This particular model includes a cord to connect to the USB port on your computer. If your device doesn’t, you’ll need to purchase a cable separately.
  2. Adafruit Vibrating Mini Motor Disc: I used three of these little haptic devices. They are similar to the vibration motors used in some types of cell phone. You may choose to use fewer, but remember to adjust the code and wiring diagram accordingly.
  3. IR Wireless Remote Control: You do not need to use this exact model, but you do need a hex-based IR controller and receiver.
  4. 9V Battery: This is to power your dog’s collar.
  5. Dog Collar: This part should be obvious! Make sure it’s sized to fit the dog you’re designing for.

Decoding the IR Controller

nfrared radiation is a form of light that lies outside of the spectrum visible to the human eye. This makes infrared communication ideal for everyday signal transmission and reception. Your television likely uses an IR receiver to receive input from your remote control. It’s a great tool for line of sight communication, which is how we will be using it to build a training collar for your dog.

Each time you press a button on the IR remote, a unique hexadecimal code is generated for that input button. This information is sent over IR to the receiver. In order to decipher which key is pressed, the microcontroller needs to know which code corresponds to each key on the remote. So, before we can use the IR remote, we need to know the hex codes that the remote sends and receives.

Let’s start with a basic wiring of the Arduino and the IR receiver so that we can figure out what hex codes our device is sending and receiving. I’ll be wiring according to my particular remote. Check the datasheet for your device to see its particular wiring specifications

Wiring a breakout board to the Arduino Uno
Wiring the IR receiver

Now you need to install the IRremote library, which can be downloaded here. Follow the instructions to add the library to your Arduino IDE.

Now, you can use the following code to retrieve your hex codes. Upload the following to your Arduino. Then, open your serial monitor and start pressing buttons on the remote.

#include <IRremote.h>const int RECV_PIN = 7;//Here we use the IRremote library to initialize our receiver
//We also use the library to interpret the signal we receive
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup(){
Serial.begin(9600);
//Setup the receiver, and tell the LED to blink so we know it's working
irrecv.enableIRIn();
irrecv.blink13(true);
}
void loop(){
if (irrecv.decode(&results)){
//Print the hex code to our serial monitor & keep listening
Serial.println(results.value, HEX);
irrecv.resume();
}
}

You’ll see the hex codes from each key press being displayed. If you press and hold a key, you’ll see 0xFFFFFF displayed. Be sure to made note of the mapping between your keys and the hex codes.

Hex codes received from my IR remote
1: FFA25D
2: FF629D
3: FFE21D
4: FF22DD
5: FF02FD
6: FFC23D
7: FFE01F
8: FFA857
9: FF906F
0: FF9867
*: FF6897
#: FFB04F
UP: FF18E7
RIGHT: FF5AA5
DOWN: FF4AB5
LEFT: FF10EF
OK: FF38C7

Great! Now we’re ready to start preparing your dog’s training collar!

Wiring It Up

used Circuitio to determine the best wiring schematic for this collar. It may seem a bit excessive, but it’s also safe: the last thing we want is for our custom collar to hurt a dog. Here’s a wiring diagram that is far clearer than the photos I took of my process for setting up my device:

Circuitio diagram for wiring the vibration motor

The three diode rectifiers pictured are 1A 50V, the resistors are 1k Ohm, and the transistors were included with the motor discs. If yours did not include any, you can use a BC337 to do the job.

Wiring in progress

Remember to connect the power source last… or you’ll receive a rather unpleasant buzz like I did. As a note: if you know how to solder, this would be a great time to put that skill to use. This is my first electronics project, so I’m completely unskilled at soldering. After wrecking two of my vibration motors with my attempts, I decided to use a breadboard for now until my skills are up to snuff.

Programming Your Dog

ow for the fun part: programming your dog! Well, at least your dog’s collar. Hook your Arduino up to your computer via USB, open the Arduino IDE, and let’s start a new sketch. Make sure to include the IRremote library, or you’ll run into several problems. I’ve included a basic sketch below to get you started on programming your custom training collar.

#include <IRremote.h>// Pin numbers for IR pin and vibrating discs
int IR_PIN = 2;
int vib1 = D5;
int vib2 = D6;
int vib3 = D9;
IRrecv irrecv(IR_PIN);
decode_results results;
void setup() {
// Set pins to output, meaning info flows from particle to component (vibrating discs)
pinMode(vib1, OUTPUT);
pinMode(vib2, OUTPUT);
pinMode(vib3, OUTPUT);
// Turn off the motors, so we don't scare the dog
digitalWrite(vib1, LOW);
digitalWrite(vib2, LOW);
digitalWrite(vib3, LOW);
irrecv.enableIRIn();
irrecv.blink13(true);
}

Now that the setup is done, we can write the loop that we’ll use to communicate with the training collar. Currently, I’ve included two commands: one “long blast” that my dog is trained to come for, and one “short blast” that I use to get his attention.

void loop() {
if (irrecv.decode(&results)) {
switch (results.value) {
//key 1, a 2.5 second "long blast" (3 motors)
case 0xFFA25D:
digitalWrite(vib1, HIGH);
digitalWrite(vib2, HIGH);
digitalWrite(vib3, HIGH);
delay(2500);
digitalWrite(vib1, LOW);
digitalWrite(vib2, LOW);
digitalWrite(vib3, LOW);
break;
//key 2, a 1.5 second "short blast" (1 motor)
case 0XFF38C7:
digitalWrite(vib1, HIGH);
delay(1500);
digitalWrite(vib1, LOW);
break;
}
irrecv.resume();
}
}

Upload this to your Arduino and give it a try! You can program in additional buzz signals, such as multiple buzzes to signal different commands. You can also change the intensity of the buzz according to your pet’s sensitivity. My dog has a tendency to be oblivious, so I typically use the full strength buzz to communicate with him.

Congratulations! You’ve completed the hardest part of this tutorial. Now all that’s left is to connect it to your dog collar. I used soft spare soft fabric to encase the (unfortunately bulky) solution, and a separate pouch for the battery. For now, it’s attached to the dog collar with good ol’ duct tape, until I have a chance to finish customizing the design and to 3-D print a custom holder.

Extensions

he possibilities for extending this custom collar are endless! Feel free to have fun with it. I’ll likely be adding a LED light strip to the collar for when we walk at night. Other ideas include using a Photon for GPS tracking (you’d need to swap out IR control for something long-range), or even waterproofing the device for those water days in the summer. Best of luck to you and your dog!

PhD Student studying AR and Interaction