02 November 2021

Surplus GPS "mouse" receiver and AVR input protection

Somewhere in the back of my mental to-do list I have a project with GPS, NMEA and precise clock (as in hh:mm:ss, not in the digital electronics sense). While I could use the ubiquitous Wi-Fi connection to query an NTP server, I prefer a solution that gets the timestamp without needing a user/password. As a bonus, it tells me the position as well.

A local HAM sells surplus GPS-only receivers (no GLONASS, no Galileo). They require 5V (later found that the range is 3.5V to 5.xV) and speak out NMEA at 4800 baud 8N1. The module inside is one of the GlobalSat series, probably BR-355S4. At least that model number provided a spot-on description of the pinout and existing wiring.

I wired it to a serial TTL/USB adapter and the dongle kept disconnecting from the computer. Both dongles I own. Weird. I needed to see what was going on, so I fired up the oscilloscope. Surprise! The NMEA data out of the surplus GPS dongle is RS-232, with -10/+10V! BTW, I couldn't get the data decoder of the Hantek scope to decode anything out of it.

In order to fix the signal levels I assembled a simple BJT adapter, which also inverts mark/space as in RS-232 logic "mark" (or logic "1") is the negative voltage and "space" (logic "0") is positive WRT ground. In TTL serial, "1" is 5V and "0" is 0V. This let me use the dongle and a GPS decoder software on the computer.

The adapter is 10k resistor into the base of any BJT (BC547, 2N2222, whatever). Emitter to ground. 4k7 from +5V to the collector. You can add a diode between ground and the base, with the cathode on the base side. The diode limits the Vbe reverse voltage to 0.7V. TTL output is at the collector.

The seller told me he could read the data with an Arduino just fine. How comes? Well, many Arduinos use an Atmel AVR ATmega328 processor, whose inputs are protected like this:

Atmel AVR input protection
From an Atmel datasheet, it's all inside the chip.

 

Those two diodes clip the -/+10V right into the AVR microprocessor and everything looks fine, but might break in the future.

Even if I will use the GPS mouse with an AVR micro, I will include the BC547 adapter.