PIC to control NEXA remoteswitch


Closed Thread
Results 1 to 22 of 22

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Try something like this.
    Code:
    DEFINE OSC 4
    
    ' Timing as described in NexaProtocol.txt
    T CON 350      ' T = 350uS
    T3 CON 1050    ' 3T
    T32 CON 11200  ' 32T (Stop/Synch)
    
    ' Note we're using 1 VS X as shown in text
    A1_ON  CON %101100000000 ' 12-bit code for House/Unit A1 ON
    A1_OFF CON %001100000000 ' 12-bit code for House/Unit A1 OFF
    '           ||||||||||||____ 4-bit House code
    '           ||||||||________ 4-bit Unit code
    '           ||||____________ 3-bit Unknown code
    '           |_______________ 1-bit Activation code 1=ON 0=OFF 
    
    D_PACKET VAR WORD ' Holds 12-bit data packet to send
    INDEX VAR BYTE    ' Data packet bit index pointer
    LOOPS VAR BYTE    ' Loop counter
    
    TX VAR PORTB.0    ' Connects to RF transmitter data in
    
    LOW TX            ' TX output idles low for RF carrier OFF
    
    Main:
        D_PACKET = A1_ON
        GOSUB Send
        PAUSE 5000
        D_PACKET = A1_OFF
        GOSUB Send
        PAUSE 5000
        GOTO Main
        
    Send:
        FOR LOOPS = 1 TO 4    ' send each packet 4 times
          FOR INDEX = 0 TO 11 ' sends 12 bits per pass LSB 1st
            
            HIGH TX           ' The 1st half of a 0 or X  bit period is the
            PAUSEUS T         ' same so no need to repeat this sequence inside
            LOW TX            ' the IF block
            PAUSEUS T3 
            
            IF D_PACKET.0[INDEX]=1 THEN
               HIGH TX        ' send a 1 bit (1=X here)
               PAUSEUS T3
               LOW TX
               PAUSEUS T
            ELSE
               HIGH TX        ' send a 0 bit
               PAUSEUS T
               LOW TX
               PAUSEUS T3
            ENDIF
          NEXT INDEX          ' loop until all 12-bits sent
          
          ' Start of Stop/Synch period after each 12-bit packet
          HIGH TX
          PAUSEUS T
          LOW TX
          PAUSEUS T32
          ' End of Stop/Synch period
          
        NEXT LOOPS        ' send 4 packets per pass
        RETURN
          
        END
    Can't say if this works or not since I don't have the receiver to play with, but it looks close
    to what's shown in the NexaProtocol.txt timing diagram.
    Regards,

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

  2. #2
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    Hi Bruce

    Thanx for the code, but it doesīt work so good but we are close now.

    If i have the NEXA switch ON and let the PIC program running for 1 - 5 minutes the PIC turns the NEXA off, but never on again.

    Here is more information for the NEXA and source code in some other language..
    http://svn.telldus.com/svn/rf_ctrl/t...runk/examples/
    http://svn.telldus.com/svn/rf_ctrl/

    I have read on a swedish forum that the original NEXA remote control sendīs 25 bits but there is only every second bit that contains the data, it sends a "zero" between every bit

    http://elektronikforumet.com/forum/v...ht=nexa+proto*

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


    Did you find this post helpful? Yes | No

    Default

    Hi Fredrick,

    I think I goofed on the 3-bit unknown bits. Try changing to this;

    A1_ON CON %111000000000 ' 12-bit code for House/Unit A1 ON
    A1_OFF CON %011000000000 ' 12-bit code for House/Unit A1 OFF
    Regards,

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

  4. #4
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    If you capture the codes as Anand suggested, I think you will find they are substantially different from what is described in NexaProtocol.txt. The Elro AB600 and Intertechno are among those that use the Arc Technology hardware. Those protocols agree with NexaProtocol.txt as far as A=0000, 1=0000, etc. but the wave shapes differ significantly from the shapes in NexaProtocol.txt. As I recall, the codes I have for Elro AB600 and Intertechno tested OK using a European Pronto (433.92MHz) to send the RF codes.

  5. #5
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Thumbs up

    Hi Bruce
    Iīm inprest of your programing skills, the code now works fine, better than the original NEXA remote control.

    I have tryed diffrent housecodes and unit numbers and all works whit no problems.

    The PIC can now control the NEXA switch from mutch longer rance then the original remote control.


    Many thanx to you Bruce.

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


    Did you find this post helpful? Yes | No

    Default

    Hi Fredrick,

    Excellent. I'm glad you got it working, and happy to help.

    We lucked-out having someone else do the dirty work for us...;o}

    Dave & Anand both make good points above. If you have access to an O-Scope or can
    build the sound card version, it makes the whole process a lot easier. And then you'll be
    relatively sure your timing is correct.

    I suspect this is what someone did when they wrote NexaProtocol.txt. You can probably
    tweak the timing down to near perfect if you scope the data output pin on the NEXA
    encoder IC in your transmitter.

    At least now you have something to work with, and you can see how the timing from
    NexaProtocol.txt was converted to a few simple PBP routines.

    Cloning most encoders is relatively simple. The decoding part is a LOT more work.

    Maybe you could post what you have now in the code examples section to share with
    others?
    Regards,

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

  7. #7
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Angry

    I tryed to do the sound card version today byt no one of my 2 computers have a "Line in" or "Audio in" input, only a input with a microphone symbol on and that doesīt work.

    I have now posted the code in the code exampel area now.

  8. #8
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    Is it posible to capture the RF signal with the PICkit2 tool "PICkit 2 Programmer Logic Tool Analyzer"?

    If so i will buy the PICkit2 programmer (i need a new programmer with USB support.)

    http://www.microchip.com/stellent/id...cName=en023805

  9. #9
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Fredrick View Post
    I tryed to do the sound card version today byt no one of my 2 computers have a "Line in" or "Audio in" input, only a input with a microphone symbol on and that doesīt work.
    You still might be able to use the mic input, if you attenuate the signal 1:1000 (a 100K and a 100ohm resistor divider, perhaps?). The waveform might not look picture perfect, but will surely be good enough for your purpose.

    Alternately, if you have a serial port, you might want to look at Dante's infrax utility at http://www.geocities.com/tdanro/irman/irman.html

    This would require you to build a small capture circuit, and be informed this does not work reliably with USB-to-serial interfaces. On a native serial port (or a PCI based additional one) it works quite brilliantly.

    Regards,

    Anand

Similar Threads

  1. Control NEXA 230V RF Switch
    By Fredrick in forum Code Examples
    Replies: 3
    Last Post: - 6th December 2009, 23:19
  2. Replies: 5
    Last Post: - 12th September 2007, 15:59
  3. Motor Control PLC with a PIC
    By sougata in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 2nd November 2006, 07:59
  4. Pic Control With Software
    By Agent36 in forum General
    Replies: 5
    Last Post: - 18th October 2006, 18:18
  5. Need help on pic to pic flow control (simple problem I think)
    By khufumen in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th January 2006, 00:34

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