After a few years of golfing, although my score is still not very good, I found that knowing the distance to the hole and how far I hit with the club helped me to choose a club better. There are commercial products to do this, but I wanted to make one for myself.
I have searched for small enough components to fit in a small plastic box (45mm x 30mm x 11mm inside) for golfing. Here is the list of the components for the gadget.
- Plastic box: Hammond 1551F
- GPS: PA6C
- Display: OLED 128×64, I2C
- Battery: LiPo 150mAh
- Two push button switch with a little high actuation force to avoid accidental press
- Microcontroller: Arduino bootloader (internal oscillator, 8MHz) loaded ATmega328p TQFP
- Battery charger: MAX1555
- PCB: 0.8mm thick with 2oz copper, designed with Eagle, used OSH Park to make 3 boards
The functions and requirements I thought about the gadget are listed below.
- When powered on
- Display date and time
- If you are moving faster than 3km/h (like driving or walking), shows speed and bearing
- Menu is ready to start playing golf
- Before starting
- Choose a course to play
- Select starting hole, front or back
- Display following information while playing golf.
- Hole number
- Current time
- Distance to the hole (center of the green) in yard
- Distance from the last shot (to see how far I can hit with the club I used) in yard
- Total number of shots
- Number of shots for current hole
- Automatic advance to the next hole
- Change hole to play manually at anytime in case you need to skip a hole or the automatic advance didn’t work properly (for example, you moved around the green back and forth to find the ball or forgotten club or whatever)
- Subtract a shot from the total number of shots in cases of a shot added by mistake
- Battery should last at least 5 hours
- Two push button switches for menu and select
- Programming port for improving the program, adding new course data, and battery charge
- When the battery voltage drops below 3.5V, replace time on screen with “LOW”
Once I get a chance to play, I will find more functions to add (or remove). Hopefully it gets warmer soon.
So, here is the schematic diagram.
Here is a little story about my experiences with the PCB fab houses. I used to order my PCBs to Seeedstudio. It was a few years ago when I ordered the PCB from there and the shipping fee was inexpensive although it took a little longer for delivery. Late last year, my son designed his first PCB and I helped him to order the PCB. I have also used OSH Park some time ago, so I compared the services between Seeedstudio and OSH Park. Since the PCB size was a little big (few inches by few inches), so I picked Seeedstudio which was cheaper. But later, I found they don’t offer regular mail to Canada anymore. They only offer express shipping options. That was even more expensive than for the PCB itself, but I wanted my son to get the board as quickly as possible, so ordered the parts to Seeedstudio. Later I found I needed to pay brokerage charge for custom. Bad bad experience. I will never use them anymore. Compared to them, OSH Park is amazing. For this small size PCBs, I paid just about $10 with free shipping to anywhere in Canada and US. It also took less than 2 weeks.
Here is the picture of the PCB. I don’t really like purple, but purple is their default color. But the color is not that important anyway.
And some pictures of assembled.
The plastic housing material is transparent with blue tint, but the surface is not smooth and has some texture. So, I had to sand the surface for better visibility for the OLED display. As you can see in pictures below, there is no problem to read numbers.
I was planning to add a micro SD card reader so that I can enter new course coordinate data from my laptop by simple text editing. But I changed my mind. First, there is no more space in the package for the SD card reader. Secondly, I won’t need to add new courses that often. Currently I have 4 courses around my place in the program. The 18 hole coordinate data is stored as 3 dimension array with float type. So, it will take only 144bytes (4bytes x 2 (latitude and longitude) x 18holes) per course. The compiled program occupies about 61% of the program storage area and there is still over 11kbytes.
For the OLED display, I used the library from Rinky-Dink Electronics. I’d like to thank him for sharing the library. It’s very small and fast. I also used the fonts found from his website and modified a little bit for narrower size.
I wrote my own GPS data parsing function. It reads only GPRMC data and parses date, time, and coordinate. I have used this parsing function previously in this post.
Regarding the distance calculation, I have developed a simple formula some time ago. It works pretty well even for short distance. See this post for more detail.