OSOMCOM POCSAG BTS using pic microcontoller

The BTS or Base Transmitter Station is the device that transmit the POCSAG messages to the pager. It is the radio interface of the POCSAG network.

THE HARDWARE

The current version of the BTS hardware is a small board with a pic 18F microcontroller with a firmware that receive commands through an UART/RS232 port, create the POCSAG message and transmit it using the ADF7012 UHF transmitter.

This board has not be designed to be used exclusively with OSOMCOM POCSAG but to be used as a generic low power radio transmitter. Other uses of this board include experimenting with 433MHz keyboards, car/garage remotes, data links, APRS, etc.

The board has been designed to be very cheap (less than 15$) and easy to develop with.

OSOMCOM POCSAG BTSBoard features

  • CPU: PIC 18F14K22 @ 16MHz
  • Memory: 16KB Flash / 512 Bytes RAM / 256 EEPROM
  • Transmission frequency: selectable from 75MHz to 1GHZ (but some parts values may need to be changed. More about this later)
  • Supported modulations: FSK/GFSK/OOK/GOOK/ASK. (FSK is used for POCSAG)
  • Transmission bitrate: selectable up to 179.2 kbps (512/1200/2400 for POCSAG)
  • Transmission power: selectable up to 14 dBm (20mW)
  • UART/RS232 port
  • Debugging/programming port for ICD/PICKIT
  • Expansion port with 4 GPIOs
  • SMA connector for antenna
  • Power: 3.3 volts ; ~50mA
  • Size: 4.4 cm x 4.6 cm

Power supply

The power supply has a very simple and standard design.

The 5 volts input is transformed to a 3.3 volts supply usingĀ  the MCP1700T-3302 low-drop voltage regulator from Microchip. C1, C2 and C3 filter the input and output power.

A diode protecting the input from a reversed connection could be handy, but I didnt put it in the design. I am just confident that the user is not that stupidā€¦

ā€“ Microcontroller

The brain of the board is a Microchip PIC 18F14K22.

ā€“ The radio module

A ADF7012 from Analog Devices is used as radio module.

This handy UHF low-power radio transmissor supports FSK, GFSK, OOK, GOOK and ASK modulation at a maximum rate of 179.2 kbps and the integrated Power Amplifier can deliver up to 20 mW without using an external antenna driver.
An internal PLL with selectable divisor synthesize almost any desired output frequency in a range from 75MHz to 1GHZ using just a 4MHz quartz.

A SPI interface is used to configure the transmisor. Modulation scheme, output power, output frequency andĀ  other transmission parameters are selectable through this interface.

In my opinion, due its versatility, flexibility and simplicity to use, this is one of the best sub-GHz integrated transmisor out there. However, the lack of documentation and examples make it a little bit frustrating to work when you are starting. The datasheet is sometime confusing and sometimes insufficient. For example, it doesnā€™t give a table or graph with the output impedance of the RF output. HOW THE HELL ARE YOU GOING TO MATCH THE ANTENNA IF YOU DONT KNOW THE IMPEDANCE? Of courseā€¦ you can always use a network analyzer and measure it, but unfortunately I donā€™t have access to one, so I just did my best trying to guess the impedance at my working frequency using the schematics of the application examples. They are for different frequencies, but I did an interpolation andā€¦ it worksĀ more or less fine.

I donā€™t want to make a deep explanation of the design process and inner working of the radio module, but I will make a brief description of the function of the different parts. If you need more information, refer to the ADF7012 datasheet.

The Q1 4MHz crystal define the output frequency.
To be more exact, the crystal frequency defines the output frequencyĀ  resolution. The output frequency is a defined with theĀ  equation

Fout = Fcrystal Ā· (N/R)Ā  Ā· OD

being N a 8+12 bits fractional number, R a 4 bits integer number and OD (Output Divider)Ā  is 1,2,4 or 8. The value of N,R and OD are selectable through the SPI interface.
In theory, almost any output frequency is selectable with almost any input frequency, but choosing a lower frequency crystal gives you more resolution and introduces less spurious noise.

In case we use FSK or GFSK, the crystal frequency also defines the frequency deviation resolution:

Fdeviation = (Fcrystal / R)Ā  Ā· (M / 4096)

M (Modulation Number) is a software selectable 9 bits integer number.

The L1 coil controls the VCO frequency. The value of the coil has to be chosen according to the desired output frequency. The current value of 8.7 nH is appropiate to work in the frequency ranges of 70-77.5 MHz, 140-155MHz ,Ā 280-310 MHz and 560-620MHz. If you would like to personalize the circuit to make it work in a different frequency, you have to refer to the datasheet graph and choose an appropiate inductance value.

The Loop Filter formed with C10, C11, C12, C13, C14, C15, R4, R5 and R6 filters the VCO tunning voltage. In practice, the bandwith of this filter limits the maximum transmision datarate. When using FSK, the bandwith of this filter should beĀ  three times the bandwith of the data rate.

The easiest way to calculate the values of the filter is using the ā€œADI SRD Design Studioā€ software availabe for free in the Analog Device website.
For our current needs, a 30KHz filter bandwith has been implemented.

The antenna matching network

As commented before, the RF output impedance of the ADF7012 at 150MHz is an unknow, so the antenna matching is not easy without the proper resources.

I donā€™t have a network analyzer to measure the output impedance so I did some guess and some try-and-error process. The result is not perfectly matches but is good enough as the transmisor signal range is more or less the expected for a 20 mW emission.

Be aware that L4, L6 and L8 are unpopulated. I put those coil footprints in the PCB just in case a fine tuning is required by adding another coil or capacitor in parallel.

If you need to modify the BTS schematic to transmit in a different frequency than 140-160MHz, you have to change this antenna matching network to adapt it to your needs.
If you want to work with 315, 433, 868 or 915 MHz, you can use the matching network recommend in the datasheet.

ā€“ I/Os and connectors

S1 is a push-button that can be used to launchĀ in the firmware some tasks.

SV1 is a RS232 connector to communicate with the BSC or a host computer.Ā  It uses 3.3v signals but is tolerant to 5v. You can use a RS232 TTL ā€“ USB bridge to connect the BTS to your computer BSC system.

SV2 is a General Purpouse I/O port. It has 4 free GPIOs that can be connected to any sensor or system. GP1 is also an analog input, so an analog sensor like a temperature sensor can be connected.

SV3 is the ICD debug port. The microcontroller can be programmed or debugged with an ICD, PICKIT or similar device.

THE FIRMWARE

The last version of the firmware can be downloaded here.

The firmware has been written in C using the MPLAB X IDE and the XC8 compiler in free mode. It is important to compile it using the version 1.20 or superior of the XC8. Earlier versions dont optimize the code and the binary will not fit into the microcontroller.

The main function of the firmware is to transmit POCSAG encoded messages. However, in the firmware source there is a complete library to configure and control the ADF7012 radio module, so it would be easy to modify the firmware to transmit using other digital protocols.

USAGE AND COMMANDS

The best way to use the POCSAG BTSĀ  is connecting it to a device or computer running the Osomcom POCSAG BSC software and let the BSC to control the BTS. However, if you need something simple you can just connect the BTS to your computerā€™s RS232 portĀ  using a USB-RS232 converter and use a terminal program to send commands to the BTS. The current firmware putsĀ in the RS232 port a command consoleĀ  that can be used to configure the BTS and send messages.

The configuration of the RS232 is 9600 Bauds 8-N-1.

The current available commands are:

ā€“ SEND (A|N|I) RIC MESSAGE:

Send a POCSAG message to the specified RIC. The first parameter indicates if the message has to be send like an Alphanumeric message, a Numeric message or an Idle message.

An hexadecimal representation of the sent batches is printed.

ā€“ CONFIG [PARAM] [VALUE]:

The config command without argumentsĀ  prints a list of the configurable parameters and their current value. To set a new value, send the parameter name and the new value with the CONFIG command.

This is the list of the available parameters:

  • FREQ: Frequency in Herzs. If you set a frequency that is not reacheable by the BTS hardware, it will complaintĀ with a ā€˜Init errorā€™ message when it start to transmit (SEND, START_MS or TEST command).
  • DEVIATION: FSK deviation in Herzs. In POCSAG, the most common value is 4500.
  • BAUDS: 512, 1200 or 2400.
  • POWER: The RF output power. The value is in the range between 0 (-20dBm) and 32 (13dBm).
  • MS_SAVE_FREQ: Number of RICs between status saving when doing a ā€˜Mass Sendā€™ (more info below)
  • MS_DELAY: wait time in milliseconds between the transmision of two batches of 8 messages when doing a ā€˜Mass Sendā€™.

ā€“ SAVECFG:

Saves the current config in the EEPROM. The configuration is restored when the board is powered.

ā€“ LOADCFG:

Restores the config stored in the EEPROM.

ā€“ START_MS START_RIC STOP_RIC:

Start a ā€˜Mass Sendā€™. It sends a message with a single ā€˜Aā€™ character to all the RICs between the START_RIC and STOP_RIC. It is useful to scan RICs, when you donā€™t know the RIC of your pager.

8 messages for 8 consecutives RICs are packed and transmited in a single POCSAG Batch. Between two batches, some time defined by the MS_DELAY config parameter is waited.
Every MS_SAVE_FREQ number of RICs scanned, the current status of the Mass Send is stored in the EEPROM. In case the power supply is disrupted, the firmware will automatically continue with the Mass Send from the last saved status.

STOP_MS:

Stops the Mass Sending.

ā€“ RESUME_MS:

Continue with the stopped Mass Sending.

ā€“ STATUS_MS:

Shows the current state of the Mass Send (current RIC and stop RIC)

ā€“ TEST [0|1|2]:

Transmits a continous test signal with the selected pattern: ā€™000000ā€¦ā€™ (TEST 0), ā€™111111ā€¦ā€™ (TEST 1) or ā€™101010ā€¦ā€™ (TEST 2).

I use this function to know if the ADF7012 is transmiting at the desired frequency and deviation.

ā€“ STOP_TEST:

Stops the transmition of the TEST signal.

OSOMCOM POCSAG BTS

TROUBLESHOOTING

If you have problems making the BTS to work, check the next things:

ā€“ Is every thing correctly connected/soldered? Double check the soldered parts. Are them the correct parts?

ā€“ Is the microcontroller programed?

ā€“ Is the board being powered with a 5 volts power supply? Anything between 3.7 and 6 volts should be OK.
You can know if the board is being correctly powered because one led will be light.

ā€“ Connect the BTS board to your computer using a USB-RS232 board. Open a terminal program and set it to 9600 bauds, 8-N-1. Power the board and you will see a welcome message (ā€˜Osomcom POCSAG 0.3ā€²). If you send any string, the board will respond with a help menu.

If you canā€™t make work the RS232 shell, you probably have a problem with the microcontroller. If you can get the shell but you canā€™t transmit anything, the problem is probably in the radio module.

ā€“ Check if there is any transmission. The best and cheapest way to do this is using an RTL-SDR dongle. I use it like an spectrum analyzer.
Open the command shell, configure the desired frequency and deviation and use the TEST 2 command to generate a test pattern signal.

If it says ā€˜Init Errorā€™, the BTS canā€™t reach the configured frequency. Choose another frequency or if you are interested in transmitting in that one, modify the schematics (the VCO coil and the antenna matching) as suggested in the Hardware section.

 

For more detail: OSOMCOM POCSAG BTS

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter