To control Pi-Star using RF commands, you can setup the commands at http://pi-star/admin/expert/fulledit_pistar-remote.php In any event, you go to your PiStar dashboard then click Configuration > Expert > PiStar-Remote.
In that text box that comes up will be the configuration file. You will need to change the following:
enabled=true callsign=N3TDM
PiStar-Remote Configuration File
Whatever callsign you enter is the callsign that must be in the transmitting radio as My Callsign in order for PiStar to initiate the commands. In other words, if the callsign in this file is yours, I would not be able to initiate these RF commands using my callsign in my radio.
Then for each service you are using (DSTAR, DMR, etc) you can either add a # in front of a line that you don’t want enabled or remove the # from the front of the line to enable a given command. For instance, if you want to enable the shutdown command for DSTAR, you would go under the DSTAR section/stanza and remove the # symbol from before the word shutdown. Then when you’re done, click Apply Changes at the bottom of the page.
To use this Shutdown RF Command, in DSTAR in your radio’s UR call field, you would put the word SHUTDOWN in all capital letters. And in your RPT1 and RPT2 call fields would be the same as they are in your standard Talk channel, likely something like RPT1: N3TDM B and RPT2: N3TDM G. When you press PTT on this channel/memory it will again cause the Pi to shutdown and halt. Just remember you will need to physically unplug and plug it back in to restart it. The RF commands can’t turn it back on once it has been turned off.
You can enable the other options as well and I’ll briefly describe them here:
[d-star] # UR fields
svckill=SVCKILL This turns off DSTAR, kills the ircddbgateway service.
svcrestart=SVCRSTRT This restarts the ircddbgateway service.
reboot=REBOOTPI This reboots/restarts the Raspberry Pi.
#shutdown=SHUTDOWN This causes the Raspberry Pi to shutdown.
getip=GETIP This will cause Pi-Star to announce via DSTAR the LOCAL IP address of the Pi – helpful to get into the Pi or get to the PiStar dashboard if http://pi-star/ doesn’t work.
#hostfiles=HOSTFILE This will cause Pi-Star to update the host files that map DSTAR reflectors/repeaters to their IP addresses.
#8Ball=8BALL This will cause ircddbgateway to connect to a random reflector or other DSTAR station.
PiStar-Remote Configuration File
Even if you’re not using DSTAR, the same descriptions above apply to the lines under the other services, just in regards to that service and not the DSTAR services.
I hope you find this helpful and as always, if you need assistance don’t hesitate to reach out to me via my contact page or the comment section.
Please note that all of the Pi Star and MMDVM posts prior to this post are now about 4 years old and may not apply or work for Pi-Star anymore. The general idea is still good, but things have been updated in Pi Star and may not work the same way anymore.
If you follow these directions, you do so at your own risk (physical, software, sanity).
If something fails to work the way it should, feel free to contact me and I will try to help, but I make no guarantees that I can help you. I haven’t kept up with Pi-Star much since my friend, Ted, passed away. I managed his repeater that used Pi-Star for a DSTAR link. After his passing, I setup a DSTAR hotspot, but I don’t tinker with it anymore. Ted was always the one who wanted to tinker and make it do new things.
How to setup live streaming using OBS, a video camera, and an XLR microphone.
Two posts ago, I talked about how I setup Open Broadcaster Software and my audio/video equipment to record and live stream events hosted by the Pride Alliance at my alma mater.
I have since upgraded a couple of things and wanted to share an update on how I do things now.
Hardware Setup
Video Camera
I use a Canon Vixia HF R400 video camera to record and live stream with. I setup this camera and record in camera in 1920 x 1080 px resolution with a medium quality so that my resulting files aren’t too big to upload to YouTube.
HDMI Capture Card Setup
I recently switched from using a TV Tuner Card (Hauppauge WinTV HVR-950Q) to a cheap HDMI capture card. When I ordered this capture card I wasn’t expecting much for $10, but it works perfectly fine for me and doesn’t get hot when I’m using it. Originally I bought it to mirror my camera to a larger display, but then I thought about using it for live streaming.
It is a Uoeos HDMI Capture Card that apparently isn’t available on Amazon anymore.
Audio Setup
I recently wanted some better quality audio in my recordings so I naturally asked my cousin who is a musician. He set me up with a USB audio interface and a couple of different microphones and a few XLR cables. Unfortunately the USB audio interface didn’t have a microphone level output that I felt comfortable plugging into my camera. I built a circuit to reduce the audio levels, however I wound up buying a device specifically made to connect an XLR microphone to a camera or smartphone.
XLR to camera Adapter
I needed a device to connect these XLR microphones to my camera which only has a 3.5mm mic jack. So I bought the Comica LinkFlex AD-2. It has a single XLR and 1/4″ Instrument combo jack and can supply 48v phantom power to power condenser microphones. In addition it can change it’s TRRS jack to work with a camera instead of a smartphone with the flip of a switch and it can output audio from the XLR or 1/4″ jack to a headphone jack so you can monitor the audio. Overall it works great for my needs and was priced just right. It’s a shame though that it only runs on a 9v battery. I wish it could be plugged into the wall. I was worried about the battery dying in the middle of the event, however, a fully charged 9v alkaline battery reads about 9.4V. After approximately 45 minutes of use the battery reads about 9.25v. That was with using the 48v phantom power too.
Microphones
At the last event I used an Audio Technica AT-2021 Condenser microphone that I had borrowed from my cousin. It has a cardioid pickup pattern and is more designed for recording instruments, however I found it worked very well (at least for me) for recording a person speaking.
I recently purchased a stereo matched pair of Behringer C-2 condenser microphones. These also have a cardioid pickup pattern. I haven’t had a chance to use them yet, but I’m thinking they will sound decent or maybe as good as the more expensive AT-2021. I’m a bad tester for that though with my low frequency hearing loss.
Plug for Sweetwater Music Store: This store was recommended to me by my uncle and I can’t say enough good things about the store. I made my order and they had a sales engineer (who has tons of experience and training in audio production and training on products) contact me by phone. I didn’t answer the phone because I didn’t recognize the number. The sales engineer left me a voicemail and sent me a text message to follow up with me about my order. He said he was always available if I had questions or just wanted to chat about anything audio or equipment. When I received my order I also got a Sweetwater logo sticker and a bag of a candy as a thanks for my order. This is a company that values their customers and will go above and beyond to help you out. They also pack their items extremely well. I’d give them 10 out of 5 stars if I could! I am not affiliated with them in any way; I’m just a very satisfied customer.
Cables
To connect the microphone to the camera interface, I’m just using a cheap MCSProAudio XLR Cable I found on Amazon. I bought a 50 foot cable thinking it would be long enough, but definitely should have bought a 100 foot cable. The 50 foot cable worked fine, I just had to connect another cable to it.
To connect the camera to the HDMI Capture Card I the HDMI cable that came with the camera.
I’m rescaling the output to 1280 x 720 px and sending it to Facebook with a Constant Bit Rate (CBR) of 2500 Kbps as seen below.
In the video settings tab, I set the base canvas resolution to 1280 x 720 px as well as the output resolution and set the frame rate to 29.97 FPS as seen below.
HDMI Capture Device Settings
In the “Sources” panel I have the resolution of the HDMI capture card set to 1280 x 720 px.
In the “Advanced Audio Properties” screen of the HDMI Capture Card’s settings (in the “Audio Mixer” panel) I have the HDMI capture card’s “Audio Monitoring” setting set to “Monitor AND Output”. This setting has caused me issues previously where I have forgotten to click the setting with output otherwise it won’t send audio to the live stream. I use this setting to monitor the audio I’m getting through the HDMI Capture Card.
I check the audio levels on the camera and adjust the Comica LinkFlex AD-2’s gain control to get the audio level right in the camera, then I adjust the audio level in OBS to get the right audio level output for the live stream. I typically monitor the audio level through OBS on my laptop so I know what the audio sounds like on the live stream.
A DIY Dummy Load that will handle about 100w RF from 1.8 Khz to 450 Mhz.
I made a dummy load before using a bunch of resistors, a paint can, and added some electronics so it could measure the radio’s power output. Unfortunately that dummy load is only good through 2 meters and a lot of my stuff is done on 70cm now.
Good Quality Thermal Paste (Arctic Silver or similar)
Tools
Drill & Drill Bits (3/32 Inch & 5/8 Inch)
Soldering Iron & Solder
Wire Strippers
PowerPole Crimping Tool (If you use PowerPoles)
Screw Driver
Socket or Pliers for the 4-40 Nuts
Block of wood at least 5in long on one side
Permanent Marker
Ruler or Tape Measure
Instructions
Measure 4 inches in from the end of the aluminum sheet (this will make a 4in square on the sheet) and draw a line.
Next measure ½ inch from the other end of the aluminum sheet and mark that line. These lines are where you will bend the aluminum, but don’t do that yet.
Now mark the center of the 4in square you created with that first line, by measuring in 2 inches from each side or use a ruler to draw two diagonal lines from the corners of the aluminum sheet to the corners of the line you drew. Where these lines meet should be the center of your square.
Next place the aluminum sheet on your block of wood and clamp it down.
Drill a 5/8 inch hole through the aluminum sheet on that center mark. The wood will ensure you don’t drill through your good desk or table. 🙂
Now ensure the SO-239 will fit in that hole. You may need to file the edges a bit with a round file.
Once the SO-239 fits in the hole, mark the 4 holes around the connector and drill them out with the 3/32 inch drill bit. I would place the wood under the holes you’re drilling.
Now place the aluminum sheet over the block of wood, lining up the line you drew with the wood and bend it over. It might be easier to do this in a tabletop vice.
After that, use 4 of the ½ inch 4-40 bolts and 4 nuts to secure the SO-239 into the aluminum sheet.
Now place the resistor on the inside of the sheet as close to the SO 239 connector as possible. Remember that your nuts and bolts must fit. Mark the two holes for the resistor.
Drill two 3/32 inch holes for the resistor. DO NOT drill through the holes already in the resistor, remove it first.
Apply thermal paste to the bottom of the resistor.
Ensure that the center pin of the resistor (the little foil tab) is facing the SO-239.
Put two ½ inch long 4-40 bolts through the resistor and the holes in the aluminum sheet. Add one washer to each bolt against the aluminum sheet. Then add one 4-40 nut to each bolt and hand tighten only. You just want it slightly snug, don’t break the resistor.
Next, add flux to the foil tab of the resistor and solder a small piece of copper braid (or wire) to the foil tab, slip the heat shrink tubing over the wire and foil tab and then solder the other end of the braid to the center pin of the SO-239.
Place the aluminum sheet over the wood again, lining up the other line with the edge of the wood or edge of the vice and bend it up.
Place the fan against this lip of the sheet and mark the holes. Drill two 3/32 inch holes.
Place the fan so that it blows air towards the resistor and put the fan on the inside of the lip.
Next using two 1 ¼ inch long 4-40 bolts, 2 washers, and 2 nuts, bolt the fan to the sheet with a washer between the fan and the nut.
Next add a PowerPole or DC connector to the fan’s wires.
Now you have a 100W dummy load that should work from 160m through about 70cm. Use the least amount of power possible when testing. I wouldn’t use this over 50w except for very short durations. The more power you use, the shorter the life of the resistor and you could burn it up.
SWR Graphs
So how does it stack up? Check out these SWR graphs. Under 1.2 to 1 SWR from 1.8Mhz to 148Mhz is good enough for me. On 70cm it has an SWR under 1.46 to 1, so it’s not the best, but it’s usable.
During 6 and 1/2 of my 7 years of college (part time), I was President of and helped build a student organization for LGBTQ+ students and their allies. Every year we host an event comprised of speeches from students, faculty, and staff that I video tape. Eventually we began streaming the event live on Facebook. The event is always around the 2nd week of October.
Now I’m an alumni advisor to the organization and I’m still recording/live streaming the event. I wanted to post about how I do this, mainly for my future reference.
Windows 10 Laptop (Currently using a 14″ Lenovo IdeaPad Flex 5 – 14ITL05)
The event is held in a small, but beautiful chapel on campus. I normally setup the camera in the back corner of the room and the speaker is in the opposite corner in the front of the room. The recorded audio has always been decent, but it could definitely be better.
I connect the camera’s A/V output into the composite input cable on the TV Tuner, which is then plugged into the computer’s USB port. I use the software that came with the TV tuner or VirtualDub to set the channel on the TV tuner to the composite input. Then I can close VirtualDub or the TV tuner software and open OBS.
Computer Specs
OBS Setup
In OBS, I have a scene with just a photo source (the club’s logo). In another scene, I have the TV tuner’s video and audio sources. I run the photo a few minutes before we start and then switch over to the camera when the event begins. I do the actual recording in the camcorder at 1080p 30fps. Composite video has a standard resolution of 480i or 576i, so I set OBS to stream at a resolution of 640 x 480 to Facebook using a bit rate of 2000 kbps.
DIY Electret Condenser Microphones
Disclaimer
I am NOT responsible for any loss or damage resulting from the use or building of this project. PLEASE make sure your camera/device accepts this type of powered microphone before connecting it. I am NOT going to be responsible for any damage you may cause by building or using this microphone.
Parts list
6 Feet of 2 Conductor Audio Cable – I used thin coax cable, RG-174.
2 Mono 3.5mm (1/8″) Phone Plugs (male)
2 Capacitors (100nF – Code 104) – I used the ceramic disc type.
2 resistors (680 Ohm) – Value should match the impedance of the microphone elements you purchase.
2 Microphone Elements – I used PUI Audio AUM-5047L-3-R.
2 short lengths of PVC Pipe – I used 1/2″ Sched. 40 PVC cut at 6.5″.
2 PVC End Caps – Size needs to match the PVC pipe.
Spray Paint
1 Length of wood or PVC pipe cut at 26″
2 Bolts – 6-32 size. Use a length that will go through 1/2″ PVC (OD = 0.84″) and your piece of wood/pipe. (I used 2.5″ bolts and they were a 1/2″ too long).
8 Flat Washers – #6 Size
2 Hex Nuts – 6-32 Size
2 Wing Nuts – 6-32 Size
Heat Shrink Tubing (various sizes)
Air Conditioner Foam Filter
3 Panel Mount 3.5mm Phone Jacks (female)
9V Battery
9V Battery Holder
Tools
Soldering Tools
15W Soldering Iron
Solder – I used 63% Lead / 37% Tin with a rosin core.
Desoldering Wick
Flux Pen
Pliers
Wire Cutters
Wire Strippers
Tweezers (optional)
Lighter
Audacity Recording Software
I’m not going to go into painting the PVC and putting the bolts through it. Nor will I cover cutting the slots in the PVC pipe or the sewing of the windscreen foam.
How to Build The electronics
wiring the microphones & connectors
The first thing I did was solder the connectors onto the ends of the coax or audio cable. Make sure you put the plug’s cover on first. I did not care about interoperability so I soldered the center conductor of the coax to the center pin and the shield of the coax to the sleeve of the connector. Put one connector on each 3 foot piece of cable.
Put heat shrink over the cable first. (we’ll shrink this later).
On the other end of the cable we’ll solder the microphone element to the wire. The center pin goes to the positive and the shield of the coax connects to the negative on the mic element. Try to do this quick and precisely or you’ll ruin the mic like I did on my first try. I had to order another one after ripping the solder pad off the mic element. The mic’s solder pads are tiny, about 1mm wide by 3mm long. Don’t short the two solder pads either.
Slide the heat shrink tubing up enough to cover the wires a bit, but do NOT cover the back of the microphone element. Shrink it over the wire. Don’t over heat the wire or mic element.
Make sure you’re soldering the center conductor to the positive solder pad on the mic element. I messed this up on one microphone and could not figure out why neither microphone worked with the circuit.
create the circuit
Using the above schematic, we’ll create the circuit used to power the microphones.
Basically, the resistors provide bias to the microphone elements. The value of these 2 resistors should match the impedance of the microphone elements you bought. Mine were 680 Ohm. These resistors should be 1/2 Watt resistors.
The capacitors block the battery’s direct current (DC) from getting into the camera. While capacitors block DC current, they allow AC current, such as an audio signal, to pass through.
NOTE: Some capacitors are polarized and must be installed with the positive leg facing the microphone elements. If you install the capacitor backwards you could damage your camera and/or the microphone elements. The capacitors used in this schematic are NOT polarized.
Test for DC on the Output before use
Just to be on the safe side, I tested for any DC voltage on the output before I plugged this into my camera. Plug in the battery, turn the switch on and test the output connector with a multimeter for DC voltage to make sure there will NOT be any DC getting into the camera. If your multimeter detects DC voltage on the output do NOT plug it into the camera. Go back and check your connections.
Creating the Stereo Effect (Extremely Basic)
This part is a little over my head, but according to what I’ve read, you can create a stereo effect in one of many ways. Since I couldn’t find microphone elements with the correct polar patterns to create a single stereo microphone, I made two mono microphones that get connected to the circuit which connects both of them to the stereo mic input on my camera. By separating the microphones at least 24 inches using the piece of wood or pipe, you will get a “stereo” sound effect.
Matching the microphones
Typically, when a stereo microphone is built, the two elements are “matched” to be sure that the sounds they record are the same volume and gain on both the left and right channels. This is done so that the volume of one channel is the same as the other, else the audio would not sound right.
I personally did NOT match my microphone elements. I am not recording professional audio and I needed something cheap. I also wasn’t 100% sure how to do it at home (it can be done fairly well at home though).
That said, the two microphones are from the same manufacturing lot, the audio sounds the same on both channels to me and the gain of each channel is extremely close when looked at with Audacity.
Results
The microphones sound MUCH better than the camera’s internal microphone. They’re fairly clear and provide decent audio for a “home” video. The volume of the recorded audio was almost exactly the same as the source audio I recorded.
The internal camera microphones sounded quieter than the source I was recording. While they were clear, the audio didn’t sound as clear or as full as the microphones I built. The audio from the camera sounded like it was too deep.
Sources
I used many sources and forums to find the information necessary to build my microphones. I originally was trying to build a shotgun microphone (a very directional microphone employing an interference tube design), but there was significantly more information on building a DIY Directional Microphone, so I went with that. I did research over the course of a couple of weeks trying to learn enough to build this project. The circuit is the basic manufacturer’s recommended design for a single microphone element that has been modified to connect two microphone elements to the same battery and stereo output connector.
I want to thank everyone who put this information out there for others to use.
I recently had a gentleman, Richie M6XRM, contact me on how to do this. It proved to be quite the challenge.
Instructions & Script
The information and how to has been posted on my GitHub page along with the script (you will need to supply your own URL to the stripped.csv file). Below I’ll explain the issues we encountered while trying to configure this automatic update. I can’t say that this is the best or only way to do this, however this is how I did it and I can confirm it works.
Issues & Fixes
Issue 1
One of the biggest issues was writing the script on Windows and converting/keeping the line endings of that script as unix line endings so they’re compatible with linux. I used Notepad++ to write and edit the script before uploading it to GitHub. Apparently it is not enough to save the file as a UNIX bash/sh file type. At the bottom of Notepad++ it says what the line endings are and I never noticed it. The DOS line endings created a lot of issues when the script was run on the Pi.
Fix 1
The fix for this in Notepad++ is to click Edit > EOL Conversion > Unix and then save the file as a UNIX bash/sh file with the extension “.sh”. The fix in the nano text editor is to press CTRL + x, then y, then ALT + d, then enter.
Issue 2
The other major issue was that system cron on the Pi does not understand rpi-rw even when it is run inside the script which is being run as root.
The cause of this is that rpi-rw is actually an alias set in the bash profile for the logged in user. Since cron runs as it’s own thing/shell separate from the logged in user (pi-star), it doesn’t understand rpi-rw or at least it didn’t understand it for me or Richie.
Fix 2
The fix for this is to put the actual command that rpi-rw points to in the script instead of using rpi-rw. That command is as follows:
sudo mount -o remount,rw / ; sudo mount -o remount,rw /boot
I came across this page on Medium which explained how to convert Raspbian to a read-only filesystem which is what Pi-Star uses. At the end of the page it talks about creating an ro and rw alias to quickly switch the filesystem between read-only and read-write. That’s when it dawned on me that this is the way the Pi-Star developers handled the read only operating system and that rpi-rw/rpi-ro are aliases.
A huge thank you to Richie M6XRM for his patience with me in figuring this out and for being so understanding while I was recovering from surgery.
We just hope this helps someone else and explains a bit of the mystery behind the rpi-rw and rpi-ro aliases.
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.”
Understanding 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.
m (Minutes)
Enter the minute you want to run the task at or * for any minute.
h (Hours)
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
mon (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
user
Enter the username of the user that you want to run the command. Options: pi-star, root Example: root
command
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.
I’ve been trying to experiment with TinkerCAD to model a 3D printable box for this project. I have the bottom of the case designed with the mounting holes for the Pi. I haven’t been able to figure out how to design the top of the case so that it snaps into place.
Here is a top view of the bottom part of the case.
Here is a top view at an angle.
I have no prototyped this so I can’t even say for sure that the mounting holes are correct, but I believe they are. I did make the holes slightly smaller to allow screws to bite into the plastic.