+++
title = "HS Dual Hat With PiStar v4"
aliases = [ '/posts/2020-01-23-hs-dual-hat-with-pistar-v4', '/blog/amateur-radio/2020-01-23-hs-dual-hat-with-pistar-v4/' ]
summary = """This is a MMDVM_HS_Dual_Hat hotspot in duplex mode with DMRGateway
and an actual Pi-Star image."""
categories = ["amateur-radio"]
tags = ["pistar","dmr","ysf","dstar","hotspot","mmdvm"]
date = 2020-01-23T15:03:35+01:00
lastmod = '2024-02-02T16:09:48+0000'
+++
{{< alert circle-info >}}
**Update on Jan 27 2024**
I haven't looked at the Pi-Star software for quite some time but I assume it is
still fine. If you haven't heard something about [WPSD](https://w0chp.radio/wpsd/)
you should have a look at it, as it is another opinionated hotspot software
that you can use with your hotspot.
{{< /alert >}}
I've been playing with Pi-Star now for a while and I finally got my
IPSC2-Brandmeister dual-setup working.
I'm using the beta version v4 because I read somewhere, that DUAL-HATS won't
work properly with the older v3 firmware -- but I never really tested the v3.
Instead I went for v4 straight away as it seemed pretty stable anyway.
Now, I began with a very simple IPSC2-only setup in the first place. I then made
a backup and changed all settings to be used for Brandmeister only. Another backup
of the Brandmeister setup and I moved on to using DMRGateway.
It was a bit tricky at the beginning, because I was not used to the configuration
of such devices in any kind. After a few hours of research and testing I finally
got the DMR-GW setup ready.
## The first thing I did on Pi-Star
Setup the keyboard and language on the console. I mostly type in german and I
know most of the characters on an _en_US_ or _en_UK_ keyboard, but I still prefer
a german layout :wink:
Before we start, we have to make the filesystem writable. Do this with the
command alias `rpi-rw` either in a console or in the SSH-Access tab on the
dashboard (Configuration → Expert → SSH Access). The login details for SSH are
the same as on the dashboard.
Now you got the filesystem writable, so start the keyboard configuration:
~~~console
$ sudo dpkg-reconfigure keyboard-configuration
~~~
I then usually go for the 105-key PC one. Choose German (Austria) and go for the
default keyboard layout with no compose key -- except you have other needs.
Then start generating the locales for your environment.
~~~console
$ sudo dpkg-reconfigure locales
~~~
Choose the locales that you need or want. My setup looks like this:
{{< figure caption="If you don't know what to choose, go with your language and the UTF-8 version." src="00_locales.png" alt="locales setup" >}}
I also create my ssh-keys for passwordless login as well as some comfortable
aliases. I usually use the ZSH shell, but on Pi-Star I just leave it as it was.
I add my aliases to `.bash_aliases` -- this is the file that gets sourced via
`.bashrc` in the default pi-star setup.
Quick and dirty -- my current `.bash_aliases` on my Pi-Stars looks like this:
~~~bash
# File: "~/.bash_aliases"
DATE=$(date +%Y-%m-%d)
PI=/var/log/pi-star/
DMRGW=${PI}DMRGateway-${DATE}.log
MMDVM=${PI}MMDVM-${DATE}.log
DAPNET=${PI}DAPNETGateway-${DATE}.log
[ -x /usr/bin/pydf ] && alias df='/usr/bin/pydf' || alias df='df -h'
alias digg='dig +noall +answer'
alias dt='dmesg | tail'
alias mm="multitail ${DMRGW} ${MMDVM}"
alias mmdmr="multitail ${DMRGW}"
alias mmdv="multitail ${MMDVM}"
alias mmdap="multitail ${DAPNET}"
# Screen and Tmux alike
alias sc='screen -DR Screen_A'
alias tm='tmux -u new-session -A -s Tmux_A'
# ls
alias l='ls -1A'
alias la='ls -lah'
alias lc='lt -c'
alias lk='ll -Sr'
alias ll='ls -lh'
alias lad='ls -lah|more'
alias lld='ls -lh|more'
alias lm='la | "$PAGER"'
alias ln='nocorrect ln -i'
alias lni='nocorrect ln -i'
alias locate='noglob locate'
alias lr='ll -R'
alias ls='ls --group-directories-first --color=auto'
alias lt='ll -tr'
alias lu='lt -u'
alias lx='ll -XB'
alias ducks='du -cks * | sort -rn | head'
alias confcat="sed -e 's/#.*//;/^\s*$/d' "$@""
~~~
### Optional
More software that comes in handy from time to time.
~~~console
$ sudo apt-get install htop lsof nmap arping vim pydf multitail git ldnsutils
~~~
{{< figure caption="`pydf` in combination with the alias from above displays a short and colored output when you list your diskspace with `df`" src="11_df_output.png" alt="an example output of `pf`" >}}
#### If you intent to install and use vnstat, you need to set it up
The installation of vnstat is useful, if you let your pi-star run 24/7 as the
database gets cleared on every reboot!
~~~console
$ sudo apt-get install vnstat
~~~
Add the following line to your `/etc/fstab` file. I assume that you still
have the filesystem writable -- if not, run `rpi-rw`.
~~~plain
# file: "/etc/fstab"
tmpfs /var/lib/vnstat tmpfs nodev,noatime,nosuid,mode=1777,size=4m 0 0
~~~
If you run `cat /etc/fstab` it should look similar to this:
~~~plain
# file: "/etc/fstab"
#File System Mountpoint Type Options Dump Pass
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults,ro 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime,ro 0 1
tmpfs /run tmpfs nodev,noatime,nosuid,mode=1777,size=32m 0 0
tmpfs /run/lock tmpfs nodev,noatime,nosuid,mode=1777,size=5m 0 0
tmpfs /sys/fs/cgroup tmpfs nodev,noatime,nosuid,mode=1755,size=32m 0 0
tmpfs /tmp tmpfs nodev,noatime,nosuid,mode=1777,size=64m 0 0
tmpfs /var/log tmpfs nodev,noatime,nosuid,mode=0755,size=64m 0 0
tmpfs /var/lib/sudo tmpfs nodev,noatime,nosuid,mode=1777,size=16k 0 0
tmpfs /var/lib/dhcpcd5 tmpfs nodev,noatime,nosuid,mode=1777,size=32k 0 0
tmpfs /var/lib/vnstat tmpfs nodev,noatime,nosuid,mode=1777,size=4m 0 0
tmpfs /var/lib/logrotate tmpfs nodev,noatime,nosuid,mode=0755,size=16k 0 0
tmpfs /var/lib/nginx/body tmpfs nodev,noatime,nosuid,mode=1700,size=1m 0 0
tmpfs /var/lib/php/sessions tmpfs nodev,noatime,nosuid,mode=0777,size=64k 0 0
tmpfs /var/lib/samba/private tmpfs nodev,noatime,nosuid,mode=0755,size=4m 0 0
tmpfs /var/cache/samba tmpfs nodev,noatime,nosuid,mode=0755,size=1m 0 0
tmpfs /var/spool/exim4/db tmpfs nodev,noatime,nosuid,mode=0750,size=64k 0 0
tmpfs /var/spool/exim4/input tmpfs nodev,noatime,nosuid,mode=0750,size=64k 0 0
tmpfs /var/spool/exim4/msglog tmpfs nodev,noatime,nosuid,mode=0750,size=64k 0 0
~~~
Normally, vnstat creates `/var/lib/vnstat` and starts the vnstat service. We now
delete the freshly created databases (they are nearly empty anyway) and
re-create them when we have mounted the ramdisk.
~~~console
$ sudo rm /var/lib/vnstat/*
$ sudo mount -a
$ sudo systemctl restart vnstatd
~~~
Now run `vnstat` to display network interface statistics. It's output could
look similar to this one:
~~~plain
rx / tx / total / estimated
eth0: Not enough data available yet.
wlan0:
Jän '20 39,23 MiB / 39,10 MiB / 78,33 MiB / 106,00 MiB
today 39,23 MiB / 39,10 MiB / 78,33 MiB / 138 MiB
~~~
It takes time to gather enough information. Get back to this in a few days and
you will get more useful information. Because we save the databases in the
ramdisk, we will save the sdcards lifetime, but also we loose the statistics
when we reboot the raspberry pi.
{{< alert triangle-exclamation >}}
If you want to save them forever, you won't have
to create a ramdisk like above, but **you also have to make sure that
PiStar does not mount the volumes read-only!**
{{< /alert >}}
## Make the filesystem read-only again
Once you finished your setup, make the filesystem read-only again.
~~~console
$ rpi-ro
~~~
## Start setting up your Pi-Star MMDVM
{{< alert lightbulb >}}
The MMDVM services restart every time you hit
the **Apply Changes** button. So when hitting the button wait a few seconds
-- this takes some time to complete ;-)
{{< /alert >}}
### Talkgroup setup
This setup uses some talk groups from IPSC2/DMR+ and the rest from Brandmeister.
Specifically these talkgroups are:
* Timeslot 1
* TG 1 - TG 7
* TG 10 - TG 89
* TG 100 - TG 199
* Timeslot 2
* DMR+ reflectors with TG 9
* TG 232
* TG 8181 - TG 8189
* TG 8191 - TG 8199
* GPS data sent as private calls to 9057
All other talkgroups are routed to the Brandmeister network. Private calls are
also routed to Brandmeister.
### Simplex or Duplex?
This is where we actually start. At the first start either connect your
Raspberry Pi to an ethernet port or look out for a WiFi network called
Pi-Star Setup.
{{< figure src="01_control-software.png" alt="Control Software configuration" caption="Make sure to use Duplex Repeater in order to use different RX and TX frequencies." >}}
### MMDVMHost
{{< figure src="02_mmdvmhost.png" alt="MMDVMHost configuration" caption="Choose the modes that you want to use. I only use DMR and POCSAG for now." >}}
### General information about the station
{{< figure src="03_general.png" alt="general information" caption="Put in your own callsign and your DMR-ID -- ~~register your callsign~~ if you don't have one yet. Select appropriate frequencies and make sure they are at least a few MHz apart from each other. I used the common shift that we use in Austria on 70cm (-7,6 MHz)." >}}
{{< alert triangle-exclamation >}}
**Update:** The URL above is outdated. `ham-digital.org` was the european
version of `radioid.net` -- those two were merged together and you can apply
for your personal DMR-ID
[over here at radioid.net](https://www.radioid.net/account/register#!).
{{< /alert >}}
### DMR configuration
{{< alert circle-info >}}
Now, setup IPSC2 only or Brandmeister only if you are unsure about the
DMRGateway setup. Make yourself comfortable with both of the systems but only
one system at a time and move over to DMRGateway when you feel confident enough.
The rewrite rules can be sometimes a bit tricky to set up.
{{< /alert >}}
{{< figure src="04_dmrconfig.png" alt="DMR configuration" caption="" >}}
Choose the Brandmeister master server you want to connect to. Also set a
password in [Brandmeisters SelfCare](https://brandmeister.network/?page=selfcare)
for Hotspot Security. That makes sure, that only you can add a Hotspot with your
callsign. Also select the IPSC2 server of your choice and set the wanted
options. I go with these for now:
~~~ini
StartRef=4197;RelinkTime=15;UserLink=1;TS2_1=232;TS2_2=8189;
~~~
In this scenario I want to statically link the two talk groups `232` and `8189`
on timeslot 2. I also allow `UserLink` which allows users to link to different
reflectors. The default reflector is `4197` and this gets relinked if nobody
presses PTT for 15 minutes. If you need talkgroups from timeslot 1 you would
probably write something like this:
~~~ini
StartRef=4197;RelinkTime=15;UserLink=1;TS1_1=20;TS2_1=232;TS2_2=8189;
~~~
That will also include talk group 20 from timeslot 1. I thought you can
statically link up to 5 talkgroups, but I'm not sure if this information is up
to date (I haven't tried this yet, but you can do that on your own very easy).
{{< alert circle-info >}}
**Update**: Actually, you can link **9 talkgroups on every slot**.
{{< /alert >}}
### Move over to the expert configuration tab
#### Quick edit
Whenever you feel comfortable with DMRGateway, head over to the expert settings
page and select MMDVMHost. I've adjusted the Jitter settings "a bit", although
this should run smooth with a setting of `1000` too -- I'm still a bit of
experimenting with this. I read a lot of times that `1000` should be fine with
slower networks -- but you should definitely experiment yourself a bit with this
setting.
{{< alert circle-info >}}
**Update**: As of today, I'd probably set _Jitter_ to something around 0-300.
{{< /alert >}}
{{< figure src="05_exp_mmdvmhost-dmrnetwork.png" alt="DMR jitter configuration" caption="" >}}
Now let's have a look at the DMR Gateway configuration. Navigate to the DMR GW
expert settings. Choose DMR GW of the upper line (Quick Edit).
{{< figure src="06_exp_dmrgw-dmrnetwork1.png" alt="DMR Network 1 configuration" caption="" >}}
{{< figure src="07_exp_dmrgw-dmrnetwork2.png" alt="DMR Network 2 configuration" caption="" >}}
Don't forget to save the settings.
#### Full edit
When you have saved that, go to the expert settings again and choose again
**DMR GW** -- **but this time, choose the one from the lower line (Full Edit)**.
This configuration file is split into paragraphs. Look out for the
`[DMR Network 1]` block.
~~~ini
[DMR Network 1]
Enabled=1
Address=178.238.234.72
Port=62031
TGRewrite0=2,8,2,8,1
PCRewrite0=2,84000,2,84000,1001
TypeRewrite0=2,9990,2,9990
SrcRewrite0=2,84000,2,8,1001
PassAllPC0=1
PassAllTG0=1
PassAllPC1=2
PassAllTG1=2
Password="***"
Debug=0
Id=232718001
Name=BM_Germany_2622
~~~
Our next block is called `[DMR Network 2]`.
~~~ini
[DMR Network 2]
Enabled=1
Address=89.185.97.34
Port=55555
TGRewrite0=1,1,1,1,7
TGRewrite1=1,10,1,10,80
TGRewrite2=1,100,1,100,100
TGRewrite3=2,232,2,232,1
TGRewrite4=2,8181,2,8181,9
TGRewrite5=2,8191,2,8191,9
TGRewrite6=2,9,2,9,1
PCRewrite0=1,9055,1,9055,6
PCRewrite1=2,9055,2,9055,6
PCRewrite2=2,4000,2,4000,1001
Password="PASSWORD"
Debug=0
Id=2327180
Name=DMR+_IPSC2-OE-DMO
Options="StartRef=4197;RelinkTime=15;UserLink=1;TS2_1=232;TS2_2=8189;"
~~~
[Read along here](https://github.com/g4klx/DMRGateway/wiki/Rewrite-Rules)
if you want to know more about the different rewrite rules.
### POCSAG configuration
{{< alert circle-info >}}
The following frequency is used in **Austria**. Please refer to your local
amateur radio club for information about the used frequencies in your country.
You may use 439.987.500 in Germany.
[Look here](https://hampager.de/dokuwiki/doku.php?id=dapnetfrq) for more frequencies.
{{< /alert >}}
{{< figure src="10_pocsag.png" alt="POCSAG configuration" caption="" >}}
Read more on and on . You
need to create an account to bind your callsign to a
RIC. You also need a second account
for your transmitter -- that is when you get your AuthKey.
## That's it -- images and videos
I suppose this gets easier from time to time -- depending on how often I have to
install this stuff on a Pi :grinning:
### My Raspberry Pi 3 B
{{< figure src="08_raspberrypi.jpg" alt="my raspberry pi 3" caption="" >}}
### And this is the admin page of the dashboard
If you want to use the Brandmeister Manager you need to set the api key. Go to
expert settings and choose BM API in the lower line. It is somewhat
in the middle of the page. To get an api key visit the
[Brandmeister API Keys page](https://brandmeister.network/?page=profile-api).
{{< figure src="09_dashboard-a.png" alt="Dashboard - Admin view" caption="" >}}
There are some more handy links for Brandmeister:
* [list connected peers to the Austrian BM_2321 server][list]
* [last heard on this specific master server][lh]
[list]: http://62.171.130.35/status/status.htm
[lh]: https://brandmeister.network/?page=lh&Master=2321
### PiStar Remote
Restart the PiStar services with RF power from your HT.
{{< video "pistar-remote-svcrestart" >}}
Or reboot the whole Raspberry Pi.
{{< video "pistar-remote-reboot" >}}
To make use of PiStar Remote you need to set it up. Go to *Configuration ->
Expert* and choose *PiStar Remote* (in the Full Edit line).
~~~ini
[enable]
# Is the Pi-Star Remote Enabled? (true|false)
enabled=true
...
[dmr]
# TG commands
#svckill=8999999
svcrestart=8999998
reboot=8999997
#shutdown=8999996
#hostfiles=9999995
~~~
## Final words
I think this whole article is a *work in progress* -- I just always find things
that I do different now and I cannot always change these things in this article
too; some aren't even wrong, they just fit better.
I think this page is a good thing to look back to start a fresh configuration --
even if I have made different configuration backups from within PiStar.
Addidionally I made one-to-one copies of the used sdcards -- just in case ;-)
Initially I wrote this for myself, but I think this might be helpful for others
too so enjoy the content and feel free to [mail me](/about/#contact) if you
find errors or have to add some notes on that topic.