semdxa monthly meeting january 9, 2015 - k8ut sbc rpi 2015-jan v13pdf.pdf · arduino and raspberry...

68
SEMDXA Monthly Meeting January 9, 2015 1 Larry Gauthier, K8UT

Upload: vuongduong

Post on 17-Feb-2019

218 views

Category:

Documents


0 download

TRANSCRIPT

SEMDXA Monthly Meeting

January 9, 2015

1

Larry Gauthier, K8UT

Agenda ◦ Single Board Computer Background

◦ K8UT’s Single Board Computer Projects

◦ Recommendations

◦ Brief demo (time permitting)

RPi CLI

RPi GUI

Agenda ◦ SBC Background

What are these things?

Do I need one?

What will it do for me?

Which one should I buy?

Do I need a Computer Science degree to operate it?

3

SBC’s primary IC is referred to as a Microcontroller

Microcontrollers include a CPU with a fixed amount of RAM, ROM and other peripherals all embedded on a single chip

This is unlike the primary IC on PCs and Laptops – called a Microcomputer - which requires external RAM, ROM, and other peripheral devices to function

4

SBCs are well-suited for dedicated applications that require a wide variety of measurement and control operations

SBCs I/O ports are optimized for maximum flexibility: USB, Ethernet, HDMI, GPIO pins, A/D conversion, RS232, audio in/out, SD card

Small, cheap, lightweight, versatile, low power, no moving parts

5

You already own many of them ◦ In your home and car

Washer/dryer, microwave, dishwasher, TV, cable box, auto electronics

◦ In the ham shack

Modern transceivers

Interface equipment

Dedicated mode translators (cw, rtty, video)

Data capture (GPRS)

Where else could you use one?

6

Temp & Humidity

Special-Purpose Applications

7

RFID Bluetooth

GPS

Geiger Counter

Fingerprint Scanner

RFID

reader

Robotics

Camera

Weather Stations

In the Ham Shack:

Interface applications that require translation, control, precise timing

Band decoders, remote antenna switches, phased antenna selectors, rotor control, cw keyer, rtty modulator, repeater controller, VOIP (Echolink), WSPR digital mode, APRS, TNC, D-Star access point, SDR server, satellite tracker, remote station control, packet radio BBS, more…

8

EXAMPLE 1: World RadioSport Team Competition ◦ WRTC 2014 Live Scoreboard

Real-time log collection and forwarding

Logging

Computers

Ethernet

Router

Raspberry

Pi

Cellular

Modem

EXAMPLE 2: K1N Navassa 2015 ◦ Dxpedition on-line log updates

Raspberry Pi

MySQL

database

Clock Timer

Satellite

Link

LoTW

ClubLog

Custom

ADIF

Extracts

EXAMPLE 3: Parallel Processor Cluster ◦ Keipert, doctoral dissertation, Boise State University

There are many manufacturers and models

Arduino and Raspberry Pi are most popular

Choose based on your goals ◦ Run an off-the-shelf application?

◦ Learn a programming language or O/S (Linux)?

◦ Experiment and tinker in the ham shack?

12

Arduino ◦ Great for dedicated projects

◦ No Operating System, just a bootloader

◦ Non-standard versions of popular languages

◦ Many Arduino manufacturers and models

Open source and extensible hardware and software

Code portability and standardization could be an issue

But at prices as low as $10, they are disposable

13

Arduino

14

Raspberry Pi ◦ Originally intended as a STEM teaching tool by its

two educator designers

◦ Versatile and flexible without add-on HATs

◦ Runs a standards-compliant version of Linux

◦ Program in Python 2 or 3, C, C++, other languages

◦ Many licensed RPi manufacturers

Rigid control over design and compatibility

◦ There have only been four RPi models:

A, A+, B, and B+ (released sequentially: original, newer,

newer, newest)

Lists at $40, discounted by some dealers

15

Raspberry Pi

16

Raspberry Pi model B+ Raspberry Pi model B

No, certainly not for “packaged” applications

Your immersion into the nerdy world of Linux and

Programming depends on your goals

Many resources available to you ◦ Books

◦ Websites

◦ Email groups (Yahoo: Raspberry Pi 4 Ham Radio)

◦ Free on-line courses

◦ Hundreds of accessories: cases, cables, breadboards, HAT devices

◦ Thousands of contributed code samples

◦ GIYF*

* Google Is Your Friend

Hardware

Breadboards

18

Software

Operating Systems ◦ Most popular is Raspbian (cousin to Ubuntu Debian)

◦ Many, many others - most are Linux forks

Arch Linux, OpenLEC, Pidora, RaspBMC, Minepeon, Kali Linux, OpenWrt, RaspDigi Signage, RISB OS Pi, Firefox OS, Plan 9, Android, Pipboy, more…

19

Software

Programming Languages – varies by O/S ◦ Low level- Assembler

◦ Interpreted – Perl, PHP, BASIC, tinyBASIC, Python, Java, Scratch, Ruby…

◦ Compiled - C, C#, C++, GCC…

20

Software

Databases ◦ File based – SQlite (free) {dbms under N1MM Logger+}

◦ Medium Duty - MySQL (free) with PHPmyAdmin

◦ Heavy Duty – Oracle Server (far from free)

21

Performance – Operating Systems

Linux versus Windows debate ◦ Linux was designed blah blah blah

◦ Multi-tasking blah blah blah blah

◦ Everybody abandon Windows and blah blah blah

Any desktop computer that simultaneously handles interrupts from the O/S, a firewall, an anti-virus program, an auto-update scheduler, email, instant messaging, Skype, packet spots, and who-knows-what else... Cannot deliver real-time high performance and precision event timing.

22

Performance – Operating Systems

Linux versus Windows debate ◦ Linux was designed blah blah blah

◦ Multi-tasking blah blah blah blah

◦ Everybody abandon Windows and blah blah blah

Any desktop computer that simultaneously handles interrupts from the O/S, a firewall, an anti-virus program, an auto-update scheduler, email, instant messaging, Skype, packet spots, and who-knows-what else... Cannot deliver real-time high performance and precision event timing.

23

POP QUIZ: What was the maximum packet spot

rate per second in the CQWW CW 2014 contest?

Performance – Programming Languages

Interpreted versus Compiled Languages ◦ The two most popular on RPi: Python vs C++

◦ Compare the processing times for identical applications running under two languages

Enable/Disable LEDs on the SainSmart board

Toggle each of the eight LEDs in sequence

Repeat the task 1,000,000 times

Report the elapsed time for each language

24

Performance – Programming Languages

Python repetitions = 0

while repetitions < 1000000:

GPIOnum = 1

while GPIOnum < 9 :

GPIO.output(Relay[GPIOnum], RelayON)

GPIO.output(Relay[GPIOnum], RelayOFF)

GPIOnum += 1

repetitions +=1

C++ int repetitions = 0; // initialize repeat counter = 0

while(repetitions < 1000000) { // repeat lots of times

int GPIOnum = 0; // initialize relay counter = 0

while(GPIOnum < 8) { // countdown through 8 relays

digitalWrite(GPIOnum, 0) ; // 0 = Off = relay ON

digitalWrite(GPIOnum, 1) ; // 1 = On = relay OFF

GPIOnum++; } // increment the relay counter

repetitions++; } // increment the repeat counter

25

Performance – Programming Languages

Python ◦ Elapsed time

252.539 seconds

4 minutes 12.5 seconds

15.78 microseconds per LED toggle

26

Performance – Programming Languages

Python ◦ Elapsed time

252.539 seconds

4 minutes 12.5 seconds

15.78 microseconds per LED toggle

C++ ◦ Elapsed time

2.104 seconds

1/30 of a minute

0.131 microseconds per LED toggle

27

Agenda ◦ Single Board Computer Background

◦ K8UT’s Single Board Computer Projects

Typical Ham Shacks

Typical Shack Networks

My First Five SBC Projects

28

Agenda ◦ Typical Ham Shacks

29

Agenda ◦ Typical Ham Shacks

◦ Typical Shack Networks

34

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

CAT Bus .03 MBPS serial protocol

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

CAT Bus .03 MBPS serial protocol

The Problems with Buses • Expensive • Crowded (adds to wait times or even collisions) • Slow (speed governed by the slowest device) • Often proprietary (limits your product selections)

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

CAT Bus .03 MBPS serial protocol

Agenda ◦ Typical Ham Shacks

◦ Typical Shack Networks

◦ My First Five SBC Projects

39

Agenda ◦ Typical Ham Shacks

◦ Typical Shack Networks

◦ My First Five SBC Projects

Wired Band Decoder

40

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

CAT Bus .03 MBPS serial protocol

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

CAT Bus .03 MBPS serial protocol

Wired Band Decoder

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

Observations 76 lines of Python 3 code

◦ Steep learning curves

Raspberry Pi and Raspbian distribution

Python 2 & 3 programming languages (very BASIC like)

Hex manipulation of CI-V command strings

Benefits Table driven band/frequency switching

1-to-Many band-to-relay output choices

In use today? No. Excuses: too busy, no enclosure, need for manual

switching capability, if it ain’t broke don’t fix it

Agenda ◦ Typical Ham Shacks

◦ Typical Shack Networks

◦ My First Five SBC Projects

Wired Band Decoder

Wireless Antenna Switch

44

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

CAT Bus .03 MBPS serial protocol

Wired Band Decoder

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

CAT Bus .03 MBPS serial protocol

Wireless Antenna Switch

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

Observations 112 lines of Python 3 code

Learning curves Configuring the N1MM Logger UDP options

Making RPi an Ethernet (WiFi) UDP packet sniffer

Benefits All the benefits of Wired Band Decoder

Eliminate antenna switch and multi-conductor wire

UDP code provided to the K1N dxpedition

In use today? No. Excuses: too busy, can relays handle 1KW?, UDP only

sent by N1MM, no enclosure, it’s cold outside

Agenda ◦ Typical Ham Shacks

◦ Typical Shack Networks

◦ My First Five SBC Projects

Wired Band Decoder

Wireless Antenna Switch

Protocol Translator

48

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

CAT Bus .03 MBPS serial protocol

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

CAT Bus .03 MBPS serial protocol

Icom CI-V

Elecraft K3

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

CAT Bus .03 MBPS serial protocol

Icom CI-V

Elecraft K3

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

Observations 68 lines of Python 3 code

◦ Learning curves

Elecraft CAT protocol

Arbitration between K3 CAT and Icom CI-V

FA00010123000; translates to FEFE54E0002301100FD

Benefits Bill won’t blow up his PW1amplifier

In use today? Yes. But…

Agenda ◦ Typical Ham Shacks

◦ Typical Shack Networks

◦ My First Five SBC Projects

Wired Band Decoder

Wireless Antenna Switch

Protocol Translator

CAT Router / Switch

53

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

CAT Bus .03 MBPS serial protocol

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

Ethernet LAN 10/100/1000 MBPS TCP/UDP Wi-Fi LAN

Observations 205 lines of Python 3 code

◦ Learning curves

Accumulation of learning from previous projects

CI-V manipulation for VFO Diversity and Adaptive Rx

◦ PC-to-RPI line running at 115200 BPS

Benefits Logging software more responsive

PW1 protected from collisions

VFO Diversity and Adaptive Filtering very fast

In use today? Yes. But... how fast could it be if written in C++?

Agenda ◦ Typical Ham Shacks

◦ Typical Shack Networks

◦ My First Five SBC Projects

Wired Band Decoder

Wireless Antenna Switch

Protocol Translator

CAT Router

RTTY FSK Modulator

57

Some PC-based RTTY Background ◦ Two control lines: PTT and AFSK/FSK

◦ FSK is the preferred method

◦ Many ways to generate FSK input signal

Serial port, USB/serial port, parallel port, soundcard

All depend upon timing from the PC

Push to Talk (PTT)

AFSK {ugh!} or FSK input

Cannot deliver real-time high performance and precision event timing.

Non PC-based RTTY Background ◦ The old-fashioned way – a Terminal Node Controller

◦ PC talks to TNC in ASCII via serial port

◦ TNC manages baudot translation and timing

Many models on the market

Expensive

A ba-zillion configuration options

TNCs not supported by all RTTY programs (2Tone)

Push to Talk (PTT)

AFSK or FSK input Serial ASCII

Non PC-based RTTY Background ◦ The old-fashioned way

with new-fashioned technology

◦ tinyFSK by Andy K0SM Free software on cheap hardware

Excellent timing characteristics

BONUS: David G3YYD developing tinyFSK driver for 2Tone

Push to Talk (PTT)

FSK input Serial ASCII

rpiFSk by Larry K8UT ◦ Re-write of tinyFSK on Arduino to rpiFSK on Raspberry Pi

◦ Not trivial due to platform and language differences

◦ Not trivial due to the fact that Larry had never written a line of C code in his life

◦ Intent is to directly emulate tinyFSK, giving users the Arduino vs Rpi choice

◦ A work-in-progress…

Push to Talk (PTT)

FSK input Serial ASCII

Observations 391 lines (and counting) of C++ code

◦ Learning curves

The C++ programming language

RTTY communication protocol

Deriving precision timing from non-interrupt code

Benefits Alternative to expensive commercial products

RTTY from snap-together off-the-shelf parts

Solve issues with low-power PCs, laptops, USB ports

Help users migrate from AFSK

In use today? No yet

Agenda ◦ Typical Ham Shacks

◦ Typical Shack Networks

◦ My First Five SBC Projects

Wired Band Decoder

Wireless Antenna Switch

Protocol Translator

CAT Router

RTTY FSK Modulator

Next project? rpiCW keyer

63

Look familiar?

K1EL Winkeyer clone

Runs on an Arduino platform

Keyer software by K3NG

Keyer hardware by DJ0MY

Combine the rpiFSK and rpiCW in a single box using

Raspberry Pi

Agenda ◦ Typical Ham Shacks

◦ Typical Shack Networks

◦ My First Five SBC Projects

◦ Recommendations

65

YMMV - Based on Your Background ◦ Initial SBC Purchase: July 10, 2014

RTFM - Buy At Least One Reference Book ◦ I bought three – they cost more than the hardware!

Don’t be Afraid to Experiment ◦ What’s the worst that can happen?

◦ At these prices, the devices are disposable

GIYF (google is your friend) ◦ Copying from one source is Plagiarism

◦ Copying from many sources is Research

Approach your SBC with a Meaningful Project in Mind

Work with a Buddy

Thank You!

67

Larry Gauthier, K8UT

Agenda ◦ Typical Ham Shacks

◦ Typical Shack Networks

◦ My First Five SBC Projects

◦ Recommendations

Enough time for a demo?

68