Shop OBEX P1 Docs P2 Docs Learn Events
Sony Camcorder IR Control — Parallax Forums

Sony Camcorder IR Control

Jim FouchJim Fouch Posts: 395
edited 2005-07-03 16:04 in General Discussion
Just in case anyone needs to control their Sony DCR-RV460 with an SX.....

It took me about 15 hours of research, and trial and error to figure this out. It may work on other Sony Camcorders.

I did not code all commands, just the ones I need.

One thing I would like to note... no where in my searching did I ever see that you need to send the IR command 5 times to confirm. When I looked at a scope, I was only seeing the FIRST data packet. It was only when I zoomed way out did I see there are five packets sent.

If you're wondering why I want to do this... I'm making a remote mounted camera mount that I need to be able to control the functions of the camera. My next step is to make a Stepper controlled mount that will Pan 360 degrees and tilt +/- 45 Degrees and hold a 2 lb load....·· Anyone know of a source???

Feel free to use this code in any way you wish.

Jim Fouch

Comments

  • mojorizingmojorizing Posts: 249
    edited 2005-07-03 16:04
    Hi Jim,
    Nice project you got here. I did a similar thing to control a Sony Handycam. The Sony protocol is called LANC and I learned about all the particulars from www.boehmel.de/lanc.htm

    My project consisted of a Sony camcorder in a pelican box inside a waterproof backback. A external mini cam from www.helmetcamera.com/ is afixed to a Gath surf helmet along with a single waterproof button on the chest strap. Both video and button control wires are lead thru watertight connections to the Camcorder. This system enables a surfer to film in-water video by controlling the "record" and "stop" functions of the camcorder from the one push button on the chest strap. The micro I used was a PIC , but that assembly is easily transformed into SX ASM.

    
    ;**********************************************************************
    ;                                                                     *
    ;    Filename:        lanc5.asm                                          *
    ;    Date: 3/28/02                                                    *
    ;    File Version: 1                                                  *
    ;                                                                     *
    ;    Author: mojorizing                                               *
    ;    Company:                                                         *
    ;                                                                     * 
    ;                                                                     *
    ;**********************************************************************
    ;                                                                     *
    ;    Files required:                                                  *
    ;                                                                     *
    ;                                                                     *
    ;                                                                     *
    ;**********************************************************************
    ;                                                                     *
    ;    Notes:                                                           *
    ;                                                                     *
    ;                                                                     *
    ;                                                                     *
    ;                                                                     *
    ;**********************************************************************
    
    
        list      p=16f84            ; list directive to define processor
        #include <p16f84.inc>        ; processor specific variable definitions
    
        
    ;**********************************************************************
    
    ;RA     0 LANC output/input to/from camera
    ;       1 unused- output
    ;    2 unused- output
    ;    3 unused-   "
    
    ;RB    0 button input  normally high, one push=start, 2+ pushes= stop
    ;    1-7 unused- output
    
    
    ;**********************************************************************
    ;                Equates
    
                 ; bit 0 of port A....is the output to the camera
                ; RB0/INT is the button, goes to ground when pressed
        CBLOCK    H'0C'            
            command
            command1    
            count
            count1
            counter
            N
            M
            temp
         ENDC
    ;**********************************************************************
    
    
        org    0x000       ; processor reset vector
          goto    begin             ; go to beginning of program
    
    ;***********************************************************************
        org    0x004        ; interrupt vector location
        
    
    ;-----------------------------------------------------------------------
    begin
    
    ;-------------------------------------------------------------------------------------
        movlw    b'10000000'    ;falling edge for interrupt
        option
        
        movlw    b'00000001'    ;port RA0 is output/input to camera, start as input
        tris    PORTA
        movlw    b'00000001'    ;port B is input ; RB0/INT which is button
        tris    PORTB
        
    
        bcf    INTCON,1    ;clear INT flag
        bcf    INTCON,7    ;disable global    ;set to do next instruction after waking up
        bsf    INTCON,4    ;enable INT interupts
        
    snooze
        sleep
        nop    
        nop
    
    change
        
        
    ;-----------------------------------------------------------------------
    ;         How many times has the button been pressed?
        
        movlw    D'40'        ;for forty samples at 50msec each for 2 second sample period
        movwf    count1
    
    loop    
        btfss    PORTB,0        ;is button pressed?    
        goto     $-1        ;yes, wait for release
        movlw    D'20'        ;debounce release
        call    nmsec        ;
        btfss    PORTB,0        ;is button pressed still?
        goto     $-5        ;yes?,go back and wait for release
    
    sample    movlw    D'100'        ;50msec delay
        call    nmsec
        btfss    PORTB,0
        goto    stop        ;need to debounce,then stop code
        decfsz    count1,1        
        goto    sample        ;delay and then sa    
        goto     start
    
    stop    
        btfss    PORTB,0
        goto     $-1        ;
        movlw    b'11001111'    ;stop command....inverted hex'30'
        movwf    command1
        movlw    D'5'        ;commands to be sent for 5 times
        movwf    count1
        goto     main
    
    start    movlw    b'11000101'    ;record command....inverted hex'3A'    
        movwf    command1
        
    ;********************************************************************
    
    
        movlw    D'5'        ;commands to be sent for 5 times
        movwf    count1
    main
        
        call    sync_up
        movlw    b'11100111'    ;
        movwf   command
        call    wait_strt
        call    send
        movf    command1,0
        movwf    command
        call    wait_strt
        call    send
        decfsz    count1,1
        goto     main
        goto     reset
    
    ;***********************************************************************
    ;
    ;  First we want to synchronize our reception.  We do this by waiting
    ;    until the lanc line has been held high for at least 1 word time.
    ;    (1352 us. or more)
    
    sync_up   clrf      counter        ; clear sync counter to 0
    
    sync_loop btfss     PORTA,0     ; Wait for interframe gap
              goto      sync_up        ; This loop takes 6 us, so if the
              nop                      ;   counter overflows before
              incfsz    counter,1       ;   a transition on the LANC
              goto      sync_loop      ;   line, it is the interframe gap..
                                       ;     (1530 us)
          return
    ;***************************************************************************
                   ; Once synchronized we wait for a start bit to show up.
    
    wait_strt btfsc     PORTA,0         ; wait for start bit
              goto      wait_strt      ;
    
    start_bit movlw     d'33'            ; Constant for start bit time (52us)
              movwf     counter        ; set counter
    l1        decfsz    counter,1        ; loop on counter (3us/loop)
              goto      l1             ;
                
    
    
          return
    ;***************************************************************************              
    send
        movlw    d'8'
        movwf    count
        movlw    b'00000000'    ;port RA0 is output/input to camera, now to output
        tris    PORTA
        nop
        nop
    
    loop2    
        btfsc    command,0
        bsf    PORTA,0
        btfss    command,0
        bcf    PORTA,0
        movlw    d'31'    
        movwf    temp
    delay
        decfsz    temp,1
        goto     delay
        rrf    command,1
        decfsz    count,1
        goto    loop2
        movlw    b'00000001'    ;port RA0 is output/input to camera,  as input
        tris    PORTA
        nop
        nop
        return
    
    ;****************************************************************************
    
    nmsec            ;time is actually 1/2 of the number in W in milliseconds
            movwf     N       ; save 'W' in a register of our own
    loadm    movlw     d'167'
        movwf     M
    dlyloop 
            decfsz     M,f   
            goto     dlyloop
        decfsz     N,f
        goto    loadm        
            return               
    ;******************************************************************************
    
    
    
    reset                    ;need to put for delay for multiple button presses
                        ;so that succesive presses don't restart it when stop is requested
           bcf        INTCON,1    ;clear INT flag
           bsf        INTCON,4    ;disable global    ;set to do next instruction after waking up
           bsf        INTCON,7    ;enable INT interupts
            
           
    ;********************************************************************************    
    
    
        goto     snooze
    
    
        end                     ; directive 'end of program'
    
    
    
    
    
    
    



    as far as pan/tilt mounts, Pelco makes various mounts and they can be readily attained from Ebay. It seems there are a lot of business that are upgrading their security systems. These are generally not servo controlled because position feedback is the actual video image...you point it were you want to look.

    later, Kevin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 kinds of people in the world.... those that know binary, and those that don't.
Sign In or Register to comment.