I wanted to schedule the DSTAR repeater, that I manage, to reboot automatically every Monday morning. The reason for this is that sometimes Pi-Star stops working and/or freezes up. This typically happens every 2 or 3 weeks of uptime without a reboot. My best guess is that due to the log files not being deleted after rotation, that the Pi software gets “clogged up.” I’ve found settings that are supposed to rotate the logs and only keep a certain number of log files, but those do not appear to work, at least not on our setup.
Since these log files are deleted on every reboot of the Pi, the next best idea in my opinion is to schedule a late-night/early-morning reboot once a week.
I used cron to schedule a reboot. I also use cron to schedule automatic linking and unlinking of reflectors. Pi-Star uses a specialized version of cron that adds a “run as user” option.
Find the Expert Cron Editor Tab
The first step is to log in to your Pi-Star dashboard. This can be accessed by opening a web browser and going to http://pi-star.local/ or http://pi-star/ or the IP address/host name of your Pi-Star repeater or hotspot.
After logging in to your Pi, click on “Configuration” in the upper right of the page.
Next in the upper right of the page click on “Expert”, then on the following page in the bottom row of links on the top of the page click on “System Cron.”
You will see a text box open with a bunch of seemingly cryptic text. Each line is a cron task that is scheduled to happen at a certain time. It should look similar to this:
About halfway down the text box you will see the following line: # m h dom mon dow user command
This line tells us the format of each cron task. The # symbol indicates a comment and tells cron to ignore that line. The “m” indicates “minutes”, “h” indicates hours, “dom” indicates Day of Month, “mon” indicates month, “dow” indicates Day of Week, “user” indicates the user the the command should run as, and “command” is the command you want to run at the given time/day. Refer to the chart below for options for each position in the line.
Enter the minute you want to run the task at or * for any minute.
Enter the hour you want to run the task at or * for any hour.
dom (Day of Month)
Enter the day of the month you want the task to run at or * for any day of the month. Options: 1-31 (date of the month) Example: * = any day of the month Example: 5 = 5th of the Month
Enter the month you want to run a task or * for any month. Options: 1 = January, 2 = February, 12 = December Example: 4 = Run in April Example: 1,6,12 = Run in January, June, & December Example: * = Run any month
dow (Day of Week)
Enter the day of the week you want to run the task or * for any day of the week. Options: 0 or 7 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday Example: 0,3 = run on Sunday and Wednesday Example: 7 = run on Sunday Example: * = run any day
Enter the username of the user that you want to run the command. Options: pi-star, root Example: root
Enter the command to run. This can be a script or a single command or multiple commands. Example: reboot Example: pistar-link unlink && pistar-link ref063_c The above example will unlink the repeater and then link to REF063C.
Normally when you add a cron task it can be anywhere in the cron file, new lines are typically added at the end. In Pi-Star this works too, except that for some reason a line containing the reboot command should be put in as the first cron task in the list, right below the line we see in step 2 under “UNDERSTANDING CRON”.
Note that if you add anything to the end of the file that you must maintain the new blank line at the end of the file. If you’re at the end of the last cron line, press the down arrow on your keyboard. If you see the cursor move down to the blank line, you’re all set. If the cursor doesn’t go down, just press “enter” on the keyboard to add a blank line at the end of the file.
How to Schedule a Reboot
In order to schedule a reboot every Monday at 4:55am, I entered the following line as a cron job. 55 4 * * 1 root reboot >/dev/null 2>&1
Don’t forget to put it at the top of the cron job list, before the first cron job line, but after the line: # m h dom mon dow user command
Now we have a job that says, at 4:55AM every/any month, every/any day of the month, on Monday, run the reboot command as the root user, and do not show output.
The >/dev/null 2>&1 means that whatever text output the command generates won’t be shown or logged. For more info on what this part of the command means, see this forum post on Stack Exchange.
If you use the cron expression generator from Free Formatter, it will not work with Pi-Star, but it will give you the idea of how to write a cron expression. It also lists all the different options and has plenty of great examples of how to use cron.
First of all, for this project you MUST be a licensed Amateur Radio Operator. In the USA, that means passing a licensing exam and being assigned a callsign from the Federal Communications Commission (FCC). For licensing information check out the American Radio Relay League.
After you receive your confirmation email, go to this page to learn how to assign terminal ID’s to your callsign (STEP 1 only). Terminal ID’s are just what they sound like, it’s an identifier for your individual station. If you’re just using one radio, you can typically set a terminal ID of a single space, however we’re setting up a repeater, so you would need the space terminal ID and whatever module you’re using B for 70CM or C for 2M frequencies.
After you’ve registered for DSTAR you need to get a CCS7 ID for DMR.
Get a ccs7 id number for DMR / DSTAR
Head over to this site and fill out the form selecting the option for a private callsign and NOT a repeater. I’m going to be setting up a private repeater for experimentation so it won’t be running 24/7.
Once your request is processed, you’ll receive an email containing your CCS7 ID number. Put that in a safe place.
Setup and Configure wifi
In order to configure this, because I had no way of getting the IP address from a headless Raspberry Pi, I connected a crossover cat5e cable between the Pi and a PC so I could connect into it and make adjustments.
That said, I want to first explain how I setup the enterprise WiFi for the Pi to work on Pitt’s wireless network.
Press CTRL+o and press enter, then press CTRL+x to exit the nano editor.
Then go to the Configuration page of your Pi, then to the Expert tab, then click “WiFi” in the “Full Edit” line of editors.
You should see a list of networks (probably just one) after a header of sorts
Make sure the country code following “country=” matches your country code. In the USA it’s “country=US” without quotes.
For the enterprise wifi you need to make a new network in this config file. For WIRELESS-PITTNET at the University of Pittsburgh at Bradford, I used the following settings. In this editor I set up the following network:
Go back to your SSH access page in your browser and do the follow steps.
Enter the following substituting YOUR_PASSWORD with your university email password leave the single quotes around your password. and press enter.
Next copy the resulting random letters and numbers into the WiFi editor in the other tab after the colon where it says “password=hash:”
Now go back to your SSH editor and clear your history by typing:
Press “Apply Changes” at the bottom of the page beneath the wifi editor.
If you followed these steps correctly your pi should connect to WIRELESS-PITTNET.
In your browser go the main page of your Pi-Star dashboard at:
You should see the following page:
Start by selecting MMDVMHost and Duplex (repeaters) or Simplex (personal hotspots), then click apply changes.
After the services are restarted, you should see the following page:
I started the configuration process without the actual interface board, keep that in mind. I did not activate any services yet, however I set the hostname, the node callsign, the RX/TX Frequencies, the GPS coordinates, the town (in the format of “city”, “grid locator”, the country, the URL (this can be either a manual URL of the dashboard for the repeater or automatic and will default the QRZ page for the node callsign), the node type (public – anyone can use it / private – only the node callsign can use it), the time zone, and the dashboard language_country code.
You can also setup the firewall if you wish. Private makes it only work within your local network, public will make it work from outside your network provided the correct ports are forwarded on the router.
I left Auto AP on because if the Pi doesn’t/can’t make a network connection, it will create a wifi hotspot of it’s own so you can connect to it and configure the network settings.
I left UPNP turned off. If your router also has UPNP, you can turn this feature on and Pi-Star will configure your router’s firewall to open the necessary ports.
I found a neat little circuit board on eBay that works with MMDVMHost software and is a mini personal repeater on a single board. I thought this would be a great way to demonstrate a repeater without having to bring in multiple radios, a power supply, the computer, etc. So I’m going to use the MMDVM_HS_Dual_Hat. The board on eBay is a cheaper Chinese “clone” of the original board which is pictured below.
This week, I began the installation and configuration of the Pi-Star software on a Raspberry Pi 3B. In this post I will walk you through step by step, how to image the microSD card. I will also discuss setting up a home WiFi Network. In the next post, I’ll talk about configuring the basics of PiStar including enterprise WiFi networks and hashing the WiFi passwords.
The first step is to download the Pi-Star software using the link in the list of parts. At the time of this writing, the version for the Raspberry Pi is “Pi-Star_RPi_V3.4.16_10-Aug-2018.zip”
Download the wpa_supplicant.conf file. If it opens as a web page, simply copy the contents of the file and paste it into Notepad or Text Edit and save as “wpa_supplicant.conf” without quotes.
In the file, replace the capitalized “SSID” with your network name.
Next in the file, replace the capitalized “PSK” with your network password.
Save the file making sure that the filename is wpa_supplicant.conf.
Imaging the microSD Card
First, we’ll download an SD card imaging tool. For general imaging uses, I like to use a software called Etcher, which is available for Mac, Windows, and Linux. If you need to backup an SD Card, I use a tool for Mac called Apple Pi Baker. You can also use this tool to image SD Cards and it allows you to backup/restore an SD card to/frome a compressed file (.zip, .gzip, .7zip, etc). For Windows there is a program called Win32DiskImager which will allow you to backup or image an SD card in the uncompressed “.img” format. In this tutorial, I’ll use Apple Pi Baker on a MacOS PC.
I’m not going to cover backing up the SD card in this tutorial, but if you have anything on your card that you want to save, be sure you have backed it up first as the following steps will ERASE everything on the card.
First insert the microSD card into the SD card adapter and insert the adapter into your computer. Be sure the switch (if any) on the adapter is in the up position to allow the computer to write to the card.
Next, go to the folder you downloaded Pi-Star into and double click the .zip file to extract its contents. It will be a folder that is extracted.
Double click the folder to enter it and make sure there is a file around 2.5-3gb in size named with a “.img” extension.
Next open Apple Pi Baker and enter your administrator password if prompted. The admin password is required to allow the app to write directly to the SD card device.
Next you should see a screen that looks like this:
Select your SD card in the box under Pi-Crust. Mine isn’t shown in the photo above because it wasn’t inserted when I opened Pi Baker. Just click the green refresh button to the top right of the white box and it should show up.
Be 100% sure you’ve selected the correct SD Card/drive in the Pi-Crust Section. If you have other SD cards or flash drives inserted they may show up as well. SELECT THE CORRECT DRIVE. ALL DATA ON THE SELECTED DRIVE WILL BE ERASED.
Under Pi-Ingredients, click the 3 dots button and find the Pi-Star .img file we found in step five.
Uncheck the “Auto eject after successful restore” checkbox.
Next after you are certain you have everything set correctly and have selected the correct SD card, you’ll click “Restore Backup” in the Pi-Ingredients Section.
You should see a screen like this:
Wait until you get the notification that the process is complete and then you can close Pi-Baker.
Setting Up HOME WiFi
Open Finder or My Computer (This PC) and locate the wpa_supplicant.conf file you edited previously.
Copy the file by right clicking the file and left clicking copy.
Navigate to the SD card which should be labeled “Boot”.
Paste the copied wpa_supplicant.conf file by right clicking in the space free of any files and click paste or just press CTRL+V (Windows) or CMD+V (macOS) to paste the file.
Close Finder or Windows Explorer.
Eject or Safely Remove the SD card. On macOS, drag the SD card to the trash bin or click the eject button next to it in Finder. On Windows, in My Computer or This PC, right click the SD card and click “eject.”
Insert the MicroSD card into the Raspberry Pi and plug in the power cord.
The LED on the Pi should light up red, with a flashing green LED next to it.
Wait a few minutes as the Pi will load the WiFi configuration and reboot.
From your PC, connected to the same WiFi network you setup the Pi on, open your web browser and go to one of the following sites: