raspberry pi and ham radio

15
Raspberry Pi and Ham Radio Terry Paddack K5DXD (Formerly KF5TOK) Cowtown Hamfest - 2019

Upload: others

Post on 12-May-2022

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Raspberry Pi and Ham Radio

Raspberry Pi and Ham Radio

Terry Paddack

K5DXD (Formerly KF5TOK)

Cowtown Hamfest - 2019

Page 2: Raspberry Pi and Ham Radio

What is Raspberry Pi?

Single-Board Computer featuring:

• On-board CPU, RAM, GPU, Storage, Ports, GPIO Pins

• Low cost – typically ≤ $35 US

• Free*, open-source, software

• Raspbian Operating System (based on Debian Linux)

• Programmable in a number of languages including:

• Python

• C, C++

• BASH scripts

• Many more!

Raspberry Pi is a trademark of the Raspberry Pi Foundation.

Page 3: Raspberry Pi and Ham Radio

Raspberry Pi Boards

Pi Zero • $5-$15 • Single-core, 1 GHz • 512 MB RAM • ~ 1W power draw • Smallest form factor • 1 micro USB port • Pi Zero W has:

• 802.11n • Bluetooth 4.1

Pi 3A+ • $25 • Quad-core, 1.4 GHz • 512 MB RAM • ~ 4W power draw • Medium form factor • 1 USB 2.0 port • 802.11b/g/n/ac • Bluetooth 4.2

Pi 3B+ • $35 • Quad-core, 1.4 GHz • 1 GB RAM • ~ 5.6W power draw • Largest form factor • 4 USB 2.0 ports • 802.11 ac/n • Bluetooth 4.2

Photo credits: www.raspberrypi.org

Page 4: Raspberry Pi and Ham Radio

Anatomy of a Raspberry Pi3B+

USB 2.0 ports (x4)

40-pin GPIO Header

Wireless networking

radio

Quad-core, 64-bit SoC @ 1.4 GHz

Micro USB Power In HDMI Port

‘Gigabit’ Ethernet

port

Audio / Composite Video Out

Photo credit: www.raspberrypi.org

Page 5: Raspberry Pi and Ham Radio

40-pin GPIO Header

1

3

5

7

9

11

13

15

17

19

2

4

6

8

10

12

14

16

18

20

21

23

25

27

29

31

33

35

37

39

22

24

26

28

30

32

34

36

38

40

+3.3 V

I2C SDA GPIO 2

SCL GPIO 3

GPIO 4

GND

GPIO 17

GPIO 27

GPIO 22

+3.3 V

SPI

MOSI GPIO 10

MISO GPIO 9

SCLK GPIO 11

GND

ID SD

GPIO 5

GPIO 6

GPIO 13

PCM FS GPIO 19

GPIO 26

GND

+5 V

+5 V

GND

GPIO 14 TXD UART

GPIO 15 RXD

GPIO 18 CLK PCM

GND

GPIO 23

GPIO 24

GND

GPIO 25

GPIO 8 CE0 SPI

GPIO 7 CE1

ID SC

GND

GPIO 12

GND

GPIO 16

GPIO 20 DIN

PCM GPIO 21 DOUT

Photo credit: www.raspberrypi.org

Page 6: Raspberry Pi and Ham Radio

Setting up the Raspberry Pi

Raspbian OS image files:

• https://www.raspberrypi.org/downloads/raspbian/

Installation Guide:

• https://www.raspberrypi.org/documentation/installation/installing-images/README.md

Other useful software and links:

• Direwolf User Guide:

• https://github.com/wb2osz/direwolf/blob/master/doc/User-Guide.pdf

• Chirp Downloads:

• https://chirp.danplanet.com/projects/chirp/wiki/Download

Page 7: Raspberry Pi and Ham Radio

Project #1 – Programming a UV5-R (with a home-made cable)

Wires for Programming with UART

1 To TxD on Pi (GPIO 14)

2 To GND on Pi

3 To RxD on Pi (GPIO 15)

1

3

5

7

9

11

13

15

17

19

2

4

6

8

10

12

14

16

18

20

21

23

25

27

29

31

33

35

37

39

22

24

26

28

30

32

34

36

38

40

+3.3 V

I2C SDA GPIO 2

SCL GPIO 3

GPIO 4

GND

GPIO 17

GPIO 27

GPIO 22

+3.3 V

SPI

MOSI GPIO 10

MISO GPIO 9

SCLK GPIO 11

GND

ID SD

GPIO 5

GPIO 6

GPIO 13

PCM FS GPIO 19

GPIO 26

GND

+5 V

+5 V

GND

GPIO 14 TXD UART

GPIO 15 RXD

GPIO 18 CLK PCM

GND

GPIO 23

GPIO 24

GND

GPIO 25

GPIO 8 CE0 SPI

GPIO 7 CE1

ID SC

GND

GPIO 12

GND

GPIO 16

GPIO 20 DIN

PCM GPIO 21 DOUT

2

3

1

Page 8: Raspberry Pi and Ham Radio

Project #1 – Programming a UV-5R (with a home-made cable)

Wires connected in UV5R headset

PTT

Microphone

GND

Speaker

These are the only wires present in the headset included with the UV5R, so there is no way to use this connector to program the radio using the Pi’s on-board UART We need access to this part of the connector.

1

2 3

UV-5R BF-888

Page 9: Raspberry Pi and Ham Radio

Project #1 – Programming a UV-5R (with a home-made cable)

Software Configuration The following changes must be made: • Install chirp according to instructions at Chirp Downloads website • Stop & disable the pre-configured serial console service

• sudo systemctl stop [email protected] • sudo systemctl disable [email protected]

• Remove the serial console from cmdline.txt • sudo leafpad /boot/cmdline.txt • Delete this text “console=serial0,115200” from the file • Save changes to the file and reboot

• Edit the config file to force on-board Bluetooth to use the software-based UART so the programming cable gets the (higher-performance) hardware UART

• sudo leafpad /boot/config.txt • Add the following lines to the end of the file:

• enable_uart=1 • core_freq=250 • dtoverlay=pi3-miniuart-bt

• Save changes and reboot • Plug in your home-made cable, start up Chirp, and program your radio

Page 10: Raspberry Pi and Ham Radio

Project #2 – DTMF Relay Controller Hardware Overview

1

3

5

7

9

11

13

15

17

19

2

4

6

8

10

12

14

16

18

20

21

23

25

27

29

31

33

35

37

39

22

24

26

28

30

32

34

36

38

40

+ -

~ 120 V AC

RTL-SDR Dongle

Raspberry Pi

Solid-State Relay

Photo credit: www.raspberrypi.org

Page 11: Raspberry Pi and Ham Radio

Project #2 – DTMF Relay Controller Software Overview

Python Script •Runs as a service at startup • Starts rtl_fm & direwolf as subprocesses •Configures subprocesses using command-line arguments • Establishes pipes for their standard output

•Controls the GPIO pin that activates the relay

rtl_fm subprocess •Receives FM radio signals •Converts them to audio • Puts raw audio into

standard output

Direwolf subprocess •Monitors incoming audio •Decodes APRS & DTMF • Puts decoded data into

standard output

GPIO Control

Standard Output

Stan

dar

d

Ou

tpu

t

Co

mm

and

-lin

e ar

gum

en

ts

Co

mm

and

-lin

e ar

gum

en

ts

FM Radio Signals

Page 12: Raspberry Pi and Ham Radio

Project #3 – APRS Station

Wires connected in UV5R headset

PTT

Microphone

GND

Speaker

1

3

5

7

9

11

13

15

17

19

2

4

6

8

10

12

14

16

18

20

21

23

25

27

29

31

33

35

37

39

22

24

26

28

30

32

34

36

38

40

+3.3 V

I2C SDA GPIO 2

SCL GPIO 3

GPIO 4

GND

GPIO 17

GPIO 27

GPIO 22

+3.3 V

SPI

MOSI GPIO 10

MISO GPIO 9

SCLK GPIO 11

GND

ID SD

GPIO 5

GPIO 6

GPIO 13

PCM FS GPIO 19

GPIO 26

GND

+5 V

+5 V

GND

GPIO 14 TXD UART

GPIO 15 RXD

GPIO 18 CLK PCM

GND

GPIO 23

GPIO 24

GND

GPIO 25

GPIO 8 CE0 SPI

GPIO 7 CE1

ID SC

GND

GPIO 12

GND

GPIO 16

GPIO 20 DIN

PCM GPIO 21 DOUT

To soundcard Headphone Jack

To soundcard Mic. Jack

Page 13: Raspberry Pi and Ham Radio

Project #3 – APRS Station Software Overview

Direwolf service •Monitors incoming audio •Decodes APRS & DTMF • Serves decoded data via

TCP (AGWPE Protocol) • Sends APRS data via RF • Supports 3 simultaneous

AGWPE Protocol clients •Controls PTT via GPIO

pins on Pi

APRS Client •Connects to Direwolf

via AGWPE API •Uses the sound modem

for APRS messaging

Informational Beacon •Connects to Direwolf

via AGWPE API •Uses the sound modem

to send CPU usage & temperature data or a timestamp

AGWPE Python

API

Python Import

TCP

TCP

AGWPE Python

API

Python Import

TCP

TCP

Soundcard Audio

Soundcard Audio

Glossary of terms: Direwolf: software-based soundcard modem; an acronym for Decoded Information from Radio Emissions for Windows Or Linux Fans AGWPE: communication protocol used by Direwolf. Originally from AGW Packet Engine; a Windows-only soundcard modem created by SV2AGW. API: Application Programming Interface; a set of software tools that allows you to interface with a program written by someone else.

Page 14: Raspberry Pi and Ham Radio

Licensing

This presentation is licensed under CC BY-SA. You are free to copy and redistribute this material in any medium or format. No warranties are given. Electronic copies can be made available upon request. Photos of Raspberry Pi products were generously provided by The Raspberry Pi foundation under this license. For more information see: https://creativecommons.org/licenses/by-sa/4.0/legalcode

Page 15: Raspberry Pi and Ham Radio

Questions?

I can haz ham?