diff --git a/OpenMQTTGateway.ino b/OpenMQTTGateway.ino index ef6c36d..40475c7 100644 --- a/OpenMQTTGateway.ino +++ b/OpenMQTTGateway.ino @@ -119,10 +119,9 @@ void callback(char* topic, byte* payload, unsigned int length) { void setup() { - //Launch serial for debugging purposes - Serial.begin(SERIAL_BAUD); - #ifdef ESP8266 + //Launch serial for debugging purposes + Serial.begin(SERIAL_BAUD, SERIAL_8N1, SERIAL_TX_ONLY); //Begining wifi connection in case of ESP8266 setup_wifi(); // Port defaults to 8266 @@ -153,6 +152,8 @@ void setup() }); ArduinoOTA.begin(); #else + //Launch serial for debugging purposes + Serial.begin(SERIAL_BAUD); //Begining ethernet connection in case of Arduino + W5100 setup_ethernet(); #endif diff --git a/User_config.h b/User_config.h index 7190548..f967b63 100644 --- a/User_config.h +++ b/User_config.h @@ -31,12 +31,6 @@ /*----------------------------USER PARAMETERS-----------------------------*/ #define SERIAL_BAUD 115200 -/*-------------DEFINE YOUR WIRING TYPE BELOW----------------*/ -// Choose between "I2C_Wiring" OR "Classic_Wiring" OR "RFM69_Wiring" -// Please Note: I2C Wiring,Classic Wiring and RFM69_Wiring uses different Pins for all Modules, see PIN definitions into the wiki -//#define I2C_Wiring // With Support for I2C Modules and the associated libraries BH1750 and BME280 -//#define RFM69_Wiring // following file img/OpenMQTTGateway_IR_RF_RFM69.png -#define Classic_Wiring // following file img/OpenMQTTGateway_IR_RF_BT.png /*-------------DEFINE YOUR NETWORK PARAMETERS BELOW----------------*/ //MQTT Parameters definition #define mqtt_server "192.168.1.17" @@ -73,33 +67,33 @@ const byte subnet[] = { 255, 255, 255, 0 }; //ip adress /*-------------DEFINE THE MODULES YOU WANT BELOW----------------*/ //Addons and module management, comment the Z line and the config file if you don't use #ifdef ESP8266 // for nodemcu, weemos and esp8266 - #define ZsensorDHT - #include "config_DHT.h" #define ZgatewayRF #include "config_RF.h" #define ZgatewayRF2 - #ifdef RFM69_Wiring - #define ZgatewayRFM69 - #include "config_RFM69.h" - #endif #define ZgatewayIR #include "config_IR.h" #define ZgatewayBT #include "config_BT.h" - #ifdef I2C_Wiring // to use the sensor below the gateway should wired with I2CWiring, see PIN DEFINITIONS below - #define ZsensorBH1750 - #include "config_BH1750.h" - #define ZsensorBME280 - #include "config_BME280.h" - #endif + #define ZsensorBH1750 + #include "config_BH1750.h" + #define ZsensorBME280 + #include "config_BME280.h" + //#define ZsensorDHT // If you uncomment this you can't use I2C due to the fact that I2C use also D1 + //#include "config_DHT.h" + //#define ZgatewayRFM69 // If you uncomment this you can't use RF and BT due to the fact that RF use also D8 and BT use also D6/D7 + //#include "config_RFM69.h" #else // for arduino + W5100 #define ZgatewayRF #include "config_RF.h" +<<<<<<< HEAD //#define ZgatewayRF2 // too big for UNO #ifdef RFM69_Wiring //#define ZgatewayRFM69 not tested //#include "config_RFM69.h" #endif +======= + #define ZgatewayRF2 +>>>>>>> New-wiring #define ZgatewayIR #include "config_IR.h" #define ZgatewayBT @@ -110,8 +104,10 @@ const byte subnet[] = { 255, 255, 255, 0 }; //ip adress //#include "config_BH1750.h" //#define ZsensorBME280 //#include "config_BME280.h" - -#endif/*----------------------------OTHER PARAMETERS-----------------------------*/ + //#define ZgatewayRFM69 not tested + //#include "config_RFM69.h" +#endif +/*----------------------------OTHER PARAMETERS-----------------------------*/ /*-------------------CHANGING THEM IS NOT COMPULSORY-----------------------*/ /*--------------MQTT general topics-----------------*/ // global MQTT subject listened by the gateway to execute commands (send RF, IR or others) diff --git a/config_DHT.h b/config_DHT.h index 4dda0d4..82f8fd8 100644 --- a/config_DHT.h +++ b/config_DHT.h @@ -31,15 +31,9 @@ #define dht_always true // if false when the current value for temp or hum is the same as previous one don't send it by MQTT #define TimeBetweenReadingDHT 30000 // time between 2 DHT readings /*-------------------PIN DEFINITIONS----------------------*/ -#ifdef I2C_Wiring // With Support for I2C Modules - #define DHT_RECEIVER_PIN 14 //on nodeMCU this is D5 GPIO14 -#endif - -#ifdef Classic_Wiring // Without Support for I2C Modules - #define DHT_RECEIVER_PIN 0 //on nodeMCU this is D3 GPIO0 -#endif - -#ifdef RFM69_Wiring // Without Support for I2C Modules and HM10 or 11 - #define DHT_RECEIVER_PIN 0 //on nodeMCU this is D3 GPIO0 +#ifdef ESP8266 + #define DHT_RECEIVER_PIN D1 // you can put D5 if you don't use HCSR501 sensor and the RFM69 +#else + #define DHT_RECEIVER_PIN D8 #endif diff --git a/config_IR.h b/config_IR.h index 7495320..6a340f6 100644 --- a/config_IR.h +++ b/config_IR.h @@ -68,19 +68,11 @@ #endif /*-------------------PIN DEFINITIONS----------------------*/ -#define IR_RECEIVER_PIN 2 // put 2 = D4 on nodemcu, 2 = D2 on arduino - -#ifdef I2C_Wiring // With Support for I2C Modules - #define IR_EMITTER_PIN 16 // 16 = D0 on nodemcu #define only usefull for ESP8266 +#ifdef ESP8266 + #define IR_RECEIVER_PIN 2 + #define IR_EMITTER_PIN 16 +#else + #define IR_RECEIVER_PIN 1 + #define IR_EMITTER_PIN D9 #endif -#ifdef RFM69_Wiring // With Support for I2C Modules - #define IR_EMITTER_PIN 16 // 16 = D0 on nodemcu #define only usefull for ESP8266 -#endif - -#ifdef Classic_Wiring // Without Support for I2C Modules - #define IR_EMITTER_PIN 14 // 14 = D5 on nodemcu #define only usefull for ESP8266 -#endif - - - diff --git a/config_RF.h b/config_RF.h index 25c06a8..fe7458b 100644 --- a/config_RF.h +++ b/config_RF.h @@ -64,42 +64,14 @@ RF supported protocols #define RF2dimKey "DIM" // number of your dim value will be defined if a subject contains RF2dimKey and the payload contains the dim value as digits /*-------------------PIN DEFINITIONS----------------------*/ -#ifdef I2C_Wiring // With Support for I2C Modules - #define RF_EMITTER_PIN 15 //put 15 = D8 on nodemcu - #ifdef ESP8266 - //RF PIN definition - #define RF_RECEIVER_PIN 0 // 0 = D3 on nodemcu - #else +#ifdef ESP8266 + #define RF_RECEIVER_PIN 0 // D3 on nodemcu + #define RF_EMITTER_PIN 3 // RX on nodemcu +#else //IMPORTANT NOTE: On arduino UNO connect IR emitter pin to D9 , comment #define IR_USE_TIMER2 and uncomment #define IR_USE_TIMER1 on library IRremote/IRremoteInt.h so as to free pin D3 for RF RECEIVER PIN //RF PIN definition - #define RF_RECEIVER_PIN 1 // 1 = D3 on arduino - #endif -#endif - -#ifdef Classic_Wiring // Without Support for I2C Modules - #define RF_EMITTER_PIN 4 //put 4 = D2 on nodemcu, 4 = D4 on arduino - #ifdef ESP8266 - //RF PIN definition - #define RF_RECEIVER_PIN 5 // 5 = D1 on nodemcu - #else - //IMPORTANT NOTE: On arduino UNO connect IR emitter pin to D9 , comment #define IR_USE_TIMER2 and uncomment #define IR_USE_TIMER1 on library IRremote/IRremoteInt.h so as to free pin D3 for RF RECEIVER PIN - //RF PIN definition - #define RF_RECEIVER_PIN 1 // 1 = D3 on arduino - #endif -#endif - -#ifdef RFM69_Wiring // Without Support for I2C Modules and HM10 or 11 - #ifdef ESP8266 - #define RF_RECEIVER_PIN 0 // 0 = D3 on nodemcu - #define RF_EMITTER_PIN 10 //put SD3 on nodemcu - #else - //IMPORTANT NOTE: On arduino UNO connect IR emitter pin to D9 , comment #define IR_USE_TIMER2 and uncomment #define IR_USE_TIMER1 on library IRremote/IRremoteInt.h so as to free pin D3 for RF RECEIVER PIN - //RF PIN definition - #define RF_RECEIVER_PIN 1 // 1 = D3 on arduino + #define RF_RECEIVER_PIN 0 //0 = D2 on arduino #define RF_EMITTER_PIN 4 //4 = D4 on arduino - #endif #endif - - diff --git a/config_RFM69.h b/config_RFM69.h index 0ff1187..930feb8 100644 --- a/config_RFM69.h +++ b/config_RFM69.h @@ -48,21 +48,18 @@ const char PROGMEM RFM69AP_NAME[] = "RFM69-AP"; #define IS_RFM69HCW true // set to 'true' if you are using an RFM69HCW module #define POWER_LEVEL 31 -/*-------------------PIN DEFINITIONS----------------------*/ - -#ifdef RFM69_Wiring // Without Support for I2C Modules and HM10 or 11 - - #ifdef ESP8266 - #define RFM69_CS D1 // GPIO5/HCS/D1 - #define RFM69_IRQ D8 // GPIO15/D8 - #define RFM69_IRQN digitalPinToInterrupt(RFM69_IRQ) - #define RFM69_RST D4 // GPIO02/D4 - #else - //RFM69 not tested with arduino - #define RFM69_CS 10 - #define RFM69_IRQ 2 - #define RFM69_IRQN digitalPinToInterrupt(RFM69_IRQ) - #define RFM69_RST 9 - #endif +/*-------------------PIN DEFINITIONS----------------------*/ +#ifdef ESP8266 + #define RFM69_CS D1 + #define RFM69_IRQ D8 // GPIO15/D8 + #define RFM69_IRQN digitalPinToInterrupt(RFM69_IRQ) + #define RFM69_RST D4 // GPIO02/D4 +#else + //RFM69 not tested with arduino + #define RFM69_CS 10 + #define RFM69_IRQ 0 + #define RFM69_IRQN digitalPinToInterrupt(RFM69_IRQ) + #define RFM69_RST 9 #endif + diff --git a/img/OpenMQTTGateway_Arduino_IR_RF_BT_DHT.png b/img/OpenMQTTGateway_Arduino_IR_RF_BT_DHT.png new file mode 100644 index 0000000..21cf0e1 Binary files /dev/null and b/img/OpenMQTTGateway_Arduino_IR_RF_BT_DHT.png differ diff --git a/img/OpenMQTTgateway_Addon_DHT.png b/img/OpenMQTTgateway_Addon_DHT.png new file mode 100644 index 0000000..daae568 Binary files /dev/null and b/img/OpenMQTTgateway_Addon_DHT.png differ diff --git a/img/OpenMQTTgateway_Addon_RF.png b/img/OpenMQTTgateway_Addon_RF.png new file mode 100644 index 0000000..8407669 Binary files /dev/null and b/img/OpenMQTTgateway_Addon_RF.png differ diff --git a/img/OpenMQTTgateway_Arduino.fzz b/img/OpenMQTTgateway_Arduino.fzz new file mode 100644 index 0000000..af6a631 Binary files /dev/null and b/img/OpenMQTTgateway_Arduino.fzz differ