Talking Dog Collar with Bluetooth Control

Make a bluetooth-activated talking dog collar for Halloween or just to show off at the park! This intermediate electronics project was inspired by Dug from the movie Up– his talking collar translates his thoughts for communicating with humans. Using the Audio FX board and Bluefruit Micro, this project enables you to trigger sound samples through the Bluefruit LE Connect app for iOS and Android. The sounds are played through a mono amp connected to a mini metal speaker.

The collar itself is made from a leather belt, with 3D printed “greebles” to make it look like the collar from the movie.

It’s easy to adapt this circuit for any phone-triggered audio project by swapping out the sound samples!

Before you begin, familiarize yourself with the following prerequisite guides:

For this project you will need:

As an Amazon Associate I earn from qualifying purchases you make using my affiliate links.

Project co-authored with Phillip Burgess. Video for gifs by Mike Farino.

Circuit Diagram

The Bluefruit Micro has been discontinued, but you can try using the Feather 32u4 Bluefruit instead

This is a schematic diagram to clearly show the connections between components with minimal wire crossings — it does not represent the actual placement around the collar.

One of the sequins is always on, sliced from the battery pack. The other is connected to an analog out on the Bluefruit Micro, so we can trigger it to light up when the sound is triggered to create a “talking” light.

We strongly recommend prototyping this project on a solderless breadboard first, if you can spare the second set of parts (the collar is assembled without header pins). When assembling things into the collar, things can get a bit confusing, so it’s always nice to have a working version of the circuit to reference!

You will want to program the project before assembly.

Code

The GitHub repository with all the code and audio samples is located here. Contents:

  • Audio directory: 8 .OGG format sound files for the project – direct link
  • BLEdogCollar directory: contains BLEdogCollar.ino, listed below.

Or download the project zip file here:

// Smartphone-activated audio gizmo (e.g. talking dog collar).
// Uses the following Adafruit parts:
//
// - Bluefruit LE Micro (adafruit.com/product/2661)
// - 500 mAh LiPoly battery (1578)
// - LiPoly backpack (2124)
// - Audio FX Mini sound board (2342 or 2341)
// - 2.5W class D mono amp (2130)
// - Speaker (TBD)
//
// Needs Adafruit_BluefruitLE_nRF51 and Adafruit_Soundboard libs:
// github.com/adafruit

#include <SPI.h>
#include <SoftwareSerial.h>
#include <Adafruit_BluefruitLE_SPI.h>
#include <Adafruit_Soundboard.h>

#define LED         A0 // LED on while "talking"
#define AUDIO_ACT   5  // "Act" on Audio FX
#define AUDIO_RESET 6  // "Rst" on Audio FX

Adafruit_Soundboard      sfx(&Serial1, NULL, AUDIO_RESET);
Adafruit_BluefruitLE_SPI ble(8, 7, 4); // CS, IRQ, RST pins

char filename[12] = "        OGG"; // Tail end of filename NEVER changes

// PROGMEM string arrays are wretched, and sfx.playTrack() expects a
// goofy fixed-length space-padded filename...we take care of both by
// declaring all the filenames inside one big contiguous PROGMEM string
// (notice there are no commas here, it's all concatenated), and copying
// an 8-byte section as needed into filename[].  Some waste, but we're
// not hurting for space.  If you change or add any filenames, they MUST
// be padded with spaces to 8 characters, else there will be...trouble.
static const char PROGMEM bigStringTable[] =  // play() index
  "1       " "2       " "3       " "4       " //  0-3
  "5       " "6       " "7       " "8       " //  4-7
  "BOOT    ";                                 //  8-

void fail(uint16_t ms) { // If startup error, LED flash indicates status
  for(uint8_t x=0;;) {
    digitalWrite(LED, ++x & 1);
    delay(ms);
  }
}

void setup(void) {
  pinMode(LED, OUTPUT);
  digitalWrite(LED, HIGH);         // LED steady on during init
  Serial1.begin(9600);             // Audio FX serial link
  if(!sfx.reset())      fail(250); // Audio FX init error?  Slow blink
  if(!ble.begin(false)) fail(100); // BLE init error?  Fast blink
  ble.echo(false);
  digitalWrite(LED, LOW);          // LED off = successful init
  play(8);                         // Play startup sound
}

void loop(void) {
  if(ble.isConnected()) {
    ble.println(F("AT+BLEUARTRX"));     // Request string from BLE module
    ble.readline();                     // Read outcome
    if(!strncmp(ble.buffer, "!B", 2) && // Controller button command
       checkCRC(255-'!'-'B', 4)      && // Verify checksum
       (ble.buffer[3] == '1')) {        // Button press? 1=press 0=release
      play(ble.buffer[2] - '1');
    }
    ble.waitForOK();
  }
}

boolean checkCRC(uint8_t sum, uint8_t CRCindex) {
  for(uint8_t i=2; i<CRCindex; i++) sum -= (uint8_t)ble.buffer[i];
  return ((uint8_t)ble.buffer[CRCindex] == sum);
}

void play(uint16_t i) {
  digitalWrite(LED, HIGH);
  memcpy_P(filename, &bigStringTable[i * 8], 8); // PROGMEM -> RAM
  sfx.playTrack(filename);
  delay(250); // Need this -- some delay before ACT LED is valid
  while(digitalRead(AUDIO_ACT) == LOW); // Wait for sound to finish
  digitalWrite(LED, LOW);
}

Leather Collar & Greebles

To make this movie prop replica, we designed some 3D files for the harder-to–find bits. Download the 3D greebles via Thingiverse by clicking the button below:

And assemble as shown (the stitching is purely ornamental). The selector knob is glued in place and does not turn or activate any part of the circuit.

Assemble Circuit

Start by desoldering the wires on the speaker, then solder on longer, more flexible wires facing “in” instead of “out,” so it will fit inside the dome.

The speaker press fits into the dome, then thread the wires through a hole on the collar. Don’t glue anything in place just yet.

Solder long wires onto one of your LED sequins (different colors for positive and negative is helpful), and thread the wires through another hole adjacent to the speaker dome.

Before you begin assembling the main “brain” chunk of circuitry, strategize a bit. The boards will go together in a stack inside the “battery” pouch, and there isn’t much room from side to side for extra wire. Use the mounting holes to route wires through to different layers.

If you’re using a metal snap closure for any of your collar’s pouches, insulate any metal that could come into contact with the board with tape or glue.

The Bluefruit Micro and Audio FX boards share power via the connectors on the backs of the board (usually used for attaching a JST port). First tin the pads and the wire ends, then use tweezers to hold the tinned wire in place while you reheat the solder to make a solid connection.

Assemble the rest of the circuit according to the diagram, soldering small bits of wire to connect the boards’ pins. Try to use short wires, but don’t make them too short or that you can’t see between the boards to double check your connections or troubleshoot.

Once your circuit sandwich is complete, you can wire up the components that are elsewhere on the collar.

Thread the speaker and sequin wires into the main circuit compartment, and strip, tin, and solder the wires in place according to the circuit diagram.

To attach the map light sequin, cut off the JST connector from your battery pack (it should be off and/or empty), then solder two wires onto each the positive side and the negative side. One set of those wires goes to the sequin, and the other set will travel through the collar to the main circuit compartment.

Tape the map light sequin to the battery pack near the center, and place the battery pack in the leather “tracking” pouch. Adjust the position of the sequin to your liking.

Phew, almost there! You haven’t glued anything yet, have you? Ok good. Clean up your workstation and double check there aren’t any bits of wire or metal hanging out in your circuit compartment, and position the boards so they’re not touching each other.

Test the circuit and be sure it is working before proceeding to the more permanent steps below!

Only after checking that the circuit is complete and in working order, you can stick the layers of the circuit sandwich together with foam tape and close up the pouch.

It’s also time to glue down the “talking” sequin and its dome, as well as the speaker dome.

E6000, shoe goo, and other permanent adhsesives are suitable for this project, but hot glue is not durable enough and so not recommended! Use a toothpick for precision application and wipe up any excess with a damp cloth.

To secure the wires on the inside of the collar, you can glue a piece of fabric to cover them, or stitch them down with a needle and thread– your method will vary depending on the material of your collar.

Wear it!

Go get that doggie costume contest trophy!

The collar is not water-resistant, so power it down and remove the batteries if you get stuck in the rain, and bring an analog backup collar just in case.

Originally posted on Adafruit.


If you like this project, you may be interested in some of my others:

To keep up with what I’m working on, follow me on YouTubeInstagramTwitter, and Pinterest.

%d bloggers like this: