Récepteur RF433 mHz pour commander des éclairages DMX512

Bonjour,

Mon projet est de pouvoir commander des éclairages DMX12 depuis ma box Domotique.
La box dispose des protocoles suivant : Z-wave, Zigbee, DIO Chacon, Somfy RTS, ...

Réalisation en cours :

  • une carte Arduino Nana
  • un récepteur RF433
  • une carte MAX485

Avec le programme suivant je reçois bien les commandes RF433 DIO Chacon envoyées par la box Domotique.

/*
  RecordCode.ino - Program to acquire the DiO modules On/Off codes
  Created by Charles GRASSIN, July 31, 2017.
  Under MIT License (free to use, modify, redistribute, etc.).
  www.charleslabs.fr

  This example captures codes sent by DiO 433MHz remotes. To read
  the frames, plug a RX 433MHz module to the Arduino, to pin 2.
  Open serial monitor at 9600 bauds. Aim the remote at the module,
  and the code will be display in the monitor. Capture "On" and "Off"
  codes.
*/

// --- HomeEasy protocol parameters ---
#define DiOremote_PULSEIN_TIMEOUT 1000000
#define DiOremote_FRAME_LENGTH 64
// Homeasy start lock : 2725 us (+/- 175 us)
#define DiOremote_START_TLOW 2550
#define DiOremote_START_THIGH 2900
// Homeeasy 0 : 310 us
#define DiOremote_0_TLOW 250
#define DiOremote_0_THIGH 450
//Homeeasy 1 : 1300 us
#define DiOremote_1_TLOW 1250
#define DiOremote_1_THIGH 1500



// --- Variables ---
const unsigned int RX_PIN_DIO = 2;  // 443 MHz rx module pin
unsigned long code = 0;         // Variable to store the code
int i    ;                      // Loop iteration variable
unsigned long t = 0;            // Time between two falling edges
byte currentBit,previousBit;



// --- Setup ---
void setup() {             

  // Configuration DIO CHACON
     pinMode(RX_PIN_DIO, INPUT);
     Serial.begin(9600);

 }



// --- Loop ---
void loop() {

// Wait for incoming bit DIO CHACON
  t = pulseIn(RX_PIN_DIO, LOW, DiOremote_PULSEIN_TIMEOUT);

  // Only decypher from 2nd Homeeasy lock
  if (t > DiOremote_START_TLOW && t < DiOremote_START_THIGH) {

    for (i = 0 ; i < DiOremote_FRAME_LENGTH ; i++) {
      // Read each bit (64 times)
      t = pulseIn(RX_PIN_DIO, LOW, DiOremote_PULSEIN_TIMEOUT);

      // Identify current bit based on the pulse length
      if (t > DiOremote_0_TLOW && t < DiOremote_0_THIGH)
        currentBit = 0;
      else if (t > DiOremote_1_TLOW && t < DiOremote_1_THIGH)
        currentBit = 1;
      else
        break;
      
      // If bit count is even, check Manchester validity & store in code
      if (i % 2) {

        // Code validity verification (Manchester complience)
        if (!(previousBit ^ currentBit))
          break;
        
        // Store new bit
        code <<= 1;
        code |= previousBit;
      }
      previousBit = currentBit;
    }
  }

  // Send the code via serial
  if (i == DiOremote_FRAME_LENGTH)
    Serial.println(code);

}

Quand je charge le programme suivant je commande bien l'éclairage DMX512 depuis le Moniteur Série.

/*DMX
*/

#include <DmxSimple.h>

// -- Setup ---
void setup() {
  Serial.begin(9600);
  Serial.println("SerialToDmx ready");
  Serial.println();
  Serial.println("Syntax:");
  Serial.println(" 123c : use DMX channel 123");
  Serial.println(" 45w  : set current channel to value 45");

  // Enable DMX master interface and start transmitting
     DmxSimple.usePin(3);
}

// -- Initalisation --
int channel;
int value = 0;

 
// --  Loop --
void loop() {

  int c;

  while(!Serial.available());
  c = Serial.read();
  if ((c>='0') && (c<='9')) {
    value = 10*value + c - '0';
  } else {
    if (c=='c') channel = value;
    else if (c=='w') {
      DmxSimple.write(channel, value);
      Serial.println(channel);
      Serial.println(value);
      Serial.println();
    }
    value = 0;
  }
}

Mon souci est quand je charge la compilation de ces deux programmes, je peux toujours commander l'éclairage depuis le Moniteur Série, mais je ne reçois plus les commandes RF433 DIO Chacon.

/*DMX
*/

#include <DmxSimple.h>


/*RF433 CHACON
*/

// --- HomeEasy protocol parameters ---
#define DiOremote_PULSEIN_TIMEOUT 1000000
#define DiOremote_FRAME_LENGTH 64
// Homeasy start lock : 2725 us (+/- 175 us)
#define DiOremote_START_TLOW 2550
#define DiOremote_START_THIGH 2900
// Homeeasy 0 : 310 us
#define DiOremote_0_TLOW 250
#define DiOremote_0_THIGH 450
//Homeeasy 1 : 1300 us
#define DiOremote_1_TLOW 1250
#define DiOremote_1_THIGH 1500



// --- Variables ---
const unsigned int RX_PIN_DIO = 2;  // 443 MHz rx module pin
unsigned long code = 0;         // Variable to store the code
int i    ;                      // Loop iteration variable
unsigned long t = 0;            // Time between two falling edges
byte currentBit,previousBit;


// -- Setup ---
void setup() {
  Serial.begin(9600);
  Serial.println("SerialToDmx ready");
  Serial.println();
  Serial.println("Syntax:");
  Serial.println(" 123c : use DMX channel 123");
  Serial.println(" 45w  : set current channel to value 45");

  // Enable DMX master interface and start transmitting
     DmxSimple.usePin(3);

  // Configuration DIO CHACON
     pinMode(RX_PIN_DIO, INPUT);
}

// -- Initalisation --
int channel;
int value = 0;

 
// --  Loop --
void loop() {

 // Wait for incoming bit DIO CHACON
  t = pulseIn(RX_PIN_DIO, LOW, DiOremote_PULSEIN_TIMEOUT);

  // Only decypher from 2nd Homeeasy lock
  if (t > DiOremote_START_TLOW && t < DiOremote_START_THIGH) {

    for (i = 0 ; i < DiOremote_FRAME_LENGTH ; i++) {
      // Read each bit (64 times)
      t = pulseIn(RX_PIN_DIO, LOW, DiOremote_PULSEIN_TIMEOUT);

      // Identify current bit based on the pulse length
      if (t > DiOremote_0_TLOW && t < DiOremote_0_THIGH)
        currentBit = 0;
      else if (t > DiOremote_1_TLOW && t < DiOremote_1_THIGH)
        currentBit = 1;
      else
        break;
      
      // If bit count is even, check Manchester validity & store in code
      if (i % 2) {

        // Code validity verification (Manchester complience)
        if (!(previousBit ^ currentBit))
          break;
        
        // Store new bit
        code <<= 1;
        code |= previousBit;
      }
      previousBit = currentBit;
    }
  }

        Serial.println(code);
  int c;

 // DMX
  while(!Serial.available());
  c = Serial.read();
  if ((c>='0') && (c<='9')) {
    value = 10*value + c - '0';
  } else {
    if (c=='c') channel = value;
    else if (c=='w') {
      DmxSimple.write(channel, value);
      Serial.println(channel);
      Serial.println(value);
      Serial.println();
    }
    value = 0;
  }
}

Même résultat avec une car UNO.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.