BATC ATV Repeater - Network Control of Video Switches

Ideas, technical topics, help and discussion for ATV repeater builders
G8GKQ
Site Admin
Posts: 2798
Joined: Sun Mar 22, 2009 1:21 pm

Re: Triggers as an alternative to GPIO

Post by G8GKQ » Wed Feb 23, 2022 4:36 pm

OK Justin

The controller is not ready for those commands in the config file yet, I was simply making a proposal on how it might work.

I'll e-mail you with some tests to do, and then I can start on the implementation.

Dave

G8YTZ
Posts: 103
Joined: Sun Feb 10, 2019 7:43 pm

Re: Triggers as an alternative to GPIO

Post by G8YTZ » Thu Feb 24, 2022 1:30 am

Dave,

I've updated the following sections of the config file:

Code: Select all

# Text file defining behaviour and config of the BATC HDMI Repeater Design
# Comments must be on their own line
# Read at boot time.  Only modified from console menu or text editor, except 
# transmitenabled which is amended by dtmfkeepertxoff or dtmfkeepertxon

#Bitfocus Companion server address & port
networkctrlurl=http://192.0.1.176:8888

# Station Details
callsign=GB3JV
locator=JO01AJ
And...

Code: Select all

input1name=Stream Input
input1prioritylevel=1
input1activegpiopin=32
output1code=nec:0x12
output1netcommand=press/bank/1/9
output1hdmiswitchpin=37
output1i2cchannel=2
output1audioi2cbit=1
input1announcemediatype=jpg
input1announcemediafile=/home/pi/tmp/input1.jpg
input1announcemediaduration=3

input2name=QO-100 RX
input2prioritylevel=2
input2activegpiopin=35
output2code=nec:0x59
output1netcommand=press/bank/1/10
output2hdmiswitchpin=38
output2i2cchannel=3
output2audioi2cbit=2
input2announcemediatype=jpg
input2announcemediafile=/home/pi/tmp/input2.jpg
input2announcemediaduration=3

input3name=3.4 GHz Ryde
input3prioritylevel=3
input3activegpiopin=18
output3code=nec:0x08
output1netcommand=press/bank/1/11
output3hdmiswitchpin=33
output3i2cchannel=4
output3audioi2cbit=3
input3announcemediatype=jpg
input3announcemediafile=/home/pi/tmp/input3.jpg
input3announcemediaduration=3

input4name=Quad View
input4prioritylevel=7
input4activegpiopin=22
output4code=nec:0x18
#output4code=2nec:0x12 (daisy chain, not quad)
output1netcommand=press/bank/1/12
output4hdmiswitchpin=31
output4i2cchannel=5
output4audioi2cbit=4
input4announcemediatype=jpg
input4announcemediafile=/home/pi/tmp/input4.jpg
input4announcemediaduration=3

input5name=Mast Camera
input5prioritylevel=7
input5activegpiopin=16
output5code=2nec:0x59
output1netcommand=press/bank/1/13
output5hdmiswitchpin=29
output5i2cchannel=6
output5audioi2cbit=5
input5announcemediatype=jpg
input5announcemediafile=/home/pi/tmp/input5.jpg
input5announcemediaduration=10

input6name=Unused 6
input6prioritylevel=9
input6activegpiopin=19
output6code=2nec:0x08
#output6code=2nec:0x08 (daisy chain)
output1netcommand=press/bank/1/14
output6hdmiswitchpin=23
output6i2cchannel=7
output6audioi2cbit=6
input6announcemediatype=jpg
input6announcemediafile=/home/pi/tmp/input6.jpg
input6announcemediaduration=3

input7name=Unused 7
input7prioritylevel=9
input7activegpiopin=21
output7code=2nec:0x08
#output7code=2nec:0x12 (daisy chain)
output1netcommand=press/bank/1/15
output7hdmiswitchpin=24
output7i2cchannel=8
output7audioi2cbit=7
input7announcemediatype=jpg
input7announcemediafile=/home/pi/tmp/input7.jpg
input7announcemediaduration=3

G8YTZ
Posts: 103
Joined: Sun Feb 10, 2019 7:43 pm

Re: Triggers as an alternative to GPIO

Post by G8YTZ » Thu Feb 24, 2022 2:07 am

G8GKQ wrote:
Wed Feb 23, 2022 4:36 pm
OK Justin

The controller is not ready for those commands in the config file yet, I was simply making a proposal on how it might work.

I'll e-mail you with some tests to do, and then I can start on the implementation.

Dave
OK Dave! Many many thanks for this, I have some great ideas for this and I think it will get round some of the issues with HDMI. Another switch option might be the BlackMagic Multiview 4, I think I'll stick with the ATEM, but the MultiView is a smaller and cheaper option, SDI input/output and HDMI output and supports Multiview. The HDMI output could feed the TX and the SDI output the BlackMagic Streamer. They cost £160 inc. VAT I might see if I can get one on a loan/test.

https://www.thomann.de/gb/blackmagic_de ... w_4_hd.htm

G8GKQ
Site Admin
Posts: 2798
Joined: Sun Mar 22, 2009 1:21 pm

BATC ATV Repeater - Network Control of Video Switches

Post by G8GKQ » Thu Feb 24, 2022 10:36 am

I have opened this thread for discussion of Network Control of Video Switches by the BATC ATV Repeater. Other posts on the subject will be moved here

Dave, G8GKQ

G8GKQ
Site Admin
Posts: 2798
Joined: Sun Mar 22, 2009 1:21 pm

Re: BATC ATV Repeater - Network Control of Video Switches

Post by G8GKQ » Thu Feb 24, 2022 10:42 am

Now awaiting the results of the tests that I have e-mailed to Justin before we progress this further.

Dave

G8GKQ
Site Admin
Posts: 2798
Joined: Sun Mar 22, 2009 1:21 pm

Re: BATC ATV Repeater - Network Control of Video Switches

Post by G8GKQ » Sat Feb 26, 2022 4:15 pm

I have just released version 202202260 of the BATC repeater Controller, which includes "Network Control of Video Switches" and some bugfixes.

You can upgrade from the ssh console menu (just type menu at the Linux command prompt). The update process includes the option to keep your old configuration file. To enable the new functionality, you should reject this option. If you don't need the new functionality and just want the bugfixes, then accept the option.

To enable the network control, hand edit the /home/pi/atv-rptr/config/repeater_config.txt file and set the parameter

Code: Select all

outputswitchcontrol=html
Then check the entries for:

Code: Select all

# Bitfocus Companion (html) server address & port (no trailing slash)
networkctrlurl=http://192.0.1.176:8888
# Other net commands have leading slash
outputquadnetcommand=/press/bank/1/11
and the entries against each input of the form:

Code: Select all

output0netcommand=/press/bank/1/8
Then restart the repeater to load the new settings (rptr from the command line will do this).

Please report any bugs here.

Dave, G8GKQ

G8YTZ
Posts: 103
Joined: Sun Feb 10, 2019 7:43 pm

Re: BATC ATV Repeater - Network Control of Video Switches

Post by G8YTZ » Sat Feb 26, 2022 10:11 pm

OK Dave,

The commands work! :-) Wow! :-)

Right now my initial tests are quick and dirty; holding with a couple of the GPIO inputs to 3.3V with a jumper wire, but I wanted to report back ASAP,

I will do further testing tonight and tomorrow morning with a Ryde and a Pi3 Stream Receiver to confirm all the switching logic works and that the GPIO logic is correct (not inverted etc.). So far it looks very promising indeed. I saw one issue, but I think this might be 'key bounce' with me manually holding the GPIO wire to 3.3V, so I need to do the proper test. My concern here is if the Ryde input signal flaps and hence the GPIO pin flaps what the affect would be on the ATEM macro. A quick flap seems to halt the ATEM macro, but I should be able to work-round this in the macro design. It might not be an issue in practice with a real Ryde GPIO output connected to the GPIO input. I mention this FYI purely in case it could affect the IR mode under some signal conditions too.

I see it seems to have the 15-minute ID feature. I have yet to customize my macro to support this, I've not done it yet, but I'll do that as part of my testing too.

I've spotted a couple general bugs, but I think I know what the cause is:

First I updated the software from existing to new version, but kept the old config file, but after initial (failed) tests I then decided to update again, but not to keep my config file, but to use your default file.

One mistake I made in my file was adding "outputswitchcontrol=html" in addition to "outputswitchcontrol=ir". This might have caused the issues I describe below.

1. When updating the software from 202202260 to 202202260 the server did not reboot, but left it in a state where ssh was refused by my client (generic Ubuntu terminal window). See comment in 2. below.
- Impact: Would potentially require a site visit for a power cycle.

Note: have also seen this behavior on some previous Ryde versions when upgrading.

2. When performing reboot from the menu when running 202202260, the ssh connection was closed and further attempts to reconnect were refused, but the graphics carousel continued on the HDMI output.
- Impact: Would potentially require a site visit for a power cycle.

This condition I repeated twice, but not again, it might be that it was not happy with my original config file, it could also explain the previous Ryde issue I had too. I suspect that an illegal item in the config file could cause this behavior.

I have been thinking about how I can remote power cycle the Pis, my favored option right now it to connect the reboot pin of all the Pis to a relay contact on the ModBus controller to send a remote reset command to all the Pis. Might need a diode "and" gate.

G8YTZ
Posts: 103
Joined: Sun Feb 10, 2019 7:43 pm

Re: BATC ATV Repeater - Network Control of Video Switches

Post by G8YTZ » Sun Feb 27, 2022 12:04 pm

Dave,

I've done some more testing this morning and discovered a bug in the switching. I've attached the config file and wire-shark captures for reference.

I'm testing by simulating switching of GPIO pins #32 and #35.

- Whichever input I select on the GPIO the controller outputs the same command to switch to the controller input #0 output0netcommand=/press/bank/1/8
Packet Capture with output0netcommand=/press/bank/1/8 set
Packet Capture with output0netcommand=/press/bank/1/8 set
Packet Capture 2.png (49.73 KiB) Viewed 9073 times
I modified the config file to remove the line in the input0name=Controller configuration:

#output0netcommand=/press/bank/1/8

After this the correct commands were sent when the input went high, but no command was sent to the controller when the GPIO input went low again after my simulated transmission.
Packet capture output0netcommand=/press/bank/1/8 commented out
Packet capture output0netcommand=/press/bank/1/8 commented out
Packet Capture 3.png (59.45 KiB) Viewed 9073 times
Expected behavior is that that following transmission the command output0netcommand=/press/bank/1/8 would be sent to return the source back to the controller input.

Code: Select all

 # Text file defining behaviour and config of the BATC HDMI Repeater Design
# Comments must be on their own line
# Read at boot time.  Only modified from console menu or text editor, except 
# transmitenabled which is amended by dtmfkeepertxoff or dtmfkeepertxon

# Station Details
callsign=GB3JV
locator=JO01AJ

# Video output: hdmi720, hdmi1080, pal, ntsc
# Used to size captions and layout display.  NOT to set output
vidout=hdmi1080

# Ident and K CW audio output: hdmi, jack or usb
# This IS used to set the output port (but not the hdmi keep-alive)
audioout=hdmi

# Turn on low level audio noise to keep hdmi audio active? yes/no
# Level %
audiokeepalive=yes
audiokeepalivelevel=85

# Enable/disable transmit ptt active? yes/no
transmitenabled=yes

# Beacon mode only transmits carousel with ident.  Set to no for rptr operation. yes/no
beaconmode=no

# Continuous TX or power-saving.  no/yes
transmitwhennotinuse=yes

# Continuous operation or active hours only. yes/no
24houroperation=yes

# Power save during second half hour in active hours?  Default no.
# Repeat and Ident are available/active during this time
halfhourpowersave=no

# Operating times are UTC.  Ignored for 24/7 operation
operatingtimestart=1000
operatingtimefinish=2330

# Quiet hours behaviour:
repeatduringquiethours=no
identduringquiethours=no

# Transmit PTT Demand physical pin (recommended 40)
pttgpiopin=40

# Front Panel Shutdown Enabled? and physical GPIO Pin (recommended 26)
fpshutdown=no
fpsdgpiopin=26

# DTMF control - uses white "Portsdown/Langstone" USB dongle input
# Control is on/off.  Gain is %.  Timeout is in seconds
# All dtmf codes are of the format *xx#.  Only xx are defined below.  Examples:
dtmfcontrol=on
dtmfaudiogain=62
dtmfactiontimeout=600
dtmfreset=00
dtmfstatusview=01
dtmfquadview=04
dtmftalkbackaudioenable=07
dtmftalkbackaudiodisable=08

# Keeper codes are 5 digit and must start with 9 (*9xxxx#)
dtmfkeepertxoff=97350
dtmfkeepertxon=97351
dtmfkeeperreboot=97359

# User codes for direct input select (use dtmfreset to seselect)
dtmfselectinput0=10
dtmfselectinput1=11
dtmfselectinput2=12
dtmfselectinput3=13
dtmfselectinput4=14
dtmfselectinput5=15
dtmfselectinput6=16
dtmfselectinput7=17

# RPi GPIO Accessory DTMF Control examples
# Outputs:  dtmfoutputs defines number of outputs.  Subsequent 4 lines can be repeated
dtmfoutputs=1
dtmfgpioout1pin=15
dtmfgpioout1label=shack_light
dtmfgpioout1on=31
dtmfgpioout1off=41

# Inputs have nothing to do with dtmf.  dtmfinputs defines how many inputs.
# Subsequent 2 lines can be repeated
dtmfinputs=1
dtmfgpioin1pin=8
dtmfgpioin1label=cabinet_door

# i2c Accessory DTMF Control examples.  MCP23017. Max 16 lines either in or out
i2cioaddress=0

i2cdtmfoutputs=1
i2cdtmfgpioout1pin=a0
i2cdtmfgpioout1label=shack_heater
i2cdtmfgpioout1on=51
i2cdtmfgpioout1off=61

i2cdtmfinputs=1
i2cdtmfgpioin1pin=b0
i2cdtmfgpioin1label=cabinet_lid

# Background image for Caption Slides
backimage=/home/pi/atv-rptr/media/batc_background.jpg

# Ident info (audio is on/off) Pitch in Hz, speed in wpm, level is %
identinterval=900
identmediatype=jpg
identmediaduration=5
identmediafile=/home/pi/tmp/ident.jpg
identcwaudio=on
identcwspeed=12
identcwpitch=800
identcwlevel=85
identcwfile=/home/pi/tmp/ident.wav

# K info.  Pitch in Hz, speed in wpm, level is %
kmediatype=jpg
kmediaduration=5
kmediafile=/home/pi/tmp/k.jpg
kcwaudio=on
kcwspeed=12
kcwpitch=800
kcwlevel=85
kcwfile=/home/pi/tmp/k.wav

# Carousel info.  Max 99 scenes
# options for type are jpg, (mp4 not implemented yet), status or source.  For source, file is source number
# which can be a virtual source such as a grid of 4 images

carouselscenes=3
carousel01mediatype=jpg
carousel01file=/home/pi/tmp/tcfw.jpg
carousel01mediaduration=10
carousel02mediatype=jpg
carousel02file=/home/pi/atv-rptr/media/pm5544w.jpg
carousel02mediaduration=10
carousel03mediatype=jpg
carousel03file=/home/pi/atv-rptr/media/75cbw.jpg
carousel03mediaduration=10

#carousel05mediatype=source
#carousel05file=1
#carousel05mediaduration=5
#carousel06mediatype=source
#carousel06file=4
#carousel06mediaduration=5

# Audio switch can be "hdmi" or "i2c".  i2c needs MCP23008 chip address
audioswitch=hdmi
audioi2caddress=7

# talkback (144.75) audio can be turned on or off using the MCP23008 i2c switcher
talkbackaudio=on
talkbackaudioi2cbit=7

# Input config
# Recommended gpio pins for "input active" are 32, 35, 18, 22, 16, 19 and 21

# announcemediatype determines the player used

# Switcher can use "ir" or "gpio" "html" or "i2c"
# IR uses a TX on GPIO pin 12
# GPIO uses pins 36, 37, 38, 33, 31, 29, 23, 24.  Can be enabled with ir or i2c
# i2c uses FMS6501A on Output channel 1
# activeinputhold (yes/no) means that lower priority inputs do not get replaced by higher priority (except pri 1)
# Show Quad is yes/no and overides activeinputhold

availableinputs=6
activeinputhold=no
showquadformultipleinputs=yes
cascadedswitches=no

outputswitchcontrol=html
showoutputongpio=yes
outputhdmiresetcode=nec:0x17
output2ndhdmicode=nec:0x17
outputhdmiquadcode=nec:0x18
outputi2caddress=3
outputi2cquadchannel=9

# Bitfocus Companion (html) server address & port (no trailing slash)
networkctrlurl=http://192.168.0.176:8888
# Other net commands have leading slash
outputquadnetcommand=/press/bank/1/11

input0name=Controller
output0code=nec:0x17
#output0code=2nec:0x17 (daisy chain)
output0hdmiswitchpin=36
output0i2cchannel=1
#output0netcommand=/press/bank/1/8
output0audioi2cbit=0

input1name=Stream Input
input1prioritylevel=1
input1activegpiopin=32
output1code=nec:0x12
output1hdmiswitchpin=37
output1i2cchannel=2
output1netcommand=/press/bank/1/1
output1audioi2cbit=1
input1announcemediatype=jpg
input1announcemediafile=/home/pi/tmp/input1.jpg
input1announcemediaduration=3

input2name=QO-100 RX
input2prioritylevel=2
input2activegpiopin=35
output2code=nec:0x59
output2hdmiswitchpin=38
output2i2cchannel=3
output2netcommand=/press/bank/1/2
output2audioi2cbit=2
input2announcemediatype=jpg
input2announcemediafile=/home/pi/tmp/input2.jpg
input2announcemediaduration=3

input3name=3.4 GHz Ryde
input3prioritylevel=3
input3activegpiopin=18
output3code=nec:0x08
output3hdmiswitchpin=33
output3i2cchannel=4
output3netcommand=/press/bank/1/3
output3audioi2cbit=3
input3announcemediatype=jpg
input3announcemediafile=/home/pi/tmp/input3.jpg
input3announcemediaduration=3

input4name=Quad View
input4prioritylevel=7
input4activegpiopin=22
output4code=nec:0x18
#output4code=2nec:0x12 (daisy chain, not quad)
output4hdmiswitchpin=31
output4i2cchannel=5
output4netcommand=/press/bank/1/4
output4audioi2cbit=4
input4announcemediatype=jpg
input4announcemediafile=/home/pi/tmp/input4.jpg
input4announcemediaduration=3

input5name=Mast Camera
input5prioritylevel=7
input5activegpiopin=16
output5code=2nec:0x59
output5hdmiswitchpin=29
output5i2cchannel=6
output5netcommand=/press/bank/1/5
output5audioi2cbit=5
input5announcemediatype=jpg
input5announcemediafile=/home/pi/tmp/input5.jpg
input5announcemediaduration=10

input6name=Unused 6
input6prioritylevel=9
input6activegpiopin=19
output6code=2nec:0x08
#output6code=2nec:0x08 (daisy chain)
output6hdmiswitchpin=23
output6i2cchannel=7
output6netcommand=/press/bank/1/6
output6audioi2cbit=6
input6announcemediatype=jpg
input6announcemediafile=/home/pi/tmp/input6.jpg
input6announcemediaduration=3

input7name=Unused 7
input7prioritylevel=9
input7activegpiopin=21
output7code=2nec:0x08
#output7code=2nec:0x12 (daisy chain)
output7hdmiswitchpin=24
output7i2cchannel=8
output7netcommand=/press/bank/1/7
output7audioi2cbit=7
input7announcemediatype=jpg
input7announcemediafile=/home/pi/tmp/input7.jpg
input7announcemediaduration=3




G8GKQ
Site Admin
Posts: 2798
Joined: Sun Mar 22, 2009 1:21 pm

Re: BATC ATV Repeater - Network Control of Video Switches

Post by G8GKQ » Sun Feb 27, 2022 2:37 pm

Hi Justin

Pleased that the basic control is working.

Working through your issues, I can't see anything that is not intended or known behaviour. I think that it will become more clear to you when you use proper switching and have multiple sources connected.
  • I did say that to enable the new functionality you would need to reject the option to keep your old configuration file.
  • Each parameter can only be set in the config file once.
  • There is a bug where the Raspberry Pi will hang (unresponsive) for 90 seconds before rebooting when commanded. This is to do with the GPIO driver and I have been unable to find a reliable cure. I would be interested to hear if the restart hang lasts longer than about 100 seconds. This bug would not affect the Ryde - it uses a different GPIO driver.
  • When an input is detected as active, the first thing that happens is the video switch is set to the controller to show the "announce" caption. If this is not required, you can set the input1announcemediaduration=3 parameter to 0 for each input. Then the repeater will switch directly to active inputs.
  • You can monitor the commands being sent over http by starting the controller from the command line. You should see something like this when selecting an input:

    Code: Select all

    Switch change detected, checking for debounce
    Input Status - 1: 1, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0,
    previous decision result is 0, entering decision process
    Setting inputActiveInitialState 1: 1, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0,
    Priority 1: ----- priority_test = 1,i = 1, inputactive[i] = 1
    After process, decision was 1
    Input status change.  Current Output = 0, New Output = 1
    Entered Switchto for output 1
    Carousel Scene 2 displayed
    HDMI Switch input 0 requested
    
    -curl http://192.0.1.176:8888/press/bank/1/8 &-
    
    HDMI Switch input 1 requested
    
    -curl http://192.0.1.176:8888/press/bank/1/1 &-
    
    inputChangeDuringAnnounce = 0
    
  • There is debounce on the "input active" inputs. I think that it is adequate for receiver-switched inputs; it is not designed for toggle switches!
73

Dave

G8YTZ
Posts: 103
Joined: Sun Feb 10, 2019 7:43 pm

Re: BATC ATV Repeater - Network Control of Video Switches

Post by G8YTZ » Sun Feb 27, 2022 5:55 pm

Dave,

Thanks & understood. I was too quick with my switching! Yes, it works perfectly. I'll disable the "announce" function as the ATEM macro can do this as transparencies with the Downstream Keyer.

I saw the RPI bug again, as you say it does reboot after 90 seconds or so, again I was not patient enough.

Thanks for the tip on monitoring the live traffic.

or Ethernet Switching the Brianboxes SW05 Industrial switch makes a lot of sense. It can run off 5-30V Made in GB too. :-)

One last question, is it possible that the ident audio can appear on the analogue audio output as well as HDMI or is it either/or?

Justin.

Post Reply

Return to “ATV Repeater Technical Topics”