Svxlink Plug-in for DTMF remote IO control

 

echo_remote

 

This article introduces how to use F8ASB’s plugin to remote IO control of a Svxlink’s Echolink node via DTMF.

 

The Svxlink Plug-in from F8ASB

There are many Echolink solution, e.g.: Kenwood Echolink ready transceiver, Computer, Svxlink run at Raspberry Pi and so on.

Well, in my opinion, the Rpi Svxlink solution is the best: low long term operation costs; cheap Hardware with the flexibility by software Plug-in.

I found F8ASB upload a Module-Remote-Relay package to his Github. The link:

https://github.com/F8ASB/Module-Remote-Relay

However, I cannot found anymore useful information from web, except a demo in YouTube by a relay board, and a similar module for a svxlink project called Open Repeater.

They develop a svxlink board and F8ASB also a member of them.

svxcard_features

Courtesy of   http://svxcard.f5uii.net/doku.php?id=fr:start

The game is simple:

We sent DTMF command by a transmitter (e.g. handheld), the Svxlink decode and control a GPIO pin of Rpi to 0,1 or a positive 0.1s pulse.

wiring_pi_table

We using these 4 Port in this project

The module can handle up to 4 GPIO port (20-23) of Rpi.

0,1 suitable for on/off switch.

Pulse can be used as a trigger signal to INT pin of MCU.

 

Here is the DTMF commad set:

9# : turn on the module
xxY# : xx is GPIO port number (20-23), Y is the state:

1 means high level (3.3V)

0 means low level (0V)

2 means Pulse

* :  turn off the module

For example: we would like to turn the Port 20 to 1:

First turn on the module, then press 201# .

As Svxlink is software base decode incoming DTMF signal, we no need to found those discontinued rare DTMF decoder IC, such as Mitel 8870,8888, etc.

And by the benefit of software, we can turn the module on/off remotely by our own.

 

Plugin installation

The Hardware, software version is the original one from the previous Echolink article. It operates for half year and never hang up.

First of all, backup the SD card before the plugin installation.

Second, download the code in zip format from F8ASB Github. The file name is master.zip.

Unzip it, the unzip folder name should be Module-Remote-Relay-master.

Please enter the unzip folder, and copy the following 2 files to the destination folder. Please be remind that my path is different with official info.

RemoteRelay.tcl -> /usr/local/share/svxlink/events.d/

ModuleRemoteRelay.tcl –> /usr/local/share/svxlink/modules.d/

Although the sound clip files is French, we create a folder for the English sound clip:

/usr/local/share/svxlink/sounds/en_US/RemoteRelay

Copy all the sound clip files to this folder.

Tips:

If you are not fluent on the Linux commands, please refer my previous article. And of course the fastest method is handle those steps in windows environment. Please type the commands to enter the X windows:

sudo startx <=it must add sudo before startx to get the super user privilege

Then edit svxlink.conf by following command:

sudo nano /usr/local/etc/svxlink/svxlink.conf

remote_add

 

In the end of row MODULES, add ,ModuleRemoteRelay

 

We use the following command to add a new file to save the parameter of the new module:

sudo nano /usr/local/etc/svxlink/svxlink.d/ModuleRemoteRelay.conf

Add the content:

[ModuleRemoteRelay]
NAME=RemoteRelay
PLUGIN_NAME=Tcl
ID=9
TIMEOUT=60

 

remote_config

The basic setup was complete, please reboot.

 

Troubleshooting

I found the module are no function, even the sound clip play.

So I study the module files script. I found the critical file is
ModuleRemoteRelay.tcl

In this file, I found it use a command to set the port 20 to 0 (low level):

exec gpio -g write 20 0

 

OK, it is Wiring Pi command. As the Svxlink did not need this package before, we need install it for the IO prot control. Here is the official installation guide:

http://wiringpi.com/download-and-install/

When using Wiring Pi for IO Port control, we need declare the port as input/output before set to 0 or 1.

And I found the tcl file did not declare anything before action.

So we use the following commands on the activate section (row 58) to set the ports to OUT direction:

exec gpio -g mode 20 out

exec gpio -g mode 21 out

exec gpio -g mode 22 out

exec gpio -g mode 23 out

On the deactivated section (original row 67), if simply declare  the ports to IN direction, the IO port will resume the last status on next module activation. So we add 4 rows of command to set the port to 0 .

cod1

Here is the code to add

 

It cause some options:

If you want the ports kept the level state on next activation, you just declare the port to IN direction during deactivating, no need to set to 0.

In fact the 4 port dedicated to use as output port, we can simply set to 0 on the deactivating, no need to declare IN direction.

 

Another option is the length of pulse:

The positive pulse is formed by output set to 1, then wait 100mS, and set to 0.

you can change the pulse length by alter the number 100.

Please be remind that it is a delay loop,so do no set too long,say 200mS.

pulse

The section of the pulse handling

A typo was found and it will cause the Port 22 pulse output no function. Please amend the second 212 to 222.

 

YouTube Demo

I use a LED instead of a Relay. Output 1 the LED will bright, 0 to off. Pulse the LED flash once.

test-205x300

Courtesy of   https://developer-blog.net/raspberry-pi-gpio-schnittstelle-teil-2/

 

To driving a relay by a Rpi IO port, use a simple transistor circuit is OK. Please refer this site:

Relay-Sample

Courtesy of  http://www.susa.net/wordpress/2012/06/raspberry-pi-relay-using-gpio/


 

 

English Sound Clip

I found F8ASB’s another project Open repeater includes English sound clip files, and it contains all the necessary words for this project. I had stick some files and rename them for this project.

Here is the download link, simply overwrite the existing sound clip files on the folder.

https://db.tt/xMPNJDdX

 

Lesson to learn

TCL stand for Tool Command Language. It is a simple script language. F8ASB ‘s plug-in is a very good example for study purpose.

Although we need install WiringPi  library to make it work, we can try to do more by using the WiringPi library. e.g: read a IO port status or even add extension i2C IC for AD convention figure, and report the status in the air.

 

Conclusion

Svxlink used in Raspberry Pi to form an Echolink node, we can add plug-in to enhance the function, which a so call Echolink ready transceiver can’t.

The next article on Echolink should be try the latest svxlink ver 15.01 with SDR supporting.

Posted in English Articles | Tagged , , , , | Leave a comment

學住法文玩 Echolink 遙控 IO

 

echo_remote

 

前言

本文介紹如何使用 F8ASB 編寫的 plug-in,最終實現在svxlinkDTMF 指令控制 Raspberry piIO

過程不複雜,但原碼也不是完整可即用,需動點腦筋。

 

F8ASB Svxlink Plug-in

Raspberry Pi 作為平台,配上 Svxlink 作為 Echolink node,我認為是最佳的 Echolink 用戶端選擇。就以這次介紹的 Plug-in 為例,就可遠端控制 RpiIO 了。

這是成品機如 Kenwood 支援 Echolink 的機種,電腦上運行 Echolink 軟件做不來的。也不計這兩方案 24 小時運作的耗電量,成本等等了,計埋只越問越傷心。

Github 發現了 F8ASB 編寫的 sxvlink plug-in,也看過其 YouTube 的簡單 demo。但 Google 一下 svxlinkecholink Rpi keyword ,沒甚專題報導。

F8ASB Github 網址:

https://github.com/F8ASB/Module-Remote-Relay

 原因可能有二,F8ASB 也是另一 project openrepeater 的成員,openrepeater 是改自 svxlink 的開源方案,主攻中繼的控制。這個 plug-in 的高階版 (各樣參數可透過網頁修改)也包括在內。作者可能想 reserved 在自家的方案中。

第二,他們也開發了一塊 control board,有 RTC, IO  relay 等。配該 plug-in 控制 relay 是附加值。

 

svxcard_features

Courtesy of   http://svxcard.f5uii.net/doku.php?id=fr:start

我的睇法是第一點無何口非,雖然 svxlink 本身就是一個repeater controller 的控制方案。粗略看他們是加進 php 編寫的頁面進行 config

第二點,外國地方大,買零件隨時駕車成個鐘。本地則鴨街,網上訂送上門,再不淘寶搞掂。這些一體化方案對本地ham 友沒有迫切性。

這個 plug-in 是一個模組,以 DTMF 指令控制 RpiIO20-23。可分別輸出 10,或一個 0.1 秒的正 pulse

wiring_pi_table

今次打交道的四個 IO Port

 

01 輸出適合作為開關。pulse 較適合接到 MCU int 作為觸發 trigger signal

有關 DTMF 指令:

9#   : 啟動模組

xxY# : xx 是輸出端,即 20-23Y 是輸出狀態:

1 是高電平,

0 0V

2Pulse

*  : 關閉模組

例: 想將輸出端 20 變為 1 :
201#

有了這些輸出,除可控制簡單的開關外;也可作為密碼組合,如你唔怕煩的話。

一些舊式中繼控制方案也可經 DTMF 控制,但多靠 DTMF IC 解碼,如 Mitel 88708888 等。這些 IC 停產多年,硬件彈性低,維護困難。

相反,svxlink 是軟解的,無需特別 IC。有需要用到時才遠端開啟這個模組,相對安全。

 

大致安裝步驟

今次不會提供詳細的安裝步驟了。理由是其實我也不是 Linux 專家,遇到問題也是上網找。大家可參考以往幾篇Echolink 文章。指令來來去去一大抄的。

這裡用的軟硬件正是上次 svxlink 14.081 demo 後運行至今的 Rpi,期間未嘗死機;非常穩定。今加上 plug-in ,和一塊接有四枚 LED 的萬用板。

先備份一下整張 SD card

後到 F8ASBGithub 網址下載整個 package

下載後的檔案是 master.zip ,解壓後的 folder 名是 Module-Remote-Relay-master

將以下檔案抄到相對位置。留意官網提供位置和我的 default 位置是不同的。以下是我的路徑。

RemoteRelay.tcl -> /usr/local/share/svxlink/events.d/

ModuleRemoteRelay.tcl ->/usr/local/share/svxlink/modules.d/

建立音效檔所需的 folder :
/usr/local/share/svxlink/sounds/en_US/RemoteRelay

將所有音效檔 copy 到這裡。

提示:如不熟悉在 Linuxfile,起 folder 的指令,用必殺技進入 X windows 快手搞掂即可,無需深究。

指令:
sudo startx (一定要在前面加上 sudo 取得 root 權限)

編輯以下檔案加進支援  ModuleRemoteRelay

sudo nano /usr/local/etc/svxlink/svxlink.conf

remote_add

MODULES 一行加進 ,ModuleRemoteRelay

 

編輯一個新檔案儲存所需參數:

sudo nano /usr/local/etc/svxlink/svxlink.d/ModuleRemoteRelay.conf

加進:
[ModuleRemoteRelay]
NAME=RemoteRelay
PLUGIN_NAME=Tcl
ID=9
TIMEOUT=60

remote_config

 

基本設置完成,先 reboot 一下。

 

一波多折,學習 debug,執 code 過程

過程漫長,不詳細交代了,重點如下:

  1. F8ASB 的方案內的語音檔是法文,初步棄用之。
  2. 轉而試用 Open Repeaterremote relay control方案,雖語音檔是英文,但也沒反應。
  3. 返回最初 F8ASB 的方案,一樣完全沒反應。

work,就以 F8ASB 原方案仔細研究。

細研那幾個 tcl 檔的內容,發現關鍵檔是 ModuleRemoteRelay.tcl

其中呼叫 IO port 輸出 0 的指令碼是:

exec gpio -g write 20 0

有和 Rpi IO 打過交道的,應看得出是 Wiring Pi 的指令。先前的 Svxlink  無需用上,現在控制 IO 則要之。安裝步驟這參看官網:

http://wiringpi.com/download-and-install/

留意 Wiring Pi 的指令,需先將所用的 IO 端設為方向,即輸出 (out) 或輸入 (in),再指示輸出 01 電平。

而上述的 tcl 檔內的執行指令只有後者。沒有發現任何片段是端口的輸出 (out) 設定。

OK,那在 ModuleRemoteRelay.tcl 所需加進內容是:

58 行,遙控模組 activate 部份內將相關四個 port 設為 out

exec gpio -g mode 20 out
exec gpio -g mode 21 out
exec gpio -g mode 22 out
exec gpio -g mode 23 out

在原 67 行,遙控模組 deactivated 部份還原設定。本是用懶人的方法將 port 位設為 in 就搞掂。但實測發現再次進入時會記住上次的電平,所以先加四行將 4 port 設回零。

 

cod1

 

這裡衍生了一些選項:

如想遙控模組 deactivated 後保持輸出電平,可不需將 4 port 設回零。

那四個 port 是專職做輸出,其實還原部份將 4 port 設回零,刪去那 4 in 也可。

 

而另一選項是 pulse 的時間長短:

細看編碼,Pulse 是先輸出 1,等 100mS,再歸 0

100mS,即 0.1 秒。這個時間長短也可更改。但留意由於他是一個 delay,用在這裡不適宜太長;個人認為最長不應超過 200mS

pulse

還要留意一點,Port 21 pulse 重覆了。會導致 222# 即指示 Port 22 輸出 pulse 失敗。只需將第二個 212  改回 222 即可。

 

YouTube Demo

我用 LED 代替 Relay 示範,輸出 1 LED 著,0 就熄; pulse 就一閃。要推 relayTransistor 即可。

 

test-205x300
圖片來源  https://developer-blog.net/raspberry-pi-gpio-schnittstelle-teil-2/

 

Relay-Sample

圖片來源 http://www.susa.net/wordpress/2012/06/raspberry-pi-relay-using-gpio/

 

 

English Sound Clip

以上的 demo 語言是原裝法文的。除 pulse 一字外,其他發音相近英語應可理解的。不過如想用回英文也無問題。由於 open repeatersound clip 已有所需的英文檔。我將相關的英語檔併合為所需的語檔。只需將下件 overwrite 原有的 sound clip 檔即可。

https://db.tt/xMPNJDdX

 

Lesson to learn

起初以為是簡單任務,到最後要執 code 才成事。都好,對 tcl 檔加深了解。

tcl 檔 是 Tool Command Language。是一種簡單的 script。而 F8ASBplug-in 正好是一個例子,供研究,學習編寫 tcl plug-in 之用。

另一同門方案 open repeater 去推 IO 的方法不同,用回傳統方式(可參考上述 Relay 的網頁)。原因我不深究了,各施各法。

但起用 Wiring Pi  的好處是其 library 豐富,加上 -x 可外接一些 i2c IC AD convertor 等。那回傳用語音報上一些電壓、電流數字值應可行的。

Wiring Pi  另一指令是讀回 IO 端的狀態( 01 ),我們也可嘗試透過修改 tcl 內容,e.g:用 3 就讀回指定 IO 端的輸出電平,無需人手記下。

 

總結

SvxlinkRpiEcholink 方案可外加 Plug-in 以增強功能,這是其他器材所不能的。外加什麼,還看創意。這是活在軟件年代 Ham 的專利。

查看 ARRL 網頁,四月中的 7.5 級厄瓜多爾地震,災後的人道救援通訊起用了 EcholinkVoIP 方案,部份緊急物資請求更 route 到西班牙處理(厄瓜多爾通西班牙話)。

這體現了天涯若比鄰的意境。而我們配備了這些 Plug-in 方案,有需要時 we can do more。

下篇有關 svxlink 的文章應是試用最新版的 15.01,配以 SDR 的整合應用。暫想到的用 SDR 在另一頻道上standby,作為 DTMF 指令頻道等。

雖未開始準備,先興奮。

Posted in EchoLink | Tagged , , , | Leave a comment