Software, and done!
I wrote the decoder software in AVR C using Atmel Studio. The entire thing can be downloaded as an Atmel Studio project on my Github page.[LINK]
The sofware for the ESP is written in Lua for NodeMCU. It's very basic, it fills a buffer until it encounters a \b (backspace) character, and then sends the buffer through an HTTP POST to a local server on my network. You can then store the messages or whatever.
The decoder sofware has two major modes; it can be used directly by viewing its output on the serial port, or output the relevant data in a 'parseable' format. The first mode can be selected by '#define SERDEBUG'.
Messages are output in a readable format. Parts of the message where errors are detected are highlighted (inverse video). To show these errors, the serial connection should be opened from a VT100-compatible terminal
The decoder is somewhat complicated; as it needs to receive data on all the frames, for all addresses, it needs to keep track of a lot of stuff simultaneously. I tried to reduce the memory footprint by allocating almost everything dynamically, as needed. I'm not sure if it is any better than just keeping some static-sized arrays all around, please let me know if you have suggestions for improvements (or do a pull request!) There are quite a few limitations:
- Long adddresses are not supported
- Bitrates other than 1600/2-level FSK are not supported
- Numeric messages are not supported
- Long messages spanning multiple frames are working, but as P2000 is using mostly short messages, it's not super well-tested. I havent come across a message spanning more than 2 frames, for instance.
- Related to previous: Out-of-order reception of message fragments is unsupported
- Error correction for codewords is implemented poorly. (brute force). The important stuff is 2-bit corrected, everything else is 1-bit corrected due to CPU limitations.
I could probably implement some of these features, but I'm pretty sure I'd make a mistake somewhere. Without a signal to test this functionality with, I am not gonna bother.
Many thanks to:
- Kristoff Bonne (ON1ARF) for his BCH routine
- Andy Brown for his memory debugger functions
- Peter Fleury for his UART library
The sofware for the ESP8266 is written in Lua for NodeMCU. It's very basic, it fills a buffer until it encounters a \b (backspace) character, and then sends the buffer through an HTTP POST to a local server on my network.
Although I encourage everyone interested in this kind of technology to build something similar for learning purposes, I'd like to point out that receiving, storing or sharing these kinds of messages might not be legal, depending on where you live. In most countries you're free to receive any unencrypted transmission, but in some cases you're not allowed to share/broadcast these received messages yourself. There are quite a lot of P2000 websites and Twitter feeds in the Netherlands sharing every single transmission, but I can't help but question their legal status.
Also, I wouldn't want my address broadcasted on multiple websites if I ever need the help of the emergency services either.