DMX Varitec PAR56 über Funk mit NRF24L01 ansteuern

21. März 2016 at 22:37
Print Friendly, PDF & Email

Für die Ansteuerung verwende ich das kostenlose Programm Vixen.
Ein OpenDMX Interface basierend auf einem Arduino funktionierte nicht zuverlässig.
Daher habe ich einen E1.31 Empfänger aufgebaut, welches das DMX-Signal über einen nRF24L01 sendet.

In den Lampen von Varitec habe ich einen entsprechenden Empfänger eingebaut.

 

Alternativ habe ich dies nun mit einem ESP8266 realisiert, welcher per WLAN ein ArtNEt Node zur Verfügung stellt: https://hoeser-medien.de/2017/03/esp8266-dmx-modul-mit-web-server/

DMX Varitec Par56 - Schaltplan

DMX Varitec Par56 - 5 DMX Varitec Par56 - 4 DMX Varitec Par56 - 3 DMX Varitec Par56 - 2 DMX Varitec Par56 - 1

Arduino – Empfänger-Code

/*
 * DMXSerial RFShow Control Receiver Sketch for handling the RF to DMX
 *
 * Input : nRF
 * Output: DMX
 * Date : 2016-05-07
 *
 *
 * Created on: August 2013
 * Author: Greg Scull, komby@komby.com * Updated: May 20, 2014 - Mat Mrosko, Materdaddy, rfpixelcontrol@matmrosko.com
 *
 */
 
#include <Arduino.h>
#include <EEPROM.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <SPI.h>
 
#include "ModifiedDMXSerial.h"
#include "IRFShowControl.h"
#include "RFShowControl.h"
 
 
#define TIME_ALIVE 1000
#define TIME_POWEROFF 3000
//#define DEBUG
/********************* START OF REQUIRED CONFIGURATION ***********************/
// read A6+A7 to select RF channel
uint8_t dec_RFChannel[] = {0, 10, 20, 40};
// #define NRF_TYPE RF1
//#define __CE 8 // standard
//#define __CSN 7 // standard
#define OVER_THE_AIR_CONFIG_ENABLE 0
#define RECEIVER_UNIQUE_ID 35
#define DATA_RATE RF24_1MBPS
#define LISTEN_CHANNEL 0
#define HARDCODED_START_CHANNEL 1
#define HARDCODED_NUM_CHANNELS 135
#define FCC_RESTRICT 1
/********************* END OF ADVANCED SETTINGS SECTION **********************/
#define PIXEL_TYPE DMX
//Include this after all configuration variables are set
#include "RFShowControlConfigCE8CS7.h"
 
// RF channel
#define DEC_RFC_1 A1 // 1 * 2^1 = 1 * 2
#define DEC_RFC_0 A0 // 1 * 2^0 = 1 * 1
 
bool initclean = 0;
 
uint8_t *channels;
uint8_t code_val = 0;
 
#define RF_LED_PIN 4
// #define RF_LED_PIN2 13 // 13 is SCL used for RF
 
void(*resetFunc) (void) = 0;//declare reset function at address 0
uint8_t read_coder2(uint8_t DEC_PIN_0,uint8_t DEC_PIN_1);
unsigned long tempTimer, flashTimer, aliveTimer, noDMXTimer;
//---------------------------------------------------------------------------------------------------
void setup(void)
{
 //NOTE You CANNOT use any Serial.Write with this sketch
 uint8_t myRFChannel = 0;
 
 pinMode(RF_LED_PIN, OUTPUT);
 
 //Set the output pin for the RS485 adapter to transmit
 pinMode(A0, OUTPUT);
 digitalWrite(A0, HIGH);
 //setup status LED
 pinMode(1, OUTPUT);
 digitalWrite(1, LOW);
 
 // read analog input to determine RF Channel
 code_val = read_coder2(DEC_RFC_0,DEC_RFC_1);
 myRFChannel = dec_RFChannel[code_val]; // dec_RFChannel[] = {0, 10, 0,20};
 
 
 radio.EnableOverTheAirConfiguration(OVER_THE_AIR_CONFIG_ENABLE);
 
 uint8_t logicalControllerNumber = 0;
 if(!OVER_THE_AIR_CONFIG_ENABLE)
 {
 radio.AddLogicalController(logicalControllerNumber, HARDCODED_START_CHANNEL, HARDCODED_NUM_CHANNELS, 0);
 }
 
 initclean = radio.Initialize(radio.RECEIVER, pipes, myRFChannel, DATA_RATE, RECEIVER_UNIQUE_ID);
 if (initclean){
 // printf("\n> printDetails .. ");
 // radio.printDetails();
 // printf("\n #\n");
 }
 else{
 delay(1000);
 resetFunc(); //If nrf failes reset
 }
 
 
 
 logicalControllerNumber = 0;
 channels = radio.GetControllerDataBase(logicalControllerNumber);
 int numChannels = radio.GetNumberOfChannels(logicalControllerNumber);
 ModifiedDMXSerial.maxChannel(numChannels);
 
 ModifiedDMXSerial.init(DMXController, channels);
 tempTimer = flashTimer = aliveTimer = noDMXTimer = millis();
}
 
//---------------------------------------------------------------------------------------------------
void loop(void)
{
 //we dont need to do anything here as the library is handling all the data and transmission of info.
 tempTimer = millis();
 
 if (radio.Listen())
 {
 if (tempTimer - flashTimer > 300) {
 noDMXTimer = flashTimer = tempTimer; // reset timer after 1 second(ish)
 analogWrite(RF_LED_PIN , 0);
 }
 
 } else {
 if (tempTimer - aliveTimer > TIME_ALIVE) {
 aliveTimer = tempTimer; // reset timer after 1 second(ish)
 analogWrite(RF_LED_PIN , 150);
 }
 if (tempTimer - noDMXTimer > TIME_POWEROFF) {
 noDMXTimer = tempTimer; // reset timer after 10 second(ish)
 ModifiedDMXSerial.init(DMXController, channels); //If DMX Signal lost perform a reset
 }
 
 } // if if (radio.Listen())
}
 
 
//---------------------------------------------------------------------------------------------------
uint8_t read_coder2(uint8_t DEC_PIN_0,uint8_t DEC_PIN_1){
 int cod_ret,cod1, cod2;
 
 cod1 = analogRead(DEC_PIN_0);
 if (cod1 > 512){cod1 = 0;} else {cod1 = 1;}
 delay(2);
 
 cod2 = analogRead(DEC_PIN_1);
 if (cod2 > 512){cod2 = 0;} else {cod2 = 1;}
 
 cod_ret = cod1 + cod2 * 2;
 
#ifdef DEBUG
 printf("> code %d = %1d-%1d \n", cod_ret, cod1,cod2);
#endif
 return(cod_ret);
} // end of function read_coder2()