Something I use more often in my HAB trackers these days is TDM – Time Division Multiplexing – where instead of transmitting continuously, each tracker transmits only during particular time slots. Since trackers always have a GPS receiver, this just requires software to sync the transmissions with GPS time. The advantage vs continuous transmission is that multiple trackers can share the same frequency, meaning that several trackers can be received by each receiver.
Once when I did this, I noticed that two trackers seemed to be using different times. The problem was that one tracker was using UTC, as sent by the GPS module in NMEA messages such as $GPGGA, but the other tracker was using GPS time from a UBlox UBX binary message. UTC is currently 18 seconds behind GPS time, and is sometimes adjusted with the addition of leap seconds to match the rotation of the Earth; GPS time is not adjusted. I adjusted my UBX tracker to match UTC time.
To make it easier for me to test that TDM trackers are transmitting at the correct time, I thought of having a small GPS clock on my desk. There are other uses of course, so it would be a useful thing to have. I thought I’d be able to find something ready made but couldn’t, so I decided to make one.
Thingiverse
When I bought my 3D printer, I wondered how much I would actually use it. That was a couple of years ago and I’ve found that it’s been much more useful than I thought, from making coasters, little cats for my wife, phone holders, and more recently cases for electronics projects. There are some online repositories for designs that can just be downloaded, converted to printer files, and then loaded onto the printer. So I searched the Thingiverse site and found this little housing for a 1.3″ OLED display which I thought would be about the right size for a little clock, with enough space to include a GPS receiver:
The design comes as 2 files, one for the case and one for the base. So I downloaded both into Cura, converted them into print files for my 3D printer, and sent them to the printer.
3D Printing
My printer is a Geeetech A10M which I bought because of its dual print head, meaning that it can make models that either mix 2 colours, or are partly made in one colour and partly the other. It turned out not to be a great decision, because that mixing head was more trouble than it was worth – the convoluted path and non-return valves necessary for such a design cause the head to jam up more frequently than a much simpler non-mixing head. So I’ve swapped out my mixing head for a non-mixing one.
My printer generally stays in my work shed, so rather than take print files to it on an SD card, I have the printer controlled from a Raspberry Pi 4B running OctoPi. I can then send print jobs to it via the web interface, and monitor the print throughout.
Since prints can sometimes fail – if the print base plate isn’t properly levelled then the print can be a ball of string in the air, or I’ve had the reel of filament jam – then it’s good to have a view of the printer in action. I’ll probably add a Pi camera for that, but for now I use a Reolink pan/tilt/zoom camera connected to the WLAN in the shed.
Finally, so I don’t have to go down to the shed to power the printer and Pi up, they are powered through a TP-Link Kasa “smart plug”. These are great, and I have several around the house for things that aren’t used often and would have a significant cost of powered when not in use. I can switch any of these on or off, and even monitor power consumption on some of them, via a phone app.
Electronics
The case that I printed houses a 1.3″ OLED, so I ordered one of those from Amazon for next day delivery. The case was also designed for a particular CPU board, but I have plenty that will do the job for my application, including an AVR 32u4 board that is small enough to fit in the case, and has USB power already. Finally, I removed a GPS module from an old unused tracker. The connections are straightforward:
- GND from AVR to GPS and OLED
- 3V3 from AVR to GPS and OLED
- SDA from AVR to OLED
- SCL from AVR to OLED
- Rx from AVR to GPS Tx
I didn’t connect the AVR Tx to GPS Rx as I don’t need to send anything to the GPS – it certainly doesn’t need to be put into flight mode!
Software
The case is intended for use as a status display for OctoPrint, for which all the source code is available. I might even make one the same to monitor my own prints! For this project though, I just need to scrap together some GPS and OLED code from my own tracker source.
You can download the code from here. It’s pretty simple:
- At startup it sets up the OLED
- At startup it draws the display, with zero time of course
- Main loop checks for GPS data
- Incoming GPS data is split into lines
- Lines are checked to confirm checksum OK
- GPGGA lines are parsed; others ignored
- Time and number of sats are extracted from GPGGA message
- Once a new GPGGA message has been received, the display is updated
- Display shows time in a large font, plus a bargraph showing number of satellites.
One point to note is that the OLED mounts upside-down in the case, so the software rotates the display to suit.
Build
This part is very easy, as the 3D model takes care of the case and OLED of course.
The case does have a slot for the intended CPU board, but mine was smaller so I just used a hot-melt glue gun to mount it on the base of the case. The GPS was then mounted just above, with coax connecting it to an SMA socket mounted on the back of the case.
The Result
And on my desk …