Introduction: MonkeyDogTracker

About: Lazy Old Geek

Okay, I admit I don’t have a monkey. But would you be looking at this if I didn't mention monkey? And this would work for a monkey.

Does your monkey or dog wander off? Would you like to see where he/she is? Well, they make dog trackers (see picture). However, most are over $100 and require a monthly tracking service fee.

So this Lazy Old Geek (L.O.G.) decided to make my own. This requires a collar module (see picture) and a display module (see picture).

HowItWorks: The collar module is battery-powered based on Arduino, has a GPS module and an nrf24L01+ transceiver to talk to the display module. The display module is battery-powered based on Arduino, has a GPS module and an nrf24L01+ transceiver to talk to the collar. It also has a compass module and an LCD display. The collar transmits its GPS coordinates and battery voltage to the display. The display module calculates its own GPS coordinates and calculates the distance and direction between the two. The LCD shows which direction the collar is and the distance between the two.

Step 1: Collar Module

What It Does: The GPS calculates the location of itself and sends it to its Arduino. The Arduino sends this information along with the battery voltage to the nrf24L01+ module which broadcasts it wirelessly (to the display module).

The collar module consists of four major components:

A Ublox NEO-6M GPS (see picture)

An 8MHz 3.3V Arduino Pro Mini (see picture)

An nrf24L01+ wireless transceiver (see picture)

A Lithium battery (see pictures)

There’s also a custom made PCB, an LED, some connectors.

For my battery-powered Arduino projects, I’m standardizing on JST2.0 2 pin connectors for power. The four main components can be bought on ebay for a good price.

I wrote an Instructable on setting up the Ublox NEO-6M GPS:

This Instructable shows how to convert an inexpensive Arduino Pro Mini (16MHz, 5V) to an 8MHz 3.3V Arduino Pro Mini:

And I wrote an Instructable on using the nrf24L01+ transceiver:

For the battery, I selected a 3.7Vdc Lithium Ion battery also bought on ebay. This is a common size for replacement batteries for some smartphones and tablets. These come in various sizes and capacities. I had to solder a JST2.0 connector to the batteries. I hadn’t really decided on which one to use.

I also purchased a USB Li Ion 1A battery charger and added a JST2.0 connector to charge these batteries (see picture).

Warning: The standard USB port on a computer will often only put out 0.5A. While this will work, it will take longer. The charging will be faster if a 1 or 2A source is available, such as a USB 2A AC adapter.

I designed the PCB to connect the components. (see schematic) R1 and R2 form a voltage divider to monitor the battery voltage.

Technobabble: The technically inclined may notice that there is no voltage regulator in this design. While Li Ion batteries are nominally rated at 3.7Vdc, depending on the charge they will actually vary from about 4.2Vdc down to about 3.0Vdc. This Arduino Pro should operate from 1.8 to 6Vdc. The nrf24L01 from 1.9V to 3.6V. And the Ublox neo-6M 3V to 5V. So everything should work down to about 3V which is probably limit I want to discharge Li-ion battery.

Eagle cadsoft files for both the collar(PetTrackee) and the base(PetTrackerBase) are attached.

Step 2: Display Module

What It Does: The nrf24L01+ receives the GPS and battery voltage from the collar module.

The internal GPS calculates the location of itself. The Arduino calculates the distance and direction between the two GPSs. The LSM303DLHC magnetometer is an electronic compass. It is used to find out where North is so that the display will point towards the collar module. The distance will also be displayed.

The display module consists of several major components:

A Ublox NEO-6M GPS

An nrf24L01+ wireless transceiver

An LSM303DLHC magnetometer (3.3Vdc)

An LCD5110 display (3.3Vdc)

A custom Arduino PCB

A Lithium battery (see pictures under collar module step)

Arduino PCB schematic is attached. Power is regulated with a 3.3Vdc regulator. U$1 is a pushbutton on/off switch:

S1 is a pushbutton not needed in this application.

Buz1,2 are pads for a buzzer, not implemented.

There is a USB-BUB type connector for loading Arduino sketches.

The Eagle Cadsoft files are included in the collar module step.

The two pictures with displays shows an ‘arrow’ pointing in the direction of the collar and the distance to it.

Step 3: Arduino Sketches

GPS: TinyGPS++ library is used by both modules:

I use maniacBugs nrf24L01 libraries:

These are pretty complex sketches.

Collar sketch:

Remember: This is a Pro Mini 8MHz 3.3V Board and Processor. Also the Pro Mini has a different USB-BUB type pinout. I made an USB adapter in this Instructable:

Display sketch:

Remember: This a Pro Mini 8MHz 3.3V Board and Processor. But I’m using the ‘standard’ USB-BUB pinout.

LSM303DLHC: Unfortunately, I can’t remember where I got this Arduino library. I think it was from Pololu. Anyway, I’ve attached the library.

So the Pololu library has a Calibrate sketch to ‘calibrate the LSM303DLHC. Here is the description:

CALIBRATE: This program is similar to the Serial example, but instead of printing the most recent readings, it prints a running minimum and maximum of the readings from each magnetometer axis. These values can be used to calibrate the heading() functions and the Heading example after moving the LSM303 through every possible orientation.

I modified it so that the Mins and Maxs will display on the LCD5110. Run this sketch on the Display module. Run sketch, slowly, twist and turn the module in all orientations. Record the Mins and Maxs on the display, then plug them into DisplayStation sketch, replacing the values in the following lines:

compass.m_min = (LSM303::vector){-433, -600, -546};

compass.m_max = (LSM303::vector){+570, +488, +579};

This should improve the compass readings.

WARNING: When I updated to Arduino to 1.6.1, I had to update Adafruit_GFX and Adafruit_PCD8544 libraries:

Display Sketch Summary:

Besides setup() and loop(), I wrote six functions:

getRadioData() uses nrf24L01+ to receive the data sent by the collar module

getGPS() gets GPS data from the internal GPS

calculate() calculates distance and heading between the two

getHeading() get heading from LSM303 magnetometer

getPosition() get position using heading and compass

displayDirection() display information on LCD5110

setup() starts GPS, compass, nrf24L01+ , sets up LCD5110

loop() gets data from collar, gets GPS, calculates distance and heading and displays

Step 4: Improvements - Comments

Here are some improvements I was planning on making.

The nrf24L01s have a limited range, supposedly about 100 meters (328 feet). I was planning on putting a buzzer on the display module to warn the user when the collar was moving out of range.

The buzzer and the display could also be used to display low battery on the collar. Time to recharge the collar battery.

If actually using with a monkey or a cat, the user might be interested in the height difference. The GPSs should be able to display the difference in height.

WARNING: I don’t think the height reading from GPSs is very accurate.

Enclose the collar in maybe zippered bag with a collar.

Enclosure for the display module.

TIP: When first starting, the GPS modules take a while to start broadcasting. There’s a green LED on the module that will start blinking when it is running. But it still may take a couple of minutes to lock in.

Getting it all to work:

Not Easy.

Collar module: When I’m developing code, I leave the computer connected and send serial messages to the serial monitor like GPS coordinates and battery voltage to make sure they’re working. In the sketch I also turn on an LED when the nrf24L01 is transmitting data.

Battery life: Battery life can be extended by removing blinking LED from GPS and from collar module. Also the smartDelay value can be larger. Right now I send data every two seconds.

Display module: Again when I’m developing code, I leave the computer connected and send serial messages to the serial monitor. A lot of times I just send a message to see if I reach a particular section of code. Many of these println() messages are still in the sketch but commented out.

Operation: Well, it seems to work pretty good especially outdoors. When the two modules are close, the display isn't very accurate. This is probably due to limits of GPS. I didn't try to do any averaging, especially since it's probably a moving target.

Coded Creations

Participated in the
Coded Creations

Animals Contest

Participated in the
Animals Contest

Be the First to Share


    • Puzzles Speed Challenge

      Puzzles Speed Challenge
    • "Can't Touch This" Family Contest

      "Can't Touch This" Family Contest
    • CNC Contest 2020

      CNC Contest 2020

    7 Discussions


    1 year ago

    I had made it. but I only see a flower on the display??. what goes wrong??


    3 years ago

    Hello, can you explain what it means Serial.println (course To); And Serial.println (TinyGPSPlus.cardinal (courseTo)); and how can I connect them with the compass.Please


    Reply 3 years ago

    Serial.println sends information to the Serial terminal on the computer.

    What are you using for a compass?



    Reply 3 years ago

    I use GY-271 Electronic compass .

    I mean How do I use this expression course To with Compass ?


    Reply 3 years ago

    The GY-271 is a sensor that sends information just like the GPS. It shows which direction the compass is pointed.

    What you need to do is write a script (program) to use these sensors. If I remember correctly you are trying to design a robot.

    I cannot write this script for you but here is the how I would do it.

    First you can read the GPS and get the location of your robot. You already know the location that you are trying to get to. With these two locations you can calculate the direction between the two and the distance.

    Next the script can read in the direction that the compass on the robot is pointing towards.

    The script can tell the robot to rotate until it is pointing in the direction you want to go. Next you can move the robot forward.

    Unlike the way you do another GPS reading and recalculate the distance and direction to make sure the robot's going in the right direction.

    When the distance is down to zero then the robot is where you want it to go.



    Reply 3 years ago

    Thank you for your help.