Sat. January 11, 2020 – Go Box using: Nexus DR-X by Budd Churchward WB7FHC

Go Box using:

Nexus DR-X  by Budd Churchward WB7FHC

Demo

  • From va7tnd

  • To va7rei 



  • Kenwood TM-V71A dual band (VHF/UHF) radio
  • Raspberry Pi 3B+ with Nexus DR-X (digilink) hat
  • GL.iNet
    GL-MT300N-V2 with OpenWRT router
  • Cables to
    connect:

    • radio to
      digilink  for data communications

    • radio to Pi for
      control
    • hdmi to monitor
    • power to the
      router
  • Switches to switch:
    • power from AC power supply or DC battery
    • power to Nexus off /on

  • 120V AC to 12V DC power supply and associated wires.

  • Nexus mounted on top of the Raspberry Pi  from the bottom
    to the top:

    • Acrylic base
    • Raspberry Pi
    • Sound Card
    • Nexus
    • Real Time Clock
    • Buck Converter
  • The Red wires connect the sound card to the Nexus

  • Real Time Clock RTC

  • Piano Switch
  • Piano Switch Script

The script
that checks for the piano switch settings and then launches the
appropriate user script is /usr/local/bin/check-piano.sh.
It is run when LXDE-Pi (the Pi’s GUI) starts and is called
by /etc/xdg/lxsession/LXDE-pi/
autostart.

cat
piano1.sh
#!/bin/bash

VERSION=”1.2.1″

# This an example pianoX.sh script.

# piano scripts are user defined and they run automatically at
startup
# depending on the position of the levers of the piano switch

# mounted on the Nexus board.

# For example, if you want to run a particular script when the

# piano switch levers 1 and 4 are Up (off) and 2 and 3 are
down (on), name youor script
# piano23.sh.  Nexus scripts must be in your home
directory and must be
# executable.  You can make your script executable by
running this command:

# chmod +x <script name>

# For example:
# chmod +x piano1234.sh

#===========================================================================
# EXAMPLE 1: This script will change the call sign and other
parameters
# in the Fldigi and Flmsg apps.  It makes these
# changes for both the left and right radios.  Edit the
variables below to
# make your desired changes.

OP_CALL=”va7tnd”
OP_NAME=”suzanne baril”
STATION_CALL=”va7tnd”
TEL=”250-652-5340″
ADDR=”7259 seabrook road”
CITY=”saanichton, bc”
EMAIL=”suzanne@tnd.com”
QTH=”saanichton”
#LOC=”CN88gn”
#==========================================================================

killall -q flmsg || true
DIRS=”.nbems .nbems-left .nbems-right”
for D in $DIRS
do
if [ -f $HOME/$D/FLMSG.prefs ]
then
sed -i -e
“s/^mycall:.*/mycall:$OP_CALL/” \

-e “s/^mytel:.*/mytel:$TEL/” \

-e “s/^myname:.*/myname:$OP_NAME/” \

-e “s/^myaddr:.*/myaddr:$ADDR/” \

-e “s/^mycity:.*/mycity:$CITY/” \

-e “s/^myemail:.*/myemail:$EMAIL/”
$HOME/$D/FLMSG.prefs
fi
done

killall -q fldigi || true
DIRS=”.fldigi .fldigi-left .fldigi-right”
for D in $DIRS
do
if [ -f $HOME/$D/fldigi_def.xml ]
then
sed -i -e
“s/<MYCALL>.*<\/MYCALL>/<MYCALL>$STATION_CALL<\/MYCALL>/”

\

-e
“s/<MYQTH>.*<\/MYQTH>/<MYQTH>$QTH<\/MYQTH>/”
\

-e
“s/<MYNAME>.*<\/MYNAME>/<MYNAME>$OP_NAME<\/MYNAME>/”

\

-e
“s/<MYLOC>.*<\/MYLOC>/<MYLOC>$LOC<\/MYLOC>/”
\

-e
“s/<OPERCALL>.*<\/OPERCALL>/<OPERCALL>$OP_CALL<\/OPERCALL>/”

$HOME/$D/fldigi_def.xml
fi
done

#==========================================================================
# EXAMPLE 2: You can manipulate the
# desktop wallpaper, background and foreground, etc.
# Those settings are stored in $HOME/.config/pcmanfm/LXDE-pi.
You’re on
# your own for creating that script.
#

#==========================================================================
# EXAMPLE 3: Automatically start one or more
applications.
# Anything that you can start from the menu
# you can autostart at boot time.  You can start any
application that is
# called from a desktop file in /usr/share/applications,
# /usr/local/share/applications or
$HOME/.local/share/applications.
# Start applications by launching the desktop files using
‘gtk-launch’.
# For example, these commands will autostart
# direwolf on the right radio, play a WAV file, and start
fldigi on the
# right radio:

#gtk-launch direwolf-right.desktop
#aplay /usr/lib/libreoffice/share/gallery/sounds/kongas.wav
gtk-launch fldigi-left.desktop

# Note that you do not need to background (by appending the
‘&’ syumbol)
# each instance of gtk-launch.  All instances of
gtk-launch will execute.
# You also do not need to specify the location of the
*.desktop file.
# gtk-launch will look in the directories listed above for the
desktop file.

  • GPIO 26 Switch – Restart or Shutdown
  $ cat shutdown_button.py
#!/usr/bin/python3

# Version 2.0.1
# Original script by Stewart C. Russell via
https://github.com/scruss/shutdown_button
# Modified by Steve Magnuson, AG7GN to control LED on different
GPIO during Button
# press.
# -*- coding: utf-8 -*-
# example gpiozero code that could be used to have a reboot
#  and a shutdown function on one GPIO button
# scruss – 2017-10

use_button=26     # Button on use_button (BCM
GPIO 26 by default)

from gpiozero import Button
from gpiozero import LED
from signal import pause
from subprocess import check_call

held_for=0.0
led=LED(24)
# LED on BCM GPIO 24

def rls():
global held_for
if (held_for > 5.0):
check_call([‘/sbin/poweroff’])
elif (held_for >
2.0):
check_call([‘/sbin/reboot’])
else:

held_for = 0.0

def hld():
# callback for when
button is held
#  is called every
hold_time seconds
global held_for
# need to use max() as
held_time resets to zero on last callback
held_for =
max(held_for, button.held_time + button.hold_time)
if (held_for > 5.0):

led.off()
elif (held_for >
2.0):

led.on()
else:

led.off()

button=Button(use_button, hold_time=1.0, hold_repeat=True)
button.when_held = hld
button.when_released = rls

pause() # wait forever


Presented by Deid Reimer, January 11, 2020 Original notes are here.