Wiki VMAC PiHat v2 Video Detect

HAMKit Wiki Repository
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
 HAMKit Wiki
News and Information
RasDuinoHat
Raspberry Pi
Standard Page
VDAS
VMAC PiHat v1
VMAC PiHat v2

The HAMKit VMAC PiHat includes three on-board, MAX7461, Video Detector (Loss-of-Sync Alarm) ICs. These are configured to directly monitor AV1, AV2 and AV3 inputs

The MAX7461 single-channel loss-of-sync alarm (LOS) provides composite video sync detection in NTSC, PAL, and SECAM standard-definition television (SDTV) systems. The MAX7461’s advanced detection circuitry delivers robust performance by preventing false loss-of-sync alarms due to noise.

This is the same MAX7461 IC as used on our popular HAMKit VDAS (Video Detect and Audio Squelch), kits.

 

 

 

Output LOS from each MAX7461, is taken into a 5v-3v3 level convertor and placed onto the Pi Header GPIO as detailed below:

  • AV1 = GPIO 18
  • AV2 = GPIO 23
  • AV3 = GPIO 24

Logic Signal Levels

  • High = Valid Video Signal (SYNC)
  • Low = Loss of Video or Invalid Signal (No SYNC)

The sample test code example monitors the three inputs, via the assigned Pi GPIO, and flashes the LED and displays a message in the debug screen, upon a valid Video Signal with Sync.

All of our sample and test code is developed in Python.

# HAMKit VMAC PiHat v2.4 - Test Video Detect - Dave Williams
# Initialise Video Detect MAX7461 outputs to Pi GPIO
# Initialise LED to flash
# Monitor Input 1, 2 and 3 for valid video signal
# Flash LED and print info in valid input
# Dave Williams G8PUO, July 2018

#!/usr/bin/python

import RPi.GPIO as GPIO
import time

#====== GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.cleanup()

#Define GPIO Inputs
GPIO_VideoDetect_1 = 18
GPIO_VideoDetect_2 = 23
GPIO_VideoDetect_3 = 24

#Setup Inputs with pull-ups enabled
GPIO.setup(GPIO_VideoDetect_1, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(GPIO_VideoDetect_2, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(GPIO_VideoDetect_3, GPIO.IN, pull_up_down=GPIO.PUD_UP)

#Define GPIO Outputs
LEDStatus = 22
PTT = 27

#Setup Outputs
GPIO.setup(LEDStatus,GPIO.OUT)
GPIO.setup(PTT,GPIO.OUT)

#Initiate LEDs
GPIO.output(LEDStatus,GPIO.HIGH)
GPIO.output(PTT,GPIO.HIGH)
time.sleep(1)
GPIO.output(LEDStatus,GPIO.LOW)
GPIO.output(PTT,GPIO.LOW)
time.sleep(1)

#Define Variables
VideoDetect_1 = False
VideoDetect_2 = False
VideoDetect_3 = False

#Good old fashion subroutines
def flashleds (flashes):
    for x in range(flashes):
        GPIO.output(LEDStatus,GPIO.HIGH)    
        GPIO.output(PTT,GPIO.HIGH)
        time.sleep(0.2)
        GPIO.output(LEDStatus,GPIO.LOW)       
        GPIO.output(PTT,GPIO.LOW)
        time.sleep(0.2)

print ("Monitoring Video Signal Inputs 1, 2 and 3")

#Loop
while True:
    
    #Read VideoDetect_1 GPIO State
    VideoDetect_1 = GPIO.input(GPIO_VideoDetect_1)
    if VideoDetect_1 == True:
        flashleds (1)
        print ("VideoDetect_1")
    
    #Read VideoDetect_2 GPIO State
    VideoDetect_2 = GPIO.input(GPIO_VideoDetect_2)
    if VideoDetect_2 == True:
        flashleds (2)
        print ("VideoDetect_2")
    
    #Read VideoDetect_3 GPIO State
    VideoDetect_3 = GPIO.input(GPIO_VideoDetect_3)
    if VideoDetect_3 == True:
        flashleds (3)
        print ("VideoDetect_3")
    
    #Heatbeat PTT LED as test
    GPIO.output(PTT,GPIO.HIGH)
    time.sleep(.2)
    GPIO.output(PTT,GPIO.LOW)
    time.sleep(1)

Further details on the configuration and test code can be found in other Wiki pages.  Also see programming and developing in Python.


Please feel free to share our product love through the below

HAMKit | Facebook Comments