Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Homemade GPS Receiver (2013) (aholme.co.uk)
184 points by brian-armstrong on June 25, 2018 | hide | past | favorite | 33 comments


DSSS [1] is really interesting and worth reading up on if you’re already familiar with LFSRs. To summarize, you start by generating a deterministic, pseudorandom, periodic sequence. You then take your message and modulate (bitwise XOR) each bit of the message by the entire sequence e.g. if my sequence is 31 bits long, then my message modulated is now 31x long.

The receiver just correlates the received message by the pseudorandom sequence. The correlation gives me what each bit is and a belief/probability for that bit.

This works really well because the sequence is orthogonal to just about every other sequence (it’s white noise!). It’s even orthogonal to time shifted versions of itself, meaning that it does well at rejecting multipath distortion.

1: https://en.m.wikipedia.org/wiki/Direct-sequence_spread_spect...


Another cool thing, that was counter intuitive to me is that more than just rejecting multipath, spread spectrum can actually make use of multipath to improve the link (although I doubt it is done much in practice).

Conceptually, what you do is correlate on the incoming signal like normal, this first lock is the dominant path. You take the component that correlated and subtract it from the incoming signal and correlate again on what remains. This lock is the second multipath. You can do this to recover as many multipaths as you want or have dynamic range for. Finally, the relative offsets in the correlations tell you how to re-align all the multipaths in time. Once they are aligned you can sum them together and get more SNR than if there had been no multipath at all.


Yes, this is really cool! If anyone’s curious, this is called a rake receiver https://en.m.wikipedia.org/wiki/Rake_receiver


This seems like a common sort of trick in electrical engineering. XLR cables used in professional audio have three conductors to carry a single signal. Why? One of them exists purely to collect interference - the same interference that affects the primary transmission. The equipment on the other side subtracts it from the primary signal to get a clean result. This is why hundreds of feet of unshielded cable can still sound fine.


This is called balanced input/output. TRS connectors are also quite common, especially for interconnects. I find TRS/XLR combi sockets [0] used for this purpose fascinating :)

Third wire does not collect interference in a balanced line. Instead, voltage signalling balanced line uses one ground and two signal lines of opposite polarity and input is difference between these two signal lines. Induced interference is more or less the same on both signal lines, therefore cancels out. At a quick glance this article [1] seems to explain this without delving into electronics. Some differential lines (e.g. RS-485, popular in industrial automation) use current signalling thus requiring two wires per signal.

[0]: http://www.cliffuk.co.uk/products/combijacks/combijacks.jpg [1]: http://www.aviom.com/blog/balanced-vs-unbalanced/


> Some differential lines (e.g. RS-485, popular in industrial automation) use current signalling thus requiring two wires per signal.

Virtually all high-speed digital communication uses differential signalling.


Agree on that, but all high speed interconnects I know use voltage signalling.


That's orthogonal to differential or single ended, but typically the transmit side uses some form of current steering; it just goes well with it.

E.g. PCIe transmitters are HSCL, which is a form of current steering that gives the receiver exactly the voltages it needs to see at nominal currents and termination values.



No, DSSS is a modulation process rather than a signal-shielding process. The difference is that differential signalling can be converted to single-ended with a simple subtraction (or other passive techniques), but recovering DSSS requires digital signal processing.

In fact, he's got a nice little simulation of generating a "gold code", adding noise and multipath distortion to it, feeding it through an I/F mixer, quantising it, and recovering the original code. http://www.aholme.co.uk/GPS/SRC/2011/C++/Simulation.cpp


XLR is bipolar/differential. It sends +sig and -sig on the two conductors.

The receiver inverts -sig and adds it to +sig.

Any noise appears in both lines and is subtracted to zero, leaving 2 * sig.


Exactly.


That's incorrect, the line driver for an XLR output is simply a polarity inverter that exposes both the original and the inverted signal at the same magnitude. The trick is that both lines are equally affected by the interference, you invert the inverted signal again on the receiving end resulting in 2x the signal and 0x the interference.


That's just one of the possibilities. You can either do the cheapo one-line-driven-by-inverter trick, or use a transformer or a differential line driver (like 8903A output stage); basically the opposite of an instrumentation amp. These behave pretty much the same as a transformer, i.e. they have high common mode output impedance. Available in chip form as well, e.g. DRV135.

Problem is the circuit needs very accurate resistors and needs to be carefully balanced, just like an instrumentation amp.


Sorry, what’s different here? The second line is there so that its signal can be subtracted (inverted + added) from the first line, no? I guess I didn’t realize it also had the the inverted audio signal on it, though, thanks.


Is there any reason that prevents audio from being transmitted digitally with zero quality loss? Why can't the digital-to-analog conversion be performed as late as possible? Inside the actual speaker, for example.


You can; it’s just expensive. With Dante-compatible gear all the way through, for example, you could have ADC in your wireless mics and DAC not until your powered speakers. A high-end tour or auditorium built in the last few years might have that stuff. But analog gear still works fine, is more serviceable, is a lot cheaper, and is usually brought over to digital one system at a time (the biggest gains come from digital mixing boards).


there are pro speakers with digital inputs (not just for a clean signal, but usually to do some digital correction for the speaker response) but then you are stuck with that DAC, amp and speaker combination, and you either need a volume control at the speaker or you are losing bit depth by turning down the digital signal.

The opposite also exists - a “digital stage box” to convert analog signals from mics and instruments to digital as soon as possible.


I wonder how many orthogonal codes exist? The Walsh codes in CDMA have a pretty low correlation, as long as they all stay synchronized.


This is impressive enough, but his other projects are also awesome and totally worth a look:

http://www.aholme.co.uk/Projects.htm


Thanks for linking this - I didn't even think to look and his work is amazing!


Indeed, I was impressed just by his PCB layout... it's so neat with that big Spartan-3, while I struggle to make tidy layouts with a simple 32-pin TQFP chip. And that's probably the simplest part of this project.


Even more amazing - these are part-time hobby projects.


Further work in this space: https://gnss-sdr.org/


See also previous discussion from 3 years ago: https://news.ycombinator.com/item?id=9470376 (55 comments)


should have [2012] tag.


Or perhaps 2014, as it contains an update from September 2014.


[flagged]


How in the world is not having the year in the title, especially for this article, 'clickbait'? I could understand if the article was "Germany invades Poland" and they left out [1939], but come on...


HackerNews: threads may contain up to 25% "posts whining about titles" by weight.

(it's a seriously endemic problem here and it's worthless white-noise.)


France invades England [1066]


Mexico thinks about invading the white house [2018]


Could you please stop posting unsubstantive and/or inflammatory comments to Hacker News?


Maybe you should shadow ban me if the downvotes are not enough...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: