Packet Radio on a Raspberry Pi – Part 1: setup

I’ve just got hold of a Raspberry Pi, and my first thoughts were that it would be interesting to try to get a nice packet radio station working without the overhead of a full computer running it. I’ve experimented in the past with linux based systems but not progressed too far. I regret missing the popular period of packet, which seems to have died in the Internet age, but suspect that there might be some latent interest such as mine with a bit of encouragement.

Prepare your Raspberry

Basic setup following recipe from https://projects.drogon.net/raspberry-pi/initial-setup1/ I used Win32DiskImager and a Kingston 16GB ultimate 100X Class 10 card I would then advise tidying things up following https://projects.drogon.net/raspberry-pi/initial-setup2/ It’s then always good practice to update aptitude and upgrade any packages:

sudo apt-get update
sudo apt-get upgrade

The upgrade command will likely take some time as it recompiles all the upgraded packages, but you’ll be left feeling warm and fuzzy that everything is bang up to date.

Prepare the TNC

To start off with I’m using a hardware TNC and may progress to using soundmodem and a USB soundcard later.

I have a PacComm Tiny-2 Mk2, and I have previously made interface cables for a variety of radios, I also have RS232 cables to connect to PC. Google will help if you need it here.

To confirm everything is working, connect a PC to the TNC, then using a terminal emulator such as Putty check that the radio and TNC are working correctly. When the TNC is powered on you should see a stream of boot text, and you should be able to enter commands to set callsign etc. With the radio tuned to the 2m APRS frequency 144.800MHz you should hopefully see some APRS data packets coming in.

Raspeberry RS232 interface

The UART pins on the GPIO header are at TTL levels and need converting top be able to be used as an RS232 interface. The device for the job is a MAX3232CPE which is  a variant of the MAX232 serial buffer which tolerates 3.3v inputs.

I found a neat shortcut to building my own interface circuit was to buy a ready-made board from eBay – part no JY-R2T it comes complete with 9pin D connector, activity LEDs, a header connector and a short cable that allows you to plug in to the relevant pins on the Raspberry – perfect!

Connections for my interface board to the GPIO header are:

(GPIO)          (MAX3232 interface)
Pin 1 (3.3v) -> VCC
Pin 6 (0v)   -> GND
Pin 8 (TxD)  -> TXD
Pin 10 (RxD) -> RXD

The Debian image we installed will have the UART configured to provide a console on the serial port – we want to be able to use it for our own purposes. If you followed the second Drogon recipe above, we have already commented out the getty line in /etc/inittab, but we also need to change /boot/cmdline.txt – remove the parameters ‘console=ttyAMA0,115200 kgdboc=ttyAMA0,115200’ and reboot.

Finally, for testing the interface, let’s install a terminal emulator and connect to our TNC or a PC running Putty. For the PC a straight pin-pin male-female 9 pin d cable should work. Connecting the Raspberry to the TNC with my serial interface board required a crossover male – female cable where tx and rx lines cross.

sudo apt-get install minicom
minicom –b 9600 –o –D /dev/ttyAMA0

If all goes well, you should have the same console access to the TNC that you had with Putty under Windows.

Advertisements
22 comments
  1. Reg said:

    “I regret missing the popular period of packet, which seems to have died in the Internet age”

    It was not the internet that killed one-to-one packet, but the RSGB. They forced the use of narrow channel spacing, requiring the reduction of deviation. Thus signal paths that were very good became impossible.

  2. John Domville said:

    More info on the eBay board JY-R2T. Could not find it
    John – KC2EQ

    • m0hpj said:

      JY-R2T is the markings on the board I bought – but there are several others, try searching ‘max3232 converter’. Make sure it is 3.3v compliant though, and ideally should come with the connection lead to allow you to plug it straight on to the rpi gpio pins.

      Better image of board in-situ – click here

      JY-R2T

  3. John Domville said:

    Found them on second search. Should have them next week, packet shortly after, hopefully.
    Thanks

    • m0hpj said:

      Good luck.

      I have a follow-on post planned – xastir worked out of the box but I really wanted to run AX25 and that required a recompile of the kernel to get relevant modules.

      That’s working and I’m now trying to sort soundmodem.

      If you want an image of my AX25 build let me know.

  4. Chris said:

    Interesting project, I’m considering moving my APRS iGate on the Raspberry.Pi to free up the laptop.
    Did you consider interfacing the GPIO connectors directly to the TTL pins on the back of the Tiny2? I would assume they have compatible voltage levels but I haven’t found anyone that has tried it yet.

    • m0hpj said:

      I haven’t tried that yet – but I’d immediately suspect that the levels would NOT be compatible – the Pi uses 3.3v as logic ‘1’, I suspect the Tiny2 would be good old fashioned 5v before low power was the hot topic.

      Also, I’m not at all sure what infromation the TTL pins bring out (presumably you’re talking about that row of pins next to the DIN?) and the benefit of using these over the RS-232 interface.

      • Chris said:

        Quoted from the TINY-2 MK-2 manual (for reference to others):

        TTL Serial Port
        The TINY-2 MK-2 packet controller is designed to operate with computers which have TTL level serial ports without requiring the use of an RS-232C adapter. This includes computers as the Commodore VIC-20, C-64 and C-128. TTL signals are routed through an 8 pin connector on the rear panel. TTL signals must be greater than +2.4 volts in one state and less than +.4 volt in the other state.

        Use caution in connecting the TTL cable to insure that pin one of the cable is attached to pin one of the connector. Pin one is marked on the rear panel of the controller. Pin one of the cable connector is with a red stripe. Be sure to observe this marking both in constructing and attaching the cable.

        TTL serial port signals used by the TINY-2 MK-2 controller

        P3 Signal Name Description
        1 Receive Data Serial data to computer from the TINY-2 MK-2
        2 Carrier Detect Goes high when connection exists
        3 Frame Ground Common ground for case and data lines
        4 Clear to send Computer signal clearing controller to send data
        5 Transmit Data Serial data to the TINY2- MK-2 from computer
        6 Ground/+5vdc Selectable by JPC Ground or +5vdc for Coax Lan.
        7 Request to send Controller signal to computer when data is ready
        8 NET/ROM Signal Signal used by NET/ROM form serial port control

        —-

        I also have a TINY-2 (Non MK2) manual, in that it states that Pin 8 is no connection and Pin 6 is only for ground.

        I assume on the Raspberry PI GPIO Pin 10 (RxD) would go to Pin 5 on the TINY2 TTL and Pin 8 (TxD) goes to Pin 1 on the TINY2 TTL.

        I have not tested this yet as I’ve still to setup my Rasp.pi access the GPIO with Xastir. Its next on my todo list along with trying APRX.

        Chris, MM1PTT

  5. Andrew said:

    Hi you have any problems with the JY-R2T receiving Data from the TNC ?
    only my board I can see the Pi sending data to the JY-R2T as the TXD LED flashes but I don’t get any response back from the TNC ?

    Andy GM7GDE

    • m0hpj said:

      Hi you have any problems with the JY-R2T receiving Data from the TNC ?

      No problems once I got the cable correctly made – data flows in both directions.

  6. m0hpj said:

    Since I started playing with computers around 25 years ago, I seem to have been constantly flighting against different configuration of serial cables – 9 pin / 25 pin, male / female, straight / crossed / null-modem. Unlike usb cables that tend to work on everything, an RS232 cable that works in one application rarely works in another.

    I realised that the information in my orginal post regarding configuration of the RS232 cable is a bit subtle so I’ll expand on it here:

    To connect the serial converter to a PC, a commercial ‘off the shelf’ moulded 9pin male – 9pin female RS232 extension cable (striaght pin to pin connections) worked for me.

    To connect the serial cable to a TNC the same cable will not work – it still is male – female, but the tx and rx lines need to cross – i.e. tx on the Pi adapter connects to rx on the TNC and vice-versa. You might also find that to get the TNC to send data you need to short RTS to CTS at the TNC and also DTR to DSR – i.e. ‘null modem’.

    In my case I just keep fiddling with various combinations and permutations until it ‘works’ – key debugging tools are minicom on the Pi (as per the last paragraph in the blog post), keep power cycling the TNC which should send out a nice series of strings announcing the device – when that works hit return on the Pi and the TNC should send another ‘cmd:’ prompt.

    If you’re still beating your head against a wall, try various combinations of baud rate, parity and stop bits. The settings listed above are those that worked for me.

    If it was too easy it would be no fun!

  7. You could save some time by using a USB to serial converter. The new Raspbian OS uses a kernel with the Amateur Radio bits compiled as modules:
    root@ka7u-pi:/# lsmod
    Module Size Used by
    rfcomm 33168 0
    bnep 10574 2
    bluetooth 193568 10 bnep,rfcomm
    rfkill 18202 2 bluetooth
    netrom 36862 2
    mkiss 9203 2
    rose 40657 18
    ax25 55238 17 rose,mkiss,netrom
    pl2303 8684 1
    usbserial 32890 3 pl2303
    leds_gpio 2235 0
    led_class 3562 1 leds_gpio
    root@ka7u-pi:/# modinfo ax25
    filename: /lib/modules/3.6.11+/kernel/net/ax25/ax25.ko
    alias: net-pf-3
    license: GPL
    description: The amateur radio AX.25 link layer protocol
    author: Jonathan Naylor G4KLX
    srcversion: 455928C793F8EBCFF3D540E
    depends:
    intree: Y
    vermagic: 3.6.11+ preempt mod_unload modversions ARMv6
    root@ka7u-pi:/# fpacnode

    FPAC-Node v (built 3.27.19-Beta-230) ka7u-pi

    callsign: ka7u
    Welcome to the KA7U SheevaPlug FPAC node.
    This is an experimental system running on a Raspberry PI
    in Weiser, ID.

    FPAC-Node v 3.27.19-Beta-230 (built Feb 18 2013) for LINUX (help = h)

    KA7U-3 (Commands = ?) : c k7oji-7
    Trying (netrom node) BUTTE:K7OJI-7… Type to abort
    *** Connected to BUTTE:K7OJI-7 (Escape: ~. )
    info
    BUTTE:K7OJI-7}
    Welcome to the TVRA X-1J4 Packet Node.

    c k7oji-10
    BUTTE:K7OJI-7} Connected to K7OJI-10
    [WL2K-2.7.6.2-B2FWIHJM$]
    ;PQ: 36780300
    Halifax CMS via K7OJI >
    bye
    Disconnecting…
    BUTTE:K7OJI-7} Welcome back.
    bye
    *** Reconnected to KA7U-3

    KA7U-3 (Commands = ?) : bye
    root@ka7u-pi:/#

    We have been using the Raspberry PI and before that the Sheevaplug as Packet Radio FPAC servers that include the Rose, NetROM, saxIgate, and Winlink RMS Gateway for a while now, and for the most part these little computers have worked well. I don’t know if any of this is of interest, but if it is, let me know.
    Ron Morell

    • m0hpj said:

      Yes I probably could have used a USB to serial converter, but TBH I fancied trying to get the onboard USART working. Each to their own?

  8. I’m curious if your serial connection provides you with a serial console while U-Boot starts the system. Are you able to watch U-Boot or can you achieve the U-Boot console from a direct serial connection? Probably not, as I think a JTAG board would be required, but just curious.

    • m0hpj said:

      Slightly over my head that one – never having had anything to do with U-Boot (to my knowledge). The serial console kicks in relatively early in the Debian startup, but I don’t think it does anything before Debian starts. I turned mine off so I could use the Serial port for my stuff.

  9. Steve said:

    I’ve done similar but using the TNC-Pi rather than relying on the soundcard:-

    http://www.m0spn.co.uk/?p=31

    Packet may not be as popular now as it once was but it’s still good fun 🙂

    Steve M0SPN

    • m0hpj said:

      TNC-Pi looks cool – so much so I just ordered one. But I haven’t tried using a soundcard yet (I suspect the Pi is not man enough for the processing) so it will just be a more compact version of the Tiny-2 TNC.

  10. Art said:

    Hi I order in the states a X-TNC is a kit, I built it a few days and looks very nice.
    I am sure it will works ok with the Raspberry Pi see the link below
    http://www.tnc-x.com/TNCPi.htm

    73 to all from down-under Art
    Skype ID: ja1ogs

    • m0hpj said:

      Cheers Art – I also bought one and yes it does work well.

  11. Andrew said:

    Why not use a USB serial adaptor ?

    • m0hpj said:

      Because it would use up a USB port, and it seemed a shame not to use the onboard UART.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: