Dog GPS Data Logger
by BlackberryJamMan in Circuits > Wearables
2395 Views, 40 Favorites, 0 Comments
Dog GPS Data Logger
I wondered how much distance my working cocker spaniel covers on a walk and decided to build a device that would log her route using GPS.
Supplies
Beitian BE-122 GPS integrated module
Openlog serial data logger (ATMega328)
MicroSD card 8GB (+ card reader)
3.7V 110mAh lipo battery (+ charger)
Lipo battery cable 2 pin 51005 (male and female)
Dog collar
Clear heatshrink tube
Wire
Solder
Notice & Wonder
I spend a lot of time walking my dog in the woods and there are many benefits for both of us. I find the opportunity to exercise in an outdoor space much nicer than a gym (even if it is raining) and the open fields provide unlimited space for a young dog to run off her excess energy at the same time.
Nature Connectedness
Nature connectedness is now well explored by researchers who find that there are benefits for people who take the time to notice the nature around them (Richardson & Sheffield, 2017). Noticing the first bluebells of the year in the shade of the woodland or listening to the song of a skylark provide moments of respite from our busy modern lives.
Often a new flower will catch my eye in a wildflower meadow. I have to admit to using an app that utilises AI to identify it….is that cheating? I embrace the idea of connecting with the natural world and like to apply the principle of Notice and Wonder to observe the moment. Why are those crows annoying the buzzard in flight? Why are those red kites circling overhead? What is my dog air-scenting at that moment? How far does my dog travel compared to me when we are walking together?
This final question made me wonder and I thought about ways to find out. I researched commercially available devices that could track her location and send it back to an app, but I often walk in places where a phone signal is absent. I decided to design and make a bespoke device that could accurately log her route, collecting satellite geolocation data that I could process when I returned home. I was not concerned to be able to locate my dog in real time, as she has been well trained and her recall is good. I was more interested in logging accurate data that I could analyse later.
System Design
When designing a new system, I thought about the building blocks that I would require to collect the data. I would need a GPS receiver to locate the position, a microprocessor to collect this data, an SD card for storage and a battery to power the units.
I had a sort through the parts I could find in my workshop and came up with the following items.
- GPS receiver
- Microprocessor
- Data storage
- Battery power
Now, although this may have worked, it was not a very practical design for my dog to carry as it was too bulky. There are guidelines for researchers who track animals in the wild and the recommendation is that the device should not weigh more than 5% of the animal’s body weight (Kenward, 2001). Of course, I did not want the device to hinder my dog, so I looked at ways to minimise the weight and bulk of the design. After research, I identified a tiny GPS receiver that weighed 3g. It just requires a power supply and when it has a 3D fix (latitude, longitude and elevation) for its location, it flashes a red light. The Arduino and SD card reader were replaced by a single package that would take the data from the GPS receiver over a serial connection and log the data to the card automatically. It had its own microprocessor (ATMega328) on board that would manage this feature as it had been pre-loaded with the code to do it automatically, so there is no need to write any code for this project to work.
The final component was a power supply and I found a lipo battery that had been used in a toy drone that I had managed to crash. A quick search online found an even smaller package that should be able to provide the necessary power for a decent length of time (I thought >60 minutes should be enough).
Testing the GPS Module
The u-blox company designs chips that make use of global navigation satellite systems (GNSS) and they provide a piece of software to help you evaluate their products called u-center.
The receiver needs to be connected to the computer via a serial port, so the easiest way to do this is to use an FTDI device with a USB connection.
The circuit is very simple to wire up. Once plugged into the computer, the device takes a bit of time to get a fix on its location and will start to flash its red LED once it starts transmitting data over its serial port.
Load the u-center software and configure the settings. The connection will be through one of the COM ports and the baud rate for this particular device is 38400 baud.
As soon as the serial communication starts to take place, the u-center software will use it and display a range of information in different formats.
Adjusting the Sample Rate
The default sample rate for the receiver is 1Hz, so it takes a sample of my location every second. This rate would be fine if I was using it to track myself but I wanted to track my spaniel, who darts backwards and forwards quickly. I decided to change the sample rate to 5Hz to see how that worked.
Fortunately, the u-center software allows us to communicate with our device and it is easy to change the settings whilst it is still connected.
From the top menu bar, choose view --> messages view.
Then choose the config --> rate.
The measurement period needs to be set to 200 milliseconds, which will give a sample rate of 5Hz. Don’t forget to SEND these settings to the serial port using the button at the bottom. If you look at the animation panels, you can see the refresh rate has now changed as they are updating faster.
We now know that the GPS receiver works and is receiving accurate data, so a prototype needs to be designed and built.
Breadboard Prototype
I decided to put the circuit together on a breadboard in case I needed to make some more adjustments to the firmware before I was finally ready to solder it all together.
Testing, Testing
A key part of the design and build process should include some thorough testing.
The first test I completed was to put this circuit on my garden table for 10 minutes to make sure that the GPS data was being stored on the microSD card. It worked flawlessly, so I decided to do some more field testing. The first test was a walk around my local park.
This test was simply to walk around the outside track. I collected the data on the SD card and loaded it onto my computer. We need to convert the filetype from a .txt file to an .nmea file. This is a standard format for GPS files and stands for the National Marine Electronics Association.
Once we have the nmea file, we can simply drop it into Google Earth. Google Earth efficiently filters out the junk data to show the track. The device accurately tracked the path around the park, which was only 1 metre wide. The data jumps around a bit at the beginning as it gets a fix on the location, but then its positional accuracy is very impressive.
I thought about emulating my dog’s motion with lots of to and fro type movements and I decided to walk around the park in a zig zag like motion – fortunately, I was the only person there that day.
I converted the second data set to an NMEA file and it looks like it has again plotted the perimeter of the field. It’s only when you zoom in, you can see the fine resolution of the path and it has clearly captured my erratic route. I think these results are excellent.
My final test would be located in a small area of woodland that had some tree cover. I was interested to find out if the satellite signals would be degraded due to the tree canopies, which were in full leaf.
It takes about a minute to get a fix on the location from a cold start, but I can see the red LED flashing, so I know it is sending the location data over the serial link. If we look at the data logger board, you can see the orange LED flashing, which shows that the serial link is receiving data. We are good to go.
This third test shows another good data capture with no degradation under the tree canopy. This means that I can use this device in dense woodland cover. I am very impressed with this little receiver – it cost around £5 plus delivery on Aliexpress.
Now that the first stage of testing is complete, I can build the device into the collar and give it a trial run.
Final Build
The connections are quite simple, so I soldered the wires and plugged in the battery to give it a final check. The receiver is working as the LED is flashing, and so is the data logger.
I used one of those cheap light-up collars that has a flashing LED that lights up a tube inside the double layer of the collar material. I originally thought I would place all of the components inside this collar to keep them protected, but it was a bit too fiddly to thread them inside. As I wanted easy access to the battery connector and also be able to remove the SD card, I decided to encase the components inside some heatshrink instead. I had already adjusted the collar so that it was a good fit for my dog, and then I laid out the components onto the collar to check they would all fit.
A bit of clear heatshrink completed the task, but I just had to cut some slots to access the battery connection and aid removal of the SD card.
Field Trial
So this is the big field trial. I connect up the battery and waited for it to get a fix. I also logged the route using my Garmin handheld GPS.
The collar now has a location fix as the red LED is flashing, so I just need to put the collar on Lucy and we can go for a walk.
This set of data is uploaded to Google Earth and when we zoom in you can see the track that has been logged as Lucy runs around. You can see from the blue line that she keeps coming back to check in. She also explores different areas of the woodland and diverts from the path. There is a particularly energetic track when she met a Labrador and they had a run around in circles for a while as they played.
I overlaid the route logged by the Garmin GPS that I took around the forest and changed the properties of this track to red. My route has been logged at a lower sample rate and you can see a much more direct path. It is possible to look at the properties of this data and find the total distance covered inside the measurements tab.
Logging this data has been a real success. As we fly over the route, it is easy to see the difference between the two tracks in terms of the distance covered.
Data Analysis
This data can also be exported as a CSV file. I saved it and loaded it into a spreadsheet. From there it is easy to sort the data on a column and I found that Lucy had a top speed of 37 km/h (23.3 mph).
So, to summarise, let’s look at the statistics for human versus dog.
My dog travels at least twice as far as I do and her top speed is about 7 times faster than my walking pace.
Final thoughts
A recent study by Richardson et al. (2022) showed that the UK ranked at the bottom of the league table for 'nature connectedness'. There are a range of factors that affect this including the use of technology. Perhaps we need more of a focus on using technology to reveal the beauty of our natural world - don’t forget to take the time to Notice and Wonder, you will be amazed at what you can discover.
Safety note: It is important for the lipo battery to be kept away from water, as they can catch fire. This device should not be used if it is raining, or if your dog is likely to jump into a stream.
References
References
Kenward, R. E. (2001) A manual for wildlife radio tagging. London: Academic press.
Richardson, M. , Maspero, M. , Golightly, D. , Sheffield, D. , Staples, V. , & Lumber, R. (2017) Nature: A new paradigm for well-being and ergonomics. Ergonomics, 60(2), pp. 292–305. doi:10.1080/00140139.2016.1157213
Richardson, M. , & Sheffield, D. (2017) Three good things in nature: Noticing nearby nature brings sustained increases in connection with nature. Psyecology, 8(1), pp. 1–32. doi:10.1080/21711976.2016.1267136
Richardson, M., Hamlin, I, Elliott, L. R. & White, M. P. (2022) 'Country-level factors in a failing relationship with nature: Nature connectedness as a key metric for a sustainable future'. Ambio 51 (11), pp. 2201–2213. doi.org/10.1007/s13280-022-01744-w