I really like GeoCache but I have always thought that GPS are super expensive for something that should not cost that much money. Therefore, I came up with the idea to make one myself, trying to give it the maximum features possible that others provide while cutting the costs of the material as much as possible.
The idea is to create a DIY GeoCaching GPS:
- With significant good measures, less than 5 meters of accuracy.
- Cheap and popular electronic goods
- Powered by a 3.7V LiPo battery.
- Simple to use iOS/Android App but still working without app
- Finally, easy to build
Starting by a first system architecture
In this starting phase, the ESP32 is powered by the serial connection (5V from PC) and powers the OLED panel and the GPS with 3.3V. The ESP32 is the device that draws more current, up to 150mA with Bluetooth active.
The system uses:
-
A microcontroller, the ESP32. Very cheap and popular, with a lot of flash and RAM compared with alternatives (like PIC32 or STM32). Besides, it has WiFi, Bluetooth and Bluetooth Low-Energy. Perfect for this kind of project. (4€)
-
GPS NEO-6M. Cheap and very available GPS with a accuracy of 2.5 meters horizontally. (4€)
- SSD1306 OLED panel, low current draw and provides a GUI visualization. Useful if App is not installed. (4€)
- Some LEDs to increase user experience (<1€)
Libraries
Luckily, there is a ton of open source libraries out there to this kind of mcu that really makes the job easier:
- To play with the GPS I used TinyGPS++.
- To manage SSD1306 128x64 through I2C I used Adafruit libraries - SSD1306, BusIO and GFX Library.
- To deal with serial ports I used HardwareSerial.
- To use BLE I got the ESP32 BLE for Arduino libraries
Loop
In order to work, this system needs to follow some sequential loop logic.
- Reads GPS coordinates
- Measures distance between desired coordinates and actual coordinates
- Returns measured distance to OLED panel or app
The desired coordinates are received through BLE.
From the above flowchart it’s possible to see 2 two main loops responsible for the behavior of the system. GPS gets values, verifies it and updates current coordinates with new ones. Following, a device is connected through BLE and sends the desired destination coordinates, ending with a measured distance function executed inside the ESP32.
DIY and OpenSource GeoCaching GPS v0.2
03/12/2020
When the first results were out I could see that I had failed in what I once had assigned.
The first prototype worked fine and, in the end, had a great result - it worked. Even only using longitude and latitude, the distance between two coordinates was fine and acceptable. Thing is, even if the prototype works, I can not call it a product without having a great user experience or a purpose.
Bluetooth connection was fine, even though it drained a lot of current (150mA). But, what if the phone controlling the coordinates to send reaches 0% battery? The board becomes useless. So even if the software and the hardware is top-notch, it fails on delivering a reliable user-experience.
To prevent this from happen I created a second version board which allows the user to manually input coordinates, change it or delete it. Also, in case the user doesn’t want to use the phone, it is possible to disable Bluetooth by a switch.
Some minor improvements:
- Every button has a LED connected in parallel, therefore, each time a button is clicked a LED blinks.
- The input 5V pads were changed to screw terminals, more stable.
DIY and OpenSource GeoCaching GPS v0.3
17/04/2021
Although last version (v0.2) already fulfilled a lot of use cases, I completely forgot about the number 0… 🤯 Making it useless to use, only useful to test. Also, the last version was using a pin per button (14 in total), which is something very newbie in electronics. This time, I decided to use a 4x4 matrix keyboard, using only 8 pins to 16 buttons.
Each button has a RC filter, decreasing (by far) the chance of switch debouncing. Some buttons can debounce up to 20ms, so the challenge was to find a RC duo (R*C) with a time constant, at least, 4 times less. This value allows the capacitor to charge/discharge while debounce errors could occur. A value 4 times less of 20ms is 5ms, and using a 0.1uF capacitor, the resistance is about 50k ohms.
This value is fine because a capacitor is 98% charged at 4, so we can assume the logic is HIGH or LOW at that point ().
This whole project is already fits in my new directory structure which I stated in the last post.
Regarding all the information above, here is the Github repository link to this project: