Ero sivun ”POCSAG encoder and modem.en” versioiden välillä

Radioamatööriwikistä
Siirry navigaatioon Siirry hakuun
>Oh7lzb
>Oh7lzb
Rivi 76: Rivi 76:


Please note that this command sends the encoded message to the Arduino modem board. No, it can not drive the transmitter directly without a bit-banger modem. The message needs to be quoted.
Please note that this command sends the encoded message to the Arduino modem board. No, it can not drive the transmitter directly without a bit-banger modem. The message needs to be quoted.
To transmit more messages quickly, and multiple messages in a single transmission, you can expand the example pocsag-send to a daemon which talks to the modem constantly. I will probably release a daemon like this together with a future version of the perl module.


[[Category:POCSAG]]
[[Category:POCSAG]]

Versio 31. tammikuuta 2011 kello 09.40

This page documents the POCSAG encoder Perl module POCSAG::Encode, the Arduino-based bit-banger modem used to drive FSK transmitters with the POCSAG data generated by the encoder, and the POCSAG::PISS perl module used to communicate with the bit-banger modem.

Background

We got hold of some Tecnomen HiQ 1000 paging transmitters. Then we bought some programmable paging receivers from Ebay (they're cheap now). And we can run the transmitters on an amateur VHF frequency. But we needed a way to drive the transmitters.

We found source code for a microcontroller-based POCSAG encoder. It would take in a message from the serial line, encode and transmit it. But it could only transmit short messages (POCSAG allows sending pretty long ones), and it would only transmit a single message at a time, which is very inefficient, because the preamble and synchronisation required in the beginning of each transmission is very long when compared to a single short message.

There was also a DOS program to send POCSAG. Needless to say, DOS is a bit out of the question for a networked transmitter solution.

So, something else was needed.

Here's a Youtube video of the Tecnomen paging transmitter with the Arduino modem prototype board - transmitting POCSAG messages successfully using the software available here.

Encoder module

I've implemented a POCSAG encoder in Perl, and packaged it in a proper Perl module, POCSAG::Encode. It's available on the CPAN. It takes in a bunch of text messages, and returns a binary string which should be transmitted, bit-by-bit, using an FSK transmitter at 512 bit/s. The string does not include the mandatory preamble - it is generated by the modem to save buffer space. It also returns any messages which did not fit in the transmission (which has a limited length, depending on the buffer size of the modem), so that they can be put in the next transmission.

It can be used with the modem described here, or using some other software which can turn on a transmitter, and transmit the preamble and the encoded messages synchronously at 512 bit/s.

It's not very highly optimized yet, but it tries to do some message order sorting to reduce the amount of idle codewords needed in each transmission.

The module comes with POCSAG::PISS, which contains an interface to talk to the POCSAG modem described below over an serial/USB line. The protocol is, in spirit, much like the KISS (Keep It Simple Stupid) protocol used on AX.25, but for POCSAG use.

Modem

The reference modem for this POCSAG transmitter has been implemented on top of an Arduino Duemilanove microcontroller board. The board design is open-source, and boards are available from a large number of suppliers around the world, from small local electronic components, with prices ranging from $25 USD to 30€. The newer Arduino Uno should work, too, the only difference is that the FTDI USB serial chip was replaced with an ATmega8U2. Get one with an Atmega328 - the extra memory is useful here. It's also possible to buy just the Atmel Atmega328, put it on a board of your own design (or a breadboard) and save some components and money, if you wish to spend some additional time for that (or just happen to enjoy that sort of thing). It might make sense for larger batches.

The traditional method to transmit synchronous FSK from a PC computer was to twiggle the handshaking lines (RTS/CTS/DTR...) of serial ports, or the I/O pins of the parallel port. That was easy in MS-DOS, but in proper operating systems that typically requires writing a kernel driver. And your average computer no long has serial or parallel ports. The Arduino board has an USB port, an FTDI USB-serial chip behind it, and a microcontroller which can be programmed over the USB. No programmer device required - and the same USB port can be used for communicating with the modem software. It also has a good amount of I/O pins which can be used to communicate with the FSK transmitter.

Hooking up the arduino with the transmitter

#define pttPin 2 // PTT, high = ON
#define fskOutPin 4 // drives FSK on the transmitter
#define fskInPin 3 // received FSK, do not change - must have an interrupt (see below)
#define happyLedPin 6 // happy led output, do not change - must have PCM
#define txFaultPin 7 // TX fault signal input, low = FAULT
#define antFaultPin 8 // ANT fault signal input, low = FAULT
#define ledPin 13 // led pin on the arduino board itself

The pin ordering can be altered, but the happy led needs to be run using a PCM pin, and the interrupt is only available on a few pins.

The Tecnomen transmitter uses TTL level I/O, which conveniently matches the Arduino's TTL levels. The PTT is driven using a transistor, since the Tecnomen's PTT has a pull up and must be shorted to ground. The FSK pins, and fault pins can be wired directly to the Tecnomen. With other transmitters you can ignore the alarm pins (and the alarms coming from the modem), or you can pull them up to +5V.

The ledPin is wired to the small yellow led on the Arduino, not an I/O pin on the Arduino board. The happyLed pin drives the blue led shown in the Youtube video. The red led shown is directly driven by pttPin and the green led indicates power received from the Tecnomen.

The Arduino is only powered by USB in my prototype - not from the Tecnomen host.

Software for the modem

Here's the most recent version of the modem software.

  1. Download it
  2. Upload it to the Arduino using the Arduino development environment
  3. Profit!

Software installation

  1. Install Device::SerialPort 1.04 or later (apt-get install libdevice-serialport-perl, or the CPAN way)
  2. Download POCSAG::Encode from CPAN
  3. tar xvfz POCSAG-Encode-1.xx.tar.gz
  4. cd POCSAG-Encode-*
  5. perl Makefile.PL
  6. make test
  7. make install

Only the last step needs to be run as root.

To transmit your first testing message:

  • tools/pocsag-send /dev/ttyUSB0 123456 'Hello, world!'

Please note that this command sends the encoded message to the Arduino modem board. No, it can not drive the transmitter directly without a bit-banger modem. The message needs to be quoted.

To transmit more messages quickly, and multiple messages in a single transmission, you can expand the example pocsag-send to a daemon which talks to the modem constantly. I will probably release a daemon like this together with a future version of the perl module.