Shop OBEX P1 Docs P2 Docs Learn Events
Decoding ASK/OOK pulstrain — Parallax Forums

Decoding ASK/OOK pulstrain

KidEKidE Posts: 29
edited 2012-02-29 07:37 in Accessories
Hi All,

I'm setting my 1st steps in wireless and asfter a few days of banning my head i'm hitting rock bottom here.

I have a 868Mhz ASK receiver from ELV which receives multiple pulstrains in different modulations on the 868,3MHz band. http://www.elv-downloads.de/service/manuals/RX868_3V/RX868_3V_UM_G_080527.pdf
As i've understood so far the module data out is a 8E1 which the BS2 cannot decode directly due to an unsupported SERIN mode.

Here my 1st problem: As i understood from the protocol description i have is that high pulses (1) are 600µs High, 600µs Low and low pulses (0) 400µs High, 400µs Low
Since there are multiple pulstrains which vary in modulation (high low duration is modulation right?) how can SERIN detect that a high is 600-600 and a low is 400-400 among the the other pulses? Or is using SERIN a totally wrong approach here?
At jeelabs i found masses of info and as i understood he uses a Serial.Begin statement and after that he measures the puls width.

A small push in the right direction would be appreciated before my forehad gets totally blue.

Ernst

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-02-26 12:40
    That's a very unusual protocol, since the total duration of a byte will depend on the relative number of ones and zeroes. In any event, it's not one that SERIN will be able to deal with. You might have time to decode it one bit at a time using PULSIN, but that will probably be a stretch for a BS2.

    -Phil
  • KidEKidE Posts: 29
    edited 2012-02-26 12:53
    i was doing some tests with PULSIN also to measure the pulswidth but i stranded here. The protocol init string exists of 12 zeros and one 1 so 0000000000001
    How would you decode such a string?

    My idea was something like this:
    time VAR Word
    do
    PULSIN rxpin, 1 [time]
    loop until time >200
    
    But if i do this i already miss the 1st 0

    How would you capture such a pulstrain and analyze it after buffering?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-02-26 13:29
    Missing the first zero is not a tragedy. In OOK/ASK, the initial string of zeroes is used to help the receiver adjust its bit slicer (i.e. analog comparator); so it may take several bit times for this to happen before it starts outputting sensible data.

    Once data reception begins, an example of buffering the bits might go something like this (untested):
    ReadByte:
    
      char = 0
      parity = 0
    
      'Wait for the start bit.
    
      DO
        PULSIN rxpin, 1 [time]
      LOOP UNTIL time < 250
    
      'Read eight data bits, plus parity bit.
    
      FOR i = 1 TO 9
        char = char >> 1
        PULSIN rxpin, 1 [time]
        IF (time > 250)
          char = char + $200
          parity = parity ^ 1
        ENDIF
      NEXT
    
      RETURN 'Data in bits 0..7; parity in bit 8 of char (which has to be a WORD).
    

    I could be wrong, but I seriously doubt that the BASIC Stamp will be fast enough to pull this off.

    -Phil
  • KidEKidE Posts: 29
    edited 2012-02-29 00:40
    Hi Phil,

    I modded and tested the code and iḿ not confident that the BS2 will be able to do what i want.

    What would be a good option for transition here. Should i replace my BS2 for a BS2px-IC which can execute 19000 instead of 4000 instructions per second or think further and switch to the propeller?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-02-29 07:37
    I don't know if the BS2px could handle it either. My gut says no. The Propeller would be the more natural choice for such a task, IMO.

    -Phil
Sign In or Register to comment.