$$\   $$\  $$$$$$\ $$$$$$$$\ $$$$$$$$\  $$$$$$\  
$$$\  $$ |$$  __$$\\__$$  __|$$  _____|$$  __$$\ 
$$$$\ $$ |$$ /  $$ |  $$ |   $$ |      $$ /  \__|
$$ $$\$$ |$$ |  $$ |  $$ |   $$$$$\    \$$$$$$\  
$$ \$$$$ |$$ |  $$ |  $$ |   $$  __|    \____$$\ 
$$ |\$$$ |$$ |  $$ |  $$ |   $$ |      $$\   $$ |
$$ | \$$ | $$$$$$  |  $$ |   $$$$$$$$\ \$$$$$$  |
\__|  \__| \______/   \__|   \________| \______/ 
        
--------------------------------------------------------------------------------
HOME | TWITTER | GITHUB | NOTES | ABOUT | CONTACT | LOGIN
--------------------------------------------------------------------------------

+--------------------+-------------+---------------------+
| TOUCHTUNES_JUKEBOX | KESTREL_BLE | CHEMION_LED_GLASSES |
+--------------------+-------------+---------------------+
| DUMPING_NRF51822_FIRMWARE | YAESU_VX-7R_RPi | IRIDIUM |
+---------------------------+-----------------+---------+

    
██╗   ██╗ █████╗ ███████╗███████╗██╗   ██╗    ██╗   ██╗██╗  ██╗     ██████╗ ███████╗    ██████╗ ██████╗ ██╗
╚██╗ ██╔╝██╔══██╗██╔════╝██╔════╝██║   ██║    ██║   ██║╚██╗██╔╝     ██╔══██╗╚════██║    ██╔══██╗██╔══██╗██║
 ╚████╔╝ ███████║█████╗  ███████╗██║   ██║    ██║   ██║ ╚███╔╝█████╗██████╔╝    ██╔╝    ██████╔╝██████╔╝██║
  ╚██╔╝  ██╔══██║██╔══╝  ╚════██║██║   ██║    ╚██╗ ██╔╝ ██╔██╗╚════╝██╔══██╗   ██╔╝     ██╔══██╗██╔═══╝ ██║
   ██║   ██║  ██║███████╗███████║╚██████╔╝     ╚████╔╝ ██╔╝ ██╗     ██║  ██║   ██║      ██║  ██║██║     ██║
   ╚═╝   ╚═╝  ╚═╝╚══════╝╚══════╝ ╚═════╝       ╚═══╝  ╚═╝  ╚═╝     ╚═╝  ╚═╝   ╚═╝      ╚═╝  ╚═╝╚═╝     ╚═╝
 
                                                        
//=====< 2020-06-09T05:14:14+00:00 >===============================================\\
||                                                                                 ||
||     あの時だ! :D                                                                 ||
||                                                                                 ||
||     == INTRO ==                                                                 ||
||                                                                                 ||
||     I want to keep this one short and straight to the point. I built a RPi      ||
||     controller for my Yaesu VX-7R handheld so it can activate the PTT and       ||
||     transmit audio without human interaction. This project was the result of    ||
||     an experiment I had seeing if my handheld could work as a POCSAG            ||
||     transmitter. It didn’t work because the VX-7R doesn't support transmitting  ||
||     data at 9600 baud. More or less it took the 2FSK coming from the audio      ||
||     source and modulated it as NFM so in short, no beans… :/                    ||
||                                                                                 ||
||     Not to throw away a mostly working product I re-purposed my failed          ||
||     experiment so it can be a fake number station or something that can         ||
||     transmit automated messages like the weather or time. The fun part is I     ||
||     was able to do all of this using a bash script so there was no need to      ||
||     over complicate this project! :D                                            ||
||                                                                                 ||
||                                                                                 ||
||     == YAESU VX-7R 2.5MM JACK ==                                                ||
||                                                                                 ||
||     Yaesu handhelds use a 4 point 2.5mm jack for voice, speaker and data.       ||
||     I recycled a broken hand mic while building this so below is the wire       ||
||     coloring correlation and diagram for this jack. Wire colors may vary so     ||
||     always double check with a multimeter.                                      ||
||                                                                                 ||
||                                                                                 ||
||                     +--+   GND       MIC      DATA    SPEAKER                   ||
||                     |  +---------+---------+---------+                          ||
||                     |  |         |         |         +----+	                   ||
||                     |  |         |         |         |    |	                   ||
||                     |  |         |         |         +----+                     ||
||                     |  +---------+---------+---------+                          ||
||                     +--+                                                        ||
||                                                                                 ||
||                             +---------------------+                             ||
||                             | FUNCTION  |  COLOR  |                             ||
||                             +---------------------+                             ||
||                             | GND     -->   BRAID |                             ||
||                             | MIC     -->   WHITE |                             ||
||                             | DATA    -->   BLUE  |                             ||
||                             | SPEAKER -->   RED   |                             ||
||                             +---------------------+                             ||
||                                                                                 ||
||                                                                                 ||
||     == RPi SCHEMATIC ==                                                         ||
||                                                                                 ||
||     For this radio’s PTT to be activated Mic needs a 2.2K ohm resistance to     ||
||     ground.  Voice is also being carried over the same line while this          ||
||     resistance is applied so to create this a parallel circuit is needed.       ||
||     This took some creativity to make work because the RPi audio ground and     ||
||     RPi ground are on the same circuit and because I was using a NPN I had to   ||
||     fudge the RPi’s audio in to keep it from shorting. IE, I flipped the RPi’s  ||
||     audio wires so the RPi’s audio line is going into the Yaesu’s ground and    ||
||     vise versa. Below is schematic for this circuit.                            ||
||                                                                                 ||
||                                                                                 ||
||           RPi -> Yaesu VX-7r                                                    ||
||       +-----------------------------------------------------------------+       ||
||       |                                      +------+                   |       ||
||       |     +----------------+---------------+PI GND|                   |       ||
||       |     |                |               +------+                   |       ||
||       |     |                |                                          |       ||
||       |     |                ++\|    440Ω    +----------+               |       ||
||       |     |                   +--+/\/\/\+--+PI GPIO 17|               |       ||
||       |     |                + <|            +----------+               |       ||
||       |     |                |                                          |       ||
||       |     |                |  2.2KΩ                                   |       ||
||       |     |                + /\/\/\+                                  |       ||
||       |     | +------------+         |       +--------------------+     |       ||
||       |     | |PI AUDIO OUT+---------+-------+VX-7R MIC WHITE WIRE|     |       ||
||       |     | +------------+                 +--------------------+     |       ||
||       |     |                                                           |       ||
||       |     +-----------------------------+                             |       ||
||       |                                   |                             |       ||
||       |     +------------+                |  +--------------------+     |       ||
||       |     |PI AUDIO GND+-------------------+VX-7R GND BRAID WIRE|     |       ||
||       |     +------------+                |  +--------------------+     |       ||
||       |                                   |                             |       ||
||       |     +----------+                  |                             |       ||
||       |     |PI MIC GND+------------------+                             |       ||
||       |     +----------+                                                |       ||
||       |                                                                 |       ||
||       |     +---------+                      +--------------------+     |       ||
||       |     |PI MIC IN+----------------------+VX-7R AUDIO RED WIRE|     |       ||
||       |     +---------+                      +--------------------+     |       ||
||       +-----------------------------------------------------------------+       ||
||                                                                                 ||
||                                                                                 ||
||     == BASH SCRIPT ==                                                           ||
||                                                                                 ||
||     Here’s the bash script I used to control the Yaesu VX-7R. Included are      ||
||     a few examples such as using CW to broadcast your call sign, espeak to      ||
||     read words out loud, and how play a wav audio file.                         ||
||                                                                                 ||
||                                                                                 ||
||     tx.sh                                                                       ||
|| +-----------------------------------------------------------------------------+ ||
|| |  #!/bin/bash                                                                | ||
|| |                                                                             | ||
|| |  #######################################################                    | ||
|| |  # FILE:     tx.sh                                     #                    | ||
|| |  # AUTHOR:   NOTPIKE WU7ANG                            #                    | ||
|| |  # LICENSE:  MIT                                       #                    | ||
|| |  # FUNCTION: RPI TX SCRIPT FOR YAESU VX-7R             #                    | ||
|| |  #                                                     #                    | ||
|| |  # ==REQUIRED SOFTWARE==                               #                    | ||
|| |  # ~:$ sudo apt update                                 #                    | ||
|| |  # ~:$ sudo apt install cw espeak-ng                   #                    | ||
|| |  #######################################################                    | ||
|| |                                                                             | ||
|| |                                                                             | ||
|| |  ############ VARIABLES ############                                        | ||
|| |                                                                             | ||
|| |  CALLSIGN="AB7CDE"                                                          | ||
|| |  PHO_CALLSIGN="Alpha Brovo 7 Charlie Delta Echo"                            | ||
|| |  TEST_SENTENCE="The Quck Brown Fox"                                         | ||
|| |  GPIO=17                                                                    | ||
|| |                                                                             | ||
|| |  trap ctrl_c INT                                                            | ||
|| |                                                                             | ||
|| |                                                                             | ||
|| |  ############ FUNCTIONS ############                                        | ||
|| |                                                                             | ||
|| |  ## Trap function for ctrl_c, kills PTT                                     | ||
|| |  function ctrl_c() {                                                        | ||
|| |       printf "\n\n##STOPING##\n\n"                                          | ||
|| |       tx_off                                                                | ||
|| |       exit                                                                  | ||
|| |  }                                                                          | ||
|| |                                                                             | ||
|| |  ## TX ON                                                                   | ||
|| |  function tx_on() {                                                         | ||
|| |       ## Set GPIO to high                                                   | ||
|| |       echo "1" > /sys/class/gpio/gpio$GPIO/value                            | ||
|| |  }                                                                          | ||
|| |                                                                             | ||
|| |  ## TX OFF                                                                  | ||
|| |  function tx_off() {                                                        | ||
|| |       ## Set GPIO to low                                                    | ||
|| |       echo "0" > /sys/class/gpio/gpio$GPIO/value                            | ||
|| |  }                                                                          | ||
|| |                                                                             | ||
|| |  ## Numbers Station                                                         | ||
|| |  function numbers() {                                                       | ||
|| |       MAX_COUNT=10                                                          | ||
|| |       COUNT=1                                                               | ||
|| |                                                                             | ||
|| |       espeak-ng -g 40 "NUMBERS" 2> /dev/null                                | ||
|| |                                                                             | ||
|| |       while [ "$COUNT" -le $MAX_COUNT ]                                     | ||
|| |       do                                                                    | ||
|| |            NUMBER=$(( 1 + RANDOM %100 ))                                    | ||
|| |            echo $NUMBER | espeak-ng -g 40 2> /dev/null                      | ||
|| |            let "COUNT += 1"                                                 | ||
|| |       done                                                                  | ||
|| |  }                                                                          | ||
|| |                                                                             | ||
|| |  ## Date Time                                                               | ||
|| |  function date_time() {                                                     | ||
|| |       NOW=$(date "+%A, %B %d, %Y, Time %H %M")                              | ||
|| |       echo "Today is $NOW" | espeak-ng -g 40 2> /dev/null                   | ||
|| |  }                                                                          | ||
|| |                                                                             | ||
|| |  ## WAV File                                                                | ||
|| |  function play_wav() {                                                      | ||
|| |       aplay /home/pi/piano2.wav                                             | ||
|| |  }                                                                          | ||
|| |                                                                             | ||
|| |                                                                             | ||
|| |  ############ INIT ############                                             | ||
|| |                                                                             | ||
|| |  ## Set GPIO17 to out                                                       | ||
|| |  if [ ! -d "/sys/class/gpio/gpio$GPIO" ]; then                              | ||
|| |       echo "$GPIO" > /sys/class/gpio/export                                 | ||
|| |       echo "out" >  /sys/class/gpio/gpio$GPIO/direction                     | ||
|| |  fi                                                                         | ||
|| |                                                                             | ||
|| |                                                                             | ||
|| |  ############ MAIN ############                                             | ||
|| |                                                                             | ||
|| |  ## TX ON                                                                   | ||
|| |  tx_on                                                                      | ||
|| |                                                                             | ||
|| |                                                                             | ||
|| |  ## Callsign                                                                | ||
|| |  #echo $PHO_CALLSIGN | espeak-ng -g 20 2> /dev/null                         | ||
|| |  echo $CALLSIGN | cw -w 25 -t 1200 2> /dev/null                             | ||
|| |                                                                             | ||
|| |  ## Voice Example                                                           | ||
|| |  echo $TEST_SENTENCE | espeak-ng -g 4 2> /dev/null                          | ||
|| |                                                                             | ||
|| |  ## Date Time Example                                                       | ||
|| |  date_time                                                                  | ||
|| |                                                                             | ||
|| |  ## Numbers Station Example                                                 | ||
|| |  numbers                                                                    | ||
|| |                                                                             | ||
|| |  ## WAV Example                                                             | ||
|| |  play_wav                                                                   | ||
|| |                                                                             | ||
|| |  ## Close                                                                   | ||
|| |  espeak-ng -g 4 -p 25  "END OF LINE" 2> /dev/null                           | ||
|| |                                                                             | ||
|| |                                                                             | ||
|| |  ## TX OFF                                                                  | ||
|| |  tx_off                                                                     | ||
|| +-----------------------------------------------------------------------------+ ||
||                                                                                 ||
||     DOWNLOAD: tx.sh                                                             ||
||     IMG: rpi_yaesu_proto.jpg                                                    ||
||     IMG: rpi_yaesu.jpg                                                          ||
||     VIDEO: yaesu_rpi_example.mp4                                                ||
||                                                                                 ||
||                                                                                 ||
||     == Conclusion ==                                                            ||
||                                                                                 ||
||     Can’t wait to keep adding onto this project. I hope to be able to pipe      ||
||     the RX audio into the Rpi and do more advanced stuff such as remote         ||
||     control via DTMF for example. Hopefully you found this write up to be       ||
||     useful and happy hacking! :D                                                ||
||                                                                                 ||
||                                                                                 ||
||     == Update ==                                                                ||
||     There’s now a Python port available available on my Github! :D              ||
||     https://github.com/notpike/Hambone                                          ||
||                                                                                 ||
||     Expanding from where I left off, I added RX capability as well as porting   ||
||     over a DTMF decoder that was origionaly written by Alijamaliz.              ||
||     Right now it’s capable of listening for DTMF commands and will preform      ||
||     actions such as reading the Weather, Time, and Date with Google’s Text      ||
||     To Speech API and can preform an Echo Test by recording what it can hear    ||
||     then playing it back. My most resent work can be found in the dev branch    ||
||     in the repo.                                                                ||
||                                                                                 ||
||     -- NotPike                                                                  ||
||                                                                                 ||
\\=================================================================================//
                                                            \                        
                                                             \  ^__^                 
                                                              \ (--)\_______         
                                                                (__)\        )\/\    
                                                                 U  ||----w |        
                                                                    ||     ||