Friday, March 17, 2017

Communicating between multiple DVMegas or even OpenSpots on DMR without internet...revisited updated etc

 So the executive summary of this post is...

-SharkRF OpenSpots can communicate to HBlink (previous post)
-better install method for HBlink.


As far as the Openspot...the latest firmware (I have a v1.1 model) srf-osp-1.1-0101.bin improves the web interface and adds enough options to correctly link up to HBlink.
(I will admit, I only have one radio so right now I have not done a reception test...but the DVMega shows the traffic from the Openspot).

The Openspot manual shows how to do the settings...just point to the HBlink server, and use Homebrew/MMDVM Connector, and MMDVM Protocol.


The following is a cut and paste from a fellow ham, Mark who spent a lot of hours making a good repeatable installation process.  And in his setup, he runs HBlink on the same Pi that holds the DVMega...I am using a separate Pi.

-----------------------------------------------------------------------------------------------
This method does not require the loading of any specific versions of any of the components, which should allow it to continue to be usable in the future, even as the components are updated.

Note: I started with the latest 03/03/2017 raspbian release . . . even if you aren't currently using this release, the very first "sudo apt-get" step will actually update your RPi to the full equivalent of this release.

Note: if you have previously loaded other utilities (MMDVMHost, HBlink, or particularly ircddbgateway) on your RPi, you will need to edit any files in the /etc/apt/source.list.d/* folder (other than the standard raspi.list file . . . you can leave this one alone) & comment out any uncommented lines (e.g. particularly the references to nh6z.org, but also any others that may be present).  The uncommented lines in these files reference additional sources over & above those standard for raspbian & will very likely prevent you from successfully fully updating the raspbian OS on your RPi if they remain uncommented.

Here's the step-by-step that I followed to get HBlink installed & running:

sudo apt-get update && sudo apt-get dist-upgrade

cd /home/pi/Downloads

git clone http://github.com/n0mjs710/HBlink

git clone http://github.com/n0mjs710/dmr_utils

sudo apt-get install python-dev libffi-dev libssl-dev python-pyparsing python-appdirs

sudo pip install --upgrade pyOpenSSL pyparsing appdirs pyasn1 (that's digit one on the end of pyasn1)

sudo easy_install bitstring

sudo easy_install bitarray

sudo easy_install Twisted

sudo easy_install service_identity

cd dmr_utils

sudo python setup.py install

cd ../HBlink

cp hblink-SAMPLE.cfg hblink.cfg


(edit the hblink.cfg file for the following:)



under [MASTER-1]

change PASSPHRASE:
(to match brandmeister for convenience)

(passw0rd)

change PORT: (to match brandmeister for convenience)
(62031)


under [REPEATER-1]

change ENABLED: to False


Then, to run HBlink, you can use the same "startup script" + "autostart" method used for MMDVMHost.


Content of the /home/pi/.config/autostart/HBlink.desktop file is as follows:

[Desktop Entry]

Type=Application

Name=HBlink

Exec=lxterminal --geometry=120x32 -e "/home/pi/start_hblink"

StartupNotify=False

Content of the /home/pi/start_hblink script is as follows

(NOTE: in the command to kill HBlink, the character right after the "-9" & again at the very end of the command is a "back quote", which is typically somewhere to the left of the number "1" on most keyboards, whereas the character on either side of the "curly braces" after the "awk" command is a normal "single quote", usually located somewhere near the RETURN/ENTER key on most keyboards):


kill -9 `ps -ef | grep -v grep | grep "hblink.py" | awk '{print $2}'`

clear

echo -n "sleeping 10 seconds before (re)starting HBlink."

sleep 1

echo "."

sleep 1

echo "."

sleep 1

echo "."

sleep 1

echo "."

sleep 1

echo "."

sleep 1

echo "."

sleep 1

echo "."

sleep 1

echo "."

sleep 1

echo "."

sleep 1

echo "."

clear

cd /home/pi/Downloads/HBlink ; python hblink.py



In English, the command line to kill HBlink says to do the following (in this order):
1) [ps -ef] = get a list of all tasks that are running

2) [ps -ef | grep -v grep] = take the results from #1 & ignore any task that has the word "grep" in it

3) [ps -ef | grep -v grep | grep "hblink.py"] = take the results from #2 & filter it down to only those tasks that contain the text "hblink.py"

4) [ps -ef | grep -v grep | grep "hblink.py" | awk '{print $2}'] = take the results from #3 & print out the task ID number which is in the second field (where fields are considered to be separated by a "space" character by default)

5) kill -9 `ps -ef | grep -v grep | grep "hblink.py" | awk '{print $2}'` = execute the whole command string in #4, take the results from #4 (which is a task ID) & hard kill that particular task ID, no matter what

(If like Mark, you run HBlink on the same Pi that has the DVMega mounted then...)

When running MMDVMHost & HBlink on the same RPi, you must configure MMDVM.ini as follows:

[DMR Network]
Address=127.0.0.1

(Normally that points toward the remote brandmeister or whatever server)

I tried using the RPi hostname in this setting, but in that case, MMDVMHost does not fully complete the registration process with HBlink

Feel free to use this info however you see fit !!  -Mark


Tuesday, January 17, 2017

Communicating between two DVMEGAs without access to the internet

So previously I installed the DVMEGA hardware onto a Raspberry Pi, and installed an image running MMDVMHost which makes the DVMEGA-Pi into a digital radio hotspot...specifically in my case a DMR hotspot.

It is very handy in my application...that is my house is apparently a faraday cage and no radio signals shall pass.

But what if you are out in the field with no access to the internet (no Brandmeister) and too far remote to reach a repeater...how can you use your DMR capabilities?

I dug through the internets for a while until I stumbled over some open source software developed apparently to run full size repeaters.

HBlink   https://github.com/n0mjs710/HBlink

So here is the scenario.  You have your mesh network setup, but the internet is not connected to your MESH.   You have two or more DVMEGAs deployed at different locations...and obviously you have DMR radios at those locations.  With an additional Raspberry Pi running the HBlink software somewhere on the MESH, and the DVMEGAs pointed toward it, now your DMR radios are doing their DMR thing within your MESH network.  (or another way of looking at it is a private DMR network)

This will be a quick walkthough of the software install and config...pretty straight forward, and I am not a Pi genius.

I started with the latest Raspbian Jessie with Pixel.  https://www.raspberrypi.org/downloads/raspbian/

For my purposes I used raspi-config to enable SSH and VNC...

Once all the reboots are done and software updated...

--:   sudo apt-get update
--:   sudo apt-get update

and install the python-dev tools for our Jessie version of Raspbian.   If you don't do this step the rest of the installs will not work.

--:  sudo apt-get install -t jessie python-dev

Then I opened the Pi's browser and downloaded the following software. (in all cases I downloaded the zip or tar.bz2 or tar.gz file)

Bitstring 3.1.5
https://pypi.python.org/pypi/bitstring

Bitarray 0.8.1
https://pypi.python.org/pypi/bitarray/0.8.1

Twisted 16.3.0  (download the Source)
https://pypi.python.org/pypi/Twisted/16.3.0

service_identity 16.0.0  (download the Source)
https://pypi.python.org/pypi/service_identity

DMR_utils
https://github.com/n0mjs710/dmr_utils

HBlink
https://github.com/n0mjs710/HBlink


Then using the File Manager in Raspbian I went to the downloads folder, right clicked on each file individually and selected "Extract Here"

I did the following steps within the terminal window.  These were all python scripts, and all installed the same way.

--:  cd Downloads

We will start with service_identity.


--:  cd service_identity-16.0.0
--:  sudo python setup.py install

after it finishes downloading and installing

--: cd ..

and so on and so forth through the rest of the downloads

--:  cd bitarray-0.8.1
--:  sudo python setup.py install
--: cd ..

--:  cd bitstring-3.1.5
--:  sudo python setup.py install
--: cd ..

--:  cd Twisted-16.3.0
--:  sudo python setup.py install
--: cd ..

--:  cd dmr_utils-master
--:  sudo python setup.py install
--: cd ..

--:  cd HBlink-master
--:  sudo python setup.py install

now stay in the HBlink-master directory...we need to edit the hblink.cfg file...there is none, but there is a sample to be edited.

--:  nano hblink-SAMPLE.cfg

scroll down until you see [MASTER-1] ...make it look like this.

[MASTER-1]
MODE: MASTER
ENABLED: True
REPEAT: True
EXPORT_AMBE: False
IP:                                                             (I left this blank...seems to still work)
PORT: 54000
PASSPHRASE:                               (I use the same one I used for brandmeister...)


I also scrolled down to [REPEATER-1] and set ENABLED: False

now within nano save the file, but change the name to hblink.cfg

(for nano editing, the CTRL key and whatever option you want...so to save = CTRL-o   ; to quit = CTRL-x)

We are done installing and configuring.

To run, simply type (we are still in the HBlink-master directory)

--:  python hblink.py

You will see some messages like

-DEBUG - Logging system started.
-INFO - HBlink - SYSTEM STARTING...
-DEBUG - (MASTER-1) Master maintenance loop started
-DEBUG - MASTER instance created

if you see anything other than that especially with words like FAIL or ERROR...you probably have a problem...google is your friend.

After those start up messages you will simply see the 'DEBUG Master maintenance loop started'  message every few seconds...

Now on your DVMEGA, edit the MMDVM.ini file to have the DVMEGA use the HBlink machine as the server.

[DMR Network]
Enable=1
Address=xxx.xx.xx.xx        (your HBlink machine IP address goes here)
Port=54000                          (the HBlink port#...)
# Local=3350
Password=s3cr37w0rd      (make this password match the one you put in HBlink)
RSSI=0
Slot1=1
Slot2=1
Debug=1

At this point start up MMDVMHost  (personally I just reboot the DVMEGA pi)

If you are watching the HBlink screen you will see the following message when the DVMEGA logs into it.

-INFO (MASTER-1) Repeater Logging in with Radio ID: xxxxx,
-INFO (MASTER-1) Sent Challenge Response to (your DMR ID) for login:
-INFO (MASTER-1) Client (your DMR ID) has completed the login exchange successfully
-INFO (MASTER-1) Client (your callsign and DMR ID) has sent repeater configuration

now when you kerchunk your DMR radio to the DVMEGA you will get the following message on HBlink

-DEBUG (MASTER-1) Received and answered RPTPING from client (your callsign and DMR ID)

after some inactivity you will get

-INFO (MASTER-1) Client (your callsign and DMR ID) has timed out


that RPTPING is all you need to see to know it is working...of course the DVMEGA machine should successfully login to the DMR server also.


Now from this point all you have to do is point the DVMEGAs to the HBlink server and it is all up and running.   I successfully tested this using two DVMEGAs set 5Mhz apart in freq, connected through different nodes of the MESH, the server and the DVMEGAs were on different nodes.