NEWS

Dekodieren T/H-Temp. Humidity Sensor von PEARL 5,90€ NC7427(NC7415) 433MHz MÖGLICH!!!



  • SOOOO

    Bitte spendet ""Kleinigkeit" an den Betrieber Bluefox, wenn es euch was gebracht hat (auch wenn nicht 🙂 da er mindestens 2 Tage mit mir FÜR EUCH dekodiert hat!!!

    Habe diese Sensoren bestellt:

    http://www.pearl.de/a-NC7427-3041.shtml

    5,90 !!! die nächsten, die dekodiert sind, sind min 2-3€ und 10€ teurer!!! und haben KEINE Solarunterstütung!

    Hier die Lösung (Vorgehen würde 2 Tage tippen kosten :-)):

    1. immer 42 bits Nachricht ausgelesen..

    Kanal 2

    001100001110010011011001101011001000000001  73,6F 43%   , C
    001100001110010010011001101011001000000111  73,4F 43%   , C
    001100001110010001011001101011001000001101  73,3F 43%   , C
    001100001110010001011001101011001000001101  73,3F 45% 22,9C
    001100001100011111010101101011001000000110  73,1F 43%   , C
    001100001110011110010101101011001000001111  73,0F 43% 22,8C
    001100001101011001001101100100001100000110  69,3F 52%     C
    001100001101011010001101100100001100001100  69,4F 52%     C
    001100001101011011001101100011001100000010  69,5F 51%     C
    001100001101011101001101100011001100000101  69,7F 51%     C
    
    

    KANAL 1:

    001100001110001000010001100100001100010100 70,9 53 21,6C
    001100001110001001010001100011001100011010 70,9 51 21,6C
    001100001110001001010001100010001100011111 70,9 50 21,6C
    001100001110001001010001100011001100011010 70,9 51 21,6C
    
    

    KANAL 3:

    001100001110101001010001100100001100010101 70,9 52 21,6C
    001100001110100111010001100100001100010111 70,7 52 21,5C
    001100001110101000010001100011001100011011 70,8 51 21,5 21,6
    
    

    KANAL 3 (NACH Batterie RAUS):

    001010100010101101010001100011001100001010 71,2 50 21,8
    001010100010101100010001100011001100001100 71,2 51 21,8
    
    

    KANAL 3 (NACH 2x Batterie RAUS):

    001100100110100010010101100010001100001111 71,8 50 22,1
    001100100110100001010101100100001100001000 71,7 52 22,0
    001100100110100001010101100011001100000000 71,7 51 22,0
    001100100110100001010101100010001100000101 71,7 50 22,0
    001100100110100001010101100010001100000101 71,7 50 22,0
    001100100110100001010101100010001100000101 71,7 50 22,0
    001100100110100001010101100001001100001010 71,7 49 22,0
    
    

    RAW Daten sehen so aus:

    für 71,7F 49%

    Start Bit L: 7990   H: 460
    Data Bits: 42
    L: 2024 2028 4080 4072 2040 2108 4072 2048 2044 4140 4076 2044 4076 2112 2044 2044 2044 4144 2048 4072 2048 4140 2044 4076 4076 2112 2044 2044 2044 4140 2044 2048 4076 4140 2044 2044 2048 2116 4076 2048 4080 2156 
    H: 456 452 452 448 460 456 460 444 460 456 456 456 452 452 456 452 456 452 452 452 456 452 456 456 452 456 452 452 456 452 456 452 452 456 456 456 452 452 448 452 452 448 
    
    001100100110100001010101100001001100001010
    
    

    UND SIEHT HIER SCHON JEMAND WO DATEN VERSTECKT SIND?

    :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol:

    ok ok…

    HIER DIE LÖSUNG!

    z.B.: 782°F 75%

    00 10101000 0 1 10 0010 1001 0110 1011 0100 00010000
    aa I______I B B KK TTTT TTTT TTTT HHHH HHHH chksum
    
    

    aa= Präạmbel

    I_I = Sensor ID, ändert sich jedes Mal, wenn man die Batterie wechselt (Stromlos macht)

    B = Trend für Temperatur/ Humidity (00=bei dem ersten Wert nach dem Batt. wechsel)

    KK= Kanal 1=00, 2=01, 3=10

    TTTT=Binär in Dez., Dez als HEX, HEX in Dez umwandeln (z.B. 0010=2Dez, 2Dez=2 Hex) 0010=2 1001=9 0110=6 => 692HEX = 1682Dez = >1+6=7 UND 82 = 782°F

    HH=(wie oben)Binär in Dez., Dez als HEX, HEX in Dez umwandeln (z.B. 1011=11Dez, Dez=B Hex / 0100=4Dez=4HEX => (von hinten lesen)4BHEX (von hinten lesen)=75 Dez.)

    chksum= Prüfsumme

    das war's !!!

    und wer schreibt jetzt Arduino/Java script? 😉



  • Will das Geschwindt jemand auf die Erkenntnisse oben umschreiben?

    Start Bit L: 7990   H: 460
    Data Bits: 42
    L: 2024 2028 4080 4072 2040 2108 4072 2048 2044 4140 4076 2044 4076 2112 2044 2044 2044 4144 2048 4072 2048 4140 2044 4076 4076 2112 2044 2044 2044 4140 2044 2048 4076 4140 2044 2044 2048 2116 4076 2048 4080 2156 
    H: 456 452 452 448 460 456 460 444 460 456 456 456 452 452 456 452 456 452 452 452 456 452 456 456 452 456 452 452 456 452 456 452 452 456 456 456 452 452 448 452 452 448 
    
    001100100110100001010101100001001100001010
    
    
    // Arduino sketch to receive KW9010 temperature/humidity RF sensor telegrams
    // Written by 'jurs' for German Arduino Forum
    
    #define RX433DATA 2       // receive pin for hardware interrupts
    #define RX433INTERRUPT 0  // interrupt number for receive pin
    
    #define KW9010_SYNC 8000  // length in µs of starting pulse
    #define KW9010_ONE 4000   // length in µs of ONE pulse
    #define KW9010_ZERO 2000  // length in µs of ZERO pulse
    #define KW9010_GLITCH 500 // pulse length variation for ONE and ZERO pulses
    #define KW9010_MESSAGELEN 36  // number of bits in one message
    
    void setup()
    {
      Serial.begin(9600);
      pinMode(RX433DATA, INPUT);
      attachInterrupt(RX433INTERRUPT, rx433Handler, CHANGE);
      Serial.println();
      Serial.print(F("Free RAM: "));Serial.println(freeRam());
      Serial.println();
      Serial.println(F("Seconds\tCRC\tID\tChannel\tTemp C\tTrend\trH %\tLowBat\tForced send"));
    
    }
    
    void loop()
    {
      if (fifoAvailable())
      {
        unsigned long dataReceived=fifoRead();
        Serial.print(millis()/1000);
        if (dataReceived!=0)
        {
          Serial.print(F("\tOK"));
          printResults(dataReceived);
        }  
        else  
          Serial.print(F("\tFAIL"));
        Serial.println();  
      }  
    }
    
    void printResults(unsigned long value)
    {
      // Sensor ID 
      byte id = value & 0b11001111; // bit 0, 1, 2, 3, 6, 7, random change bits when battery is changed
      Serial.print('\t');Serial.print(id);
      // Channel (as set on sensor)
      byte channel = 2*bitRead(value,4)+bitRead(value,5); // bit 4, 5 are channel number
      Serial.print('\t');Serial.print(channel);
      // Temperature 
      int temperature = value>>12 & 0b111111111111;  // bit 12..23
      // if sign bit is set, adjust two's complement to fit a 16-bit number
      if (bitRead(temperature,11)) temperature= temperature | 0b1111000000000000;
      Serial.print('\t');Serial.print(temperature/10.0,1);
      // temperature tendency
      byte trend = value>>9 &0b11; // bit 9, 10
      Serial.print('\t');
      if (trend==0) Serial.print('=');       // temp tendency steady
      else if (trend==1) Serial.print('-');  // temp tendency falling
      else if (trend==2) Serial.print('+');  // temp tendency rising
      // Humidity
      byte humidity = (value>>24 & 0b11111111) - 156; // bit 24..31
      Serial.print('\t');Serial.print(humidity);
      // Battery State
      bool lowBat = value>>8 & 0b1;      // bit 8 is set if battery voltage is low
      Serial.print('\t');Serial.print(lowBat);
      // Trigger
      bool forcedSend = value>>11 &0b1;  // bit 11 is set if manual send button was pressed
      Serial.print('\t');Serial.print(forcedSend);
    }
    
    boolean crcValid(unsigned long value, byte checksum)
    // check if received crc is correct for received value
    {
      byte calculatedChecksum = 0;
      for (int i = 0 ; i < 8 ; i++) calculatedChecksum +=(byte)(value >> (i*4));
      calculatedChecksum &= 0xF;
      return calculatedChecksum == checksum;
    }
    
    void rx433Handler()
    {
      static long rx433LineUp, rx433LineDown;
      static unsigned long rxBits=0;
      static byte crcBits=0;
      static byte bitsCounted=0;
      long LowVal, HighVal;
      byte rx433State = digitalRead(RX433DATA); // current pin state
      if (rx433State) // pin is now HIGH
      {
        rx433LineUp=micros(); // line went HIGH after being LOW at this time
        LowVal=rx433LineUp - rx433LineDown; // calculate the LOW pulse time
        if (LowVal>KW9010_SYNC-2*KW9010_GLITCH && LowVal<kw9010_sync+2*kw9010_glitch) {/rxbits="0;" crcbits="0;" bitscounted="0;" }/else/if/(lowval="">KW9010_ONE-KW9010_GLITCH && LowVal<kw9010_one+kw9010_glitch) {/set/the/one/bits/if/(bitscounted<32)/bitset(rxbits,bitscounted);/else/bitset(crcbits,bitscounted-32);/bitscounted++;/}/(lowval="">KW9010_ZERO-KW9010_GLITCH && LowVal<kw9010_zero+kw9010_glitch) {/setting/zero/bits/is/not/necessary,/but/count/them/bitscounted++;/}/else/received/bit/a/sync,/one/or/bit,/so/restart/rxbits="0;" crcbits="0;" bitscounted="0;" if/(bitscounted="">=KW9010_MESSAGELEN) // all bits received
        {
          if (crcValid(rxBits,crcBits)) fifoWrite(rxBits); // write valid value to FIFO buffer
          else fifoWrite(0);  // write 0 to FIFO buffer (0 = invalid value received)
          rxBits=0;
          crcBits=0;
          bitsCounted=0;
        }
      }
      else 
      { // High values have no information with them
        rx433LineDown=micros(); // line went LOW after being HIGH
        HighVal=rx433LineDown - rx433LineUp; // calculate the HIGH pulse time
      }
    }
    
    #define FIFOSIZE 8  // Fifo Buffer size 8 can hold up to 7 items
    volatile long fifoBuf[FIFOSIZE]; // ring buffer
    volatile byte fifoReadIndex,fifoWriteIndex;  // read and write index into ring buffer
    
    void fifoWrite(long item)
    // write item into ring buffer
    {
      fifoBuf[fifoWriteIndex]=item; // store the item
      if (!(fifoWriteIndex+1==fifoReadIndex || (fifoWriteIndex+1>=FIFOSIZE && fifoReadIndex==0)))
        fifoWriteIndex++;  // advance write pointer in ringbuffer
      if (fifoWriteIndex>=FIFOSIZE) fifoWriteIndex=0; // ring buffer is at its end
    } 
    
    unsigned long fifoRead()
    // always check first if item is available with fifoAvailable()
    // before reading the ring buffer using this function
    { 
      unsigned long item;
      item=fifoBuf[fifoReadIndex];
      cli(); // Interrupts off while changing the read pointer for the ringbuffer
      fifoReadIndex++;
      if (fifoReadIndex>=FIFOSIZE) fifoReadIndex=0;
      sei(); // Interrupts on again
      return(item);
    }  
    
    boolean fifoAvailable()
    // item is available for reading if (fifoReadIndex!=fifoWriteIndex)
    {
      return (fifoReadIndex!=fifoWriteIndex);
    } 
    
    int freeRam () {
      extern int __heap_start, *__brkval; 
      int v; 
      return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
    }</kw9010_zero+kw9010_glitch)></kw9010_one+kw9010_glitch)></kw9010_sync+2*kw9010_glitch)> 
    




  • @Maxtox:

    Will das Geschwindt jemand auf die Erkenntnisse oben umschreiben?

    Start Bit L: 7990   H: 460
    Data Bits: 42
    L: 2024 2028 4080 4072 2040 2108 4072 2048 2044 4140 4076 2044 4076 2112 2044 2044 2044 4144 2048 4072 2048 4140 2044 4076 4076 2112 2044 2044 2044 4140 2044 2048 4076 4140 2044 2044 2048 2116 4076 2048 4080 2156 
    H: 456 452 452 448 460 456 460 444 460 456 456 456 452 452 456 452 456 452 452 452 456 452 456 456 452 456 452 452 456 452 456 452 452 456 456 456 452 452 448 452 452 448 
    
    001100100110100001010101100001001100001010
    
    
    // Arduino sketch to receive KW9010 temperature/humidity RF sensor telegrams
    // Written by 'jurs' for German Arduino Forum
    
    #define RX433DATA 2       // receive pin for hardware interrupts
    #define RX433INTERRUPT 0  // interrupt number for receive pin
    
    #define KW9010_SYNC 8000  // length in µs of starting pulse
    #define KW9010_ONE 4000   // length in µs of ONE pulse
    #define KW9010_ZERO 2000  // length in µs of ZERO pulse
    #define KW9010_GLITCH 500 // pulse length variation for ONE and ZERO pulses
    #define KW9010_MESSAGELEN 36  // number of bits in one message
    
    void setup()
    {
      Serial.begin(9600);
      pinMode(RX433DATA, INPUT);
      attachInterrupt(RX433INTERRUPT, rx433Handler, CHANGE);
      Serial.println();
      Serial.print(F("Free RAM: "));Serial.println(freeRam());
      Serial.println();
      Serial.println(F("Seconds\tCRC\tID\tChannel\tTemp C\tTrend\trH %\tLowBat\tForced send"));
    
    }
    
    void loop()
    {
      if (fifoAvailable())
      {
        unsigned long dataReceived=fifoRead();
        Serial.print(millis()/1000);
        if (dataReceived!=0)
        {
          Serial.print(F("\tOK"));
          printResults(dataReceived);
        }  
        else  
          Serial.print(F("\tFAIL"));
        Serial.println();  
      }  
    }
    
    void printResults(unsigned long value)
    {
      // Sensor ID 
      byte id = value & 0b11001111; // bit 0, 1, 2, 3, 6, 7, random change bits when battery is changed
      Serial.print('\t');Serial.print(id);
      // Channel (as set on sensor)
      byte channel = 2*bitRead(value,4)+bitRead(value,5); // bit 4, 5 are channel number
      Serial.print('\t');Serial.print(channel);
      // Temperature 
      int temperature = value>>12 & 0b111111111111;  // bit 12..23
      // if sign bit is set, adjust two's complement to fit a 16-bit number
      if (bitRead(temperature,11)) temperature= temperature | 0b1111000000000000;
      Serial.print('\t');Serial.print(temperature/10.0,1);
      // temperature tendency
      byte trend = value>>9 &0b11; // bit 9, 10
      Serial.print('\t');
      if (trend==0) Serial.print('=');       // temp tendency steady
      else if (trend==1) Serial.print('-');  // temp tendency falling
      else if (trend==2) Serial.print('+');  // temp tendency rising
      // Humidity
      byte humidity = (value>>24 & 0b11111111) - 156; // bit 24..31
      Serial.print('\t');Serial.print(humidity);
      // Battery State
      bool lowBat = value>>8 & 0b1;      // bit 8 is set if battery voltage is low
      Serial.print('\t');Serial.print(lowBat);
      // Trigger
      bool forcedSend = value>>11 &0b1;  // bit 11 is set if manual send button was pressed
      Serial.print('\t');Serial.print(forcedSend);
    }
    
    boolean crcValid(unsigned long value, byte checksum)
    // check if received crc is correct for received value
    {
      byte calculatedChecksum = 0;
      for (int i = 0 ; i < 8 ; i++) calculatedChecksum +=(byte)(value >> (i*4));
      calculatedChecksum &= 0xF;
      return calculatedChecksum == checksum;
    }
    
    void rx433Handler()
    {
      static long rx433LineUp, rx433LineDown;
      static unsigned long rxBits=0;
      static byte crcBits=0;
      static byte bitsCounted=0;
      long LowVal, HighVal;
      byte rx433State = digitalRead(RX433DATA); // current pin state
      if (rx433State) // pin is now HIGH
      {
        rx433LineUp=micros(); // line went HIGH after being LOW at this time
        LowVal=rx433LineUp - rx433LineDown; // calculate the LOW pulse time
        if (LowVal>KW9010_SYNC-2*KW9010_GLITCH && LowVal<kw9010_sync+2*kw9010_glitch) {/rxbits="0;" crcbits="0;" bitscounted="0;" }/else/if/(lowval="">KW9010_ONE-KW9010_GLITCH && LowVal<kw9010_one+kw9010_glitch) {/set/the/one/bits/if/(bitscounted<32)/bitset(rxbits,bitscounted);/else/bitset(crcbits,bitscounted-32);/bitscounted++;/}/(lowval="">KW9010_ZERO-KW9010_GLITCH && LowVal<kw9010_zero+kw9010_glitch) {/setting/zero/bits/is/not/necessary,/but/count/them/bitscounted++;/}/else/received/bit/a/sync,/one/or/bit,/so/restart/rxbits="0;" crcbits="0;" bitscounted="0;" if/(bitscounted="">=KW9010_MESSAGELEN) // all bits received
        {
          if (crcValid(rxBits,crcBits)) fifoWrite(rxBits); // write valid value to FIFO buffer
          else fifoWrite(0);  // write 0 to FIFO buffer (0 = invalid value received)
          rxBits=0;
          crcBits=0;
          bitsCounted=0;
        }
      }
      else 
      { // High values have no information with them
        rx433LineDown=micros(); // line went LOW after being HIGH
        HighVal=rx433LineDown - rx433LineUp; // calculate the HIGH pulse time
      }
    }
    
    #define FIFOSIZE 8  // Fifo Buffer size 8 can hold up to 7 items
    volatile long fifoBuf[FIFOSIZE]; // ring buffer
    volatile byte fifoReadIndex,fifoWriteIndex;  // read and write index into ring buffer
    
    void fifoWrite(long item)
    // write item into ring buffer
    {
      fifoBuf[fifoWriteIndex]=item; // store the item
      if (!(fifoWriteIndex+1==fifoReadIndex || (fifoWriteIndex+1>=FIFOSIZE && fifoReadIndex==0)))
        fifoWriteIndex++;  // advance write pointer in ringbuffer
      if (fifoWriteIndex>=FIFOSIZE) fifoWriteIndex=0; // ring buffer is at its end
    } 
    
    unsigned long fifoRead()
    // always check first if item is available with fifoAvailable()
    // before reading the ring buffer using this function
    { 
      unsigned long item;
      item=fifoBuf[fifoReadIndex];
      cli(); // Interrupts off while changing the read pointer for the ringbuffer
      fifoReadIndex++;
      if (fifoReadIndex>=FIFOSIZE) fifoReadIndex=0;
      sei(); // Interrupts on again
      return(item);
    }  
    
    boolean fifoAvailable()
    // item is available for reading if (fifoReadIndex!=fifoWriteIndex)
    {
      return (fifoReadIndex!=fifoWriteIndex);
    } 
    
    int freeRam () {
      extern int __heap_start, *__brkval; 
      int v; 
      return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
    }</kw9010_zero+kw9010_glitch)></kw9010_one+kw9010_glitch)></kw9010_sync+2*kw9010_glitch)> 
    ```` `  
    

    Hallo Maxtox,

    kann ich mit dem Sketch den Code meiner Fernbedienung für schaltbare Steckdosen ermitteln?

    Welchen Arduino hast Du dazu verwendet? Ich habe noch ein Mega und ein Nano hier rumliegen.



  • Uno, oder mega… Beide gehen...

    Ja du kannst es/du schaffst es!


Log in to reply
 

Suggested Topics

1.9k
Online

32.1k
Users

38.8k
Topics

526.1k
Posts