Electronics
Test Circuit 1: PetSafe Collar Trigger Circuit
Although this had already been done before, I wanted to try it myself. I got a PetSafe collar and the items listed by whyameye on Instructables which was basically two 555 timers and the correct resistors and capacitors to generate the specific frequency for the PetSafe collar. This breadboard circuit worked perfectly, but being an Arduino guy I also tried the Arduino based configuration developed by crazy1gadgets on Instructables. This also worked so I decided on a GPS and made my first prototype board. It was basically an Arduino Uno Shield that included a GPS and a transistor for outputting to the antenna.
(Not-so) Functional Prototype 1: Arduino
I ordered this pcb from my favorite pcb manufacturer OSHPARK, and ordered a Sparkfun Copernicus II GPS. I connected everything and made up a basic code using Arduiniana's TinyGPS to read the location data. When I got everything soldered into place, I couldn't seem to make it work. I could not receive data from the Copernicus II. After much head scratching and reading the user manual for the GPS I found out that supply and logic voltage should be 3.3V not the Uno's 5V. I had fried the GPS...
Test Circuit 2: GPS + Processing Circuit
At this point I either needed to find a way to convert between logic levels or find another microcontroller that ran at 3.3V. That is when I found the Particle Electron. It is faster, connected, and runs at 3.3V. I decided to go this route. I was stuck in this area for a while. More info on this in the Software Section.
Functional Prototype 2: Particle Electron, Copernicus II GPS, and 555 Timers
This is the current design V008. The pcb includes multiple RGB LEDs, a buzzer, and all of the essential control circuitry. You can purchase the PCB through OSHPARK via the link in the links section.
Software
GPS Parser:
Since I chose to use open source hardware and software, I used Arduiniana's TinyGPS Parser.
Fencing Algorithm V1:
For the first proof of concept software, I simply created a bounding box based on a min and a max of both latitude and longitude. Obviously, this has a lot of limitations, but it worked well to prove the concept and move the project to the next stage.
Fencing Algorithm V2: Utilizing Point in Polygon Algorithm
I again borrowed this code, but it works excellently. I will go into detail on how this works later, and explain it by running the algorithm through a few loops. It wasn't until I did this on a few sheets of paper that I truly understood how it worked.
Looks like this project has been idle for a while, but I am interested in doing something similar and including LoRa radios for communicating back to the internet. Im curious how I would be able to add a proximity alarm, so the dog would get an audible warning when they are 10 feet or so from the boundary. Then if they cross the boundary they receive a vibration correction.