Pentax IR Remote


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Actually - it should work either way, but your last version will be leaving the IR LED ON if the cathode is connected to GPIO.2.
    You are right, I left it again the way you coded it and it works the same

    Thanks for the example BTW, without it I would be lost.
    I finished the full timelapse+remote code but Im keeping it to myself at this moment, the code I posted and a little thinking will serve as the foundation to do any remote trigger operation with Pentax cameras.

    Happy 2011

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Glad I could help, but I would like to see you share what you have. Unless, of course, it's something you plan to sell as a product.

    What goes around - comes around, and the folks you help along your way never seem to forget you..
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    Bruce, you are right again.

    After thinking about... lets say 2 minutes here is the code, I hope you and everyone else help me to make it better, there are a couple of things that can be improved for sure.

    Good thing about it is that you change the pulse train and bingo timelapse remote for another brand, or even better, add a dipswitch and make the remote multibrand.

    Code:
    '****************************************************************
    '*  Name    : pentax.BAS                                        *
    '*  Author  : PEU based on examples from www.rentron.com        *
    '*  Notice  : Copyleft (c) 2011                                 *
    '*          : No Rights Reserved on derived work                *
    '*  Date    : 05-ENE-11                                         *
    '*  Version : 1.02                                               *
    '*  Notes   : pablou at gmail dot com                           *
    '****************************************************************
    @ #define IRTX GPIO  ; Define port to use for IR out
    @ #define PIN 2      ; Define port pin to use for IR out
    @ device pic12f683,INTRC_OSC_NOCLKOUT , wdt_on, mclr_off, protect_on
    
    
    DEFINE OSC 4
      GPIO = 0      
      TRISIO.2 = 0      ' LED IR
      TRISIO.1 = 0      ' LED testigo
      TRISIO.5 = 1      ' Input para interruptor normal abierto (con pulldown)
      CMCON0   = 7      ' Comparadores deshabilitados
      ANSEL = 0         ' A/D deshabilitado
      GIE       VAR INTCON.7  ' Global interrupt enable 1=ON, 0=OFF
      GPIE      VAR INTCON.3  ' Port change interrupt enable 1=ON, 0=OFF
      GPIF      VAR INTCON.0  ' Port Change Interrupt Flag bit   
    
      Cycles    VAR BYTE    ' Number of carrier cycles
      ContaSec  var word    ' Contador de segundos
      TLFlag    var byte    ' Se programo el contador?
      IRLED     var GPIO.2  ' alias LED IR
      LED       var GPIO.1  ' alias LED testigo
      BOTON     var GPIO.5
      
      GIE = 0            ' Disable global ints
      GPIE = 1           ' Enable port change int
      IOC.5 = 0          ' Int-on-change for GPIO.5 disbled
      PAUSE 100         ' Pausita pa estabilizar todo al arranque
      GOTO OverFreq     ' jump over pulse routines
      
    
    ' Generate "Cycles" number of ~38.4kHz pulses   Bruce at www.rentron.com
    ASM
    _Pulse38
       bcf IRTX,PIN     ; 1uS, LED=on
       goto $+1         ; + 2uS = 3uS
       goto $+1         ; + 2uS = 5uS
       goto $+1         ; + 2uS = 7uS
       goto $+1         ; + 2uS = 9uS
       goto $+1         ; + 2uS = 11uS
       goto $+1         ; + 2uS = 13uS   
       bsf IRTX,PIN     ; 1uS, LED=on
       goto $+1         ; + 2uS = 3uS
       goto $+1         ; + 2uS = 5uS
       goto $+1         ; + 2uS = 7uS
       goto $+1         ; + 2uS = 9uS
       nop              ; + 1uS = 10uS
       decfsz _Cycles,f ; + 1uS = 11S    
       goto _Pulse38    ; + 2uS = 13uS
       return           ; Return to caller    
    ENDASM
    
    OverFreq:
    
    contasec=0
    tlflag=0
    
    'Si el micro arranca con el boton apretado contar segundos
    while boton=1
    contasec = contasec + 1
    high led
    pause 50
    low led
    pause 950
    tlflag=1
    wend
    
    contasec = contasec - 1 ' descontar un segundo, algun dia mejorare la rutina
    
    'Loop del TimeLapse      
    if tlflag = 1 then
    
        while boton = 0  
            sleep contasec  ' dormir por el tiempo programado
            gosub trigger   ' disparar
            high led        ' prende LED testigo
            pause 50        ' sisi agrega 50ms, no me calienta en lo mas minimo :)
            low led         ' apaga LED testigo
        wend
        
    ' Se acabo el timelapse porque se apreto el boton
        for contasec = 1 to 15  ' avisarle al usuario parpadeando el LED testigo
            high led
            pause 100
            low led 
            pause 100
        next
    
    endif
      IOC.5 = 1          ' Int-on-change for GPIO.5 enabled
      GPIO = 0 
      Main:                 ' Loop principal
        @sleep              ' Dormir
        
        while boton=0       ' Mientras no se aprete el boton no dejar pasar
        wend
        GPIF = 0           ' Clear port change interrupt flag
        gosub trigger       ' Disparar
        high led            ' prende LED testigo
        pause 50
        low led             ' apaga LED testigo
       
      GOTO Main
      
    Trigger:                ' Generar el pulso de disparo PENTAX
      Cycles = 255      
      CALL Pulse38
      Cycles = 239      
      CALL Pulse38
      pauseus 3000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 5000              ' Fin del tren de pulsos PENTAX
    return
      
      
      END                       ' Fin
    Sorry for spanish comments, google translate is your friend




    Pablo
    Last edited by peu; - 5th January 2011 at 22:43. Reason: error in interrupt code

  4. #4
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

  5. #5
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    add resistors for LED, not included in schematic (and neither in my protoboard ) and a transistor for more IR range, measured 387 microampere in the main loop while in sleep and 8mA while triggering, can it be made to consume even less in case the switch is left on?

  6. #6
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    Current version instructions:

    to enable timelapse function press pushbutton while powering ON the remote, the red led will flash each second passed, once you release the pushbutton this will be the interval time.

    to exit the timelapse mode, just press the pushbutton longer than the intervall, once out of the mode the red led will flash briefly.

    After exiting timelapse mode, if you press the pushbutton momentarily it will trigger once, if you keep it pressed it will trigger continuously.

    if you start the remote without the pushbutton pressed it will work like previous paragraph.


    While I was driving home I had an idea, why not add 2 more pushbuttons to easily have longer periods, one can be x10 seconds and the other minutes. And then, when outside the timelapse function these buttons can be programmed to trigger a certain amount of photos in a row, say for example 3 photos and 6 photos or any combination that can be programmed.

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Nifty project. Could even use a serial LCD and have a boat-load of options with a menu.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts