Wednesday, April 28, 2010

POCSAG encoder and 200W transmitter

Lately I've been writing some more code for the amateur paging network project. On Sunday morning I wrote a new POCSAG encoder module in Perl, and on Sunday evening and Monday evening I wrote a simple "modem" for an Arduino card to drive the encoded messages at 512 (or 1200, or 2400) bit/s to an FSK transmitter.

I intend to release most of the bits and pieces as open source, starting with the POCSAG encoder and modem bits. Here's a little video showing the working setup:


As you can see, I haven't grown up enough to not put too many blinking LEDs in my designs. Unfortunately my electronics design skills are mostly limited to calculating the series resistor needed for the LED, so I have to focus my efforts in driving the LEDs from the software in a fancy way. The blue LED does serve a purpose - it shows that the FSK keying timer interrupt routine is working, and indicates it's state. Here's a photo of the Arduino card:


The Perl POCSAG encoder module (POCSAG::Encode) takes one or more messages and encodes them in a binary string. Unlike the other encoders we've found, this one can actually create a long burst with a number of messages, saving a lot of channel time. Only a single preamble is needed, and a lot of idle codewords can be saved between the messages, too.

The burst string is transmitted over USB serial to the Arduino board (the board has an USB-serial chip between the USB port and the Atmel chip) using a protocol which, in theory, resembles the KISS (Keep It Simple Stupid) protocol used with AX.25 packet radio. There are some differences so I've named it PISS, for POCSAG.

The "modem" software on the Arduino waits until the channel is clear, keys the transmitter, and simply sends the bits out through the transmitter's TX data (FSK in) pin. It currently has the usual txdelay and txtail settings hard-coded in the source code. It sends a report back to the host software when the burst string has been received by the modem, and when it has been transmitted, so that the host knows to send the next burst. The Arduino board costs some 20-30€ - if that's too much per transmitter, it's straightforward to just put the Atmel chip on a board alone with an RS-232 or USB transceiver. There are some plans to do just that and design a custom board for the purpose.

The traditional method would have been to drive the FSK out on one of the RS-232 or parallel port handshaking pins. During these days of multitasking and multi-user operating systems it requires a kernel driver, and I didn't quite feel like doing that right now.

The transmitter is a surplus 200W paging transmitter with real FSK keying, configured to run on 144.975 MHz. It happens to have TTL I/O pins, so it can be directly attached to the Arduino.

Erik, OH2LAK, the local repeater builder and coordinator, is also writing about the paging project in his blog. Check out the D-star repeater from a surplus VHF base station radio!

UPDATE 2010-01-31: I finally finished packaging and releasing the software last weekend, and documented it a bit.

10 comments:

Ellery Durgin said...

Do you still plan on releasing the code, I'm working on a project involving the arduino and pocsag and would be grateful.

Ellery
kg4nfs

VSS said...

Hello !

Can you see the program for this project?

Artur sp3vss

oh7lzb said...

I finally finished packaging the software last weekend, and documented it a bit here:

http://wiki.ham.fi/POCSAG_Encoder_and_modem

ON6ZG said...

Hi,

Is it possible to connect the arduino modem to a GM340, if yes, can you tell me the pinout for the GM340 ?

thanx Jan ON6ZG.

oh7lzb said...

Jan,

I happened to connect the arduino to a GM340 just last night. Works! I did a google search for "motorola gm340 pinout", and it quickly got me here:

http://forum.motorola-radio-support.co.uk/index.php/topic,163.msg408.html

So I connected the FSK out pin to pin 5 of the radio, and grounded the ptt pin using a bc547 to transmit. 4.7 kOhm from the arduino's PTT pin to the base of the bc547. The flat tx audio input takes some 100-150 mV peak-to-peak for good deviation, so I used a 10 kOhm resistor and 1 kOhm trimmer to cut the output voltage down from 5V.

I think the GM340 had to be programmed with it's programming software to configure the flat TX audio pin, I didn't do that myself, I was given a preconfigured radio.

I'll draw some schematics later.

ON6ZG said...

Perfect, Thanx a lot. We have some GM340's on the shelf. 70cm ones. so perfect to use with the SKYPER pagers found on ebay.

73 Jan.

Luke said...

I am going to connect motorola gm 340 to Arduino 2009, but I did not understand the links to follow, you can enter the pattern, great job.

73, iw0gri (Italy)
Luke

Ted H said...

Thanks for a great explanation, sounds like a fun project. I'm trying to do the same thing. In an effort to reduce the hardware needed, I'm wondering if the POCSAG::Encode could be done by an Arduino, rather than the Perl program. Any thoughts on this? Perl might be a better choice because of its abilities with strings, but I'm guessing Arduino can do it.

Thanks.

Ted

oh7lzb said...

It can be done in an arduino - our original prototype used an AVR ATTINY2313-20 microcontroller which did the encoding. But it only did like 80 characters in a message, and it was hard do extend to do smarter things such as sorting messages to be transmitted in the same burst, and the general lack of memory limited the length of the burst. The Arduino has more memory, but it's quite limited still.

The length of the POCSAG preamble is 576 bits, a bit over a second at 512 bits/s, so it makes a lot of sense to transmit many messages in a single burst and then keep the transmitter alive for a short while to look around for more messages to be sent. Also, depending your RIC code allocation scheme, you might want to optimize the message transmit order depending on the lengths of the messages and the recipient numbers. The last three bits of the number is not transmitted when a message goes out - it determines one of 8 frames when a transmission to that address can start. The beeper will only power up the receiver to listen for address codewords on the times when such a frame could be sent, and it synchronizes from the end of the 1-second preamble which it has to listen to the end.

http://www.braddye.com/pocsag.html

We're pushing stuff to the transmitter over IP, so the messages were coming in from a Linux box anyway.

Santiago said...

Hi oh7lzb

I'm tring to build similar page encoder as you did, but I have a Motorola SM50, do you know if is doable with this transmitter?

Thanks in advance

Santiago