Handle stove by IR

35 views
Skip to first unread message

Miguel Angel de Pablo

unread,
Nov 14, 2017, 8:46:37 AM11/14/17
to souliss
Hello

I've been trying to command Go with Souliss for a long time and I do not hit the key, I've tried several examples and the one that does not give a compilation failure does not send the codes ... I've read in the English and Italian forums but none of them a clear example of how to emit.

I have managed to capture the codes of the command (see below) the first is to turn on and off and the golds one is to raise the temperature and the other down, but I have only got here.

(32 bits) Decoded NEC: 538DF807 (HEX), 1010011100011011111100000000111 (BIN)
(32 bits) Decoded NEC: 538D42BD (HEX), 1010011100011010100001010111101 (BIN)
(32 bits) Decoded NEC: 538DC23D (HEX), 1010011100011011100001000111101 (BIN)

I work with Nodemcu and this is the code I am using (besides the IR there is a dallas probe and an LDR that work OK)

#include "SoulissFramework.h"

// Configure the framework
#include "bconf/MCU_ESP8266.h"              // Load the code directly on the ESP8266
#include "conf/Gateway.h"                   // The main node is the Gateway, we have just one node
#include "conf/IPBroadcast.h"

#define WIFICONF_INSKETCH
#define WiFi_SSID             ""
#define WiFi_Password    ""  

// Include framework code and libraries
#include <ESP8266WiFi.h>
#include <EEPROM.h>
#include "Souliss.h"
/*#include <IRremote.h>*/
#include <IRrecv.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <IRtimer.h>
#include <IRutils.h>
#include <ir_Argo.h>
#include <ir_Daikin.h>
#include <ir_Fujitsu.h>
#include <ir_Kelvinator.h>
#include <ir_LG.h>
#include <ir_Mitsubishi.h>
#include <ir_Trotec.h>
#include <OneWire.h>
#include <DallasTemperature.h>

// This identify the number of the LED logic

#define DALLAS              0
#define LDR                 2 // Typical 54 : Light Sensor - 2 slot
#define ESTUON              5
#define ESTUMAS             6  
#define ESTUMEN             7

#define SensorLDR_pin   A0
#define DALLASPIN 4 //Se declara el pin donde se conectará la DATA
#define IRLED  5 // pin D1
IRsend irsend(16);

// Light calibration data
// out[] holds the values wanted in lux/10
#define sizeofarray 9   // Number of items on out and in arrays
static const unsigned int out[] = { 700, 3000, 4500, 6500, 15000, 30000, 45000, 210000, 1300000};  // x10  //ULTIMO VALOR REFERENCIA
static const unsigned int in[]  = { 100, 350, 430, 500, 680, 780, 950, 1005, 1024 };  // 0 - 1024

/*#include <OneWire.h>
#include <DallasTemperature.h>*/
OneWire ourWire(DALLASPIN); //Se establece el pin declarado como bus para la comunicación OneWire
DallasTemperature sensors(&ourWire); //Se instancia la librería DallasTemperature

#define Debug Serial        //Change to Serial1 if you want to use the GPIO2 to TX

// Define the network configuration according to your router settings
// uint8_t ip_address[4]  = {192, 168, 1, 54};// real
uint8_t ip_address[4]  = {192, 168, 1, 76};// pruebas
uint8_t subnet_mask[4] = {255, 255, 255, 0};
uint8_t ip_gateway[4]  = {192, 168, 1, 1};
#define myvNet_address  ip_address[3]       // The last byte of the IP address (77) is also the vNet address



void setup()
{  
    Initialize();
   
   Serial.begin(115200);
   Debug.begin(115200);

    sensors.begin(); //Se inician los sensores DS18B20

   //CONFIGURACION DE IP FIJA
  Souliss_SetIPAddress(ip_address, subnet_mask, ip_gateway);
   
   // nodes in your Souliss network
  // SetAddress(0xAB05, 0xFF00, 0xAB01); // real
    SetAddress(0xAB09, 0xFF00, 0xAB01); // pruebas
 
     
   // This node will serve all the others in the network providing an address
   Set_T54(LDR);
   Set_Temperature(DALLAS);
   Set_T14 (ESTUON);
   Set_T14 (ESTUMAS);
   Set_T14 (ESTUMEN);

}

    //////////////////////////////////////////////////////////////////////////////
// Calculate lux based on rawADC reading from LDR returns value in lux/10
//////////////////////////////////////////////////////////////////////////////
int get_lux(const unsigned int* _in, const unsigned int* _out, byte size)
{
// take care the value is within range
// val = constrain(val, _in[0], _in[size-1]);

 int val = analogRead(A0);
Debug.print("AnalogRead: ");
Debug.println(val);
if (val <= _in[0]) return _out[0];
if (val >= _in[size-1]) return _out[size-1];

 // search right interval
byte pos = 1;  // _in[0] allready tested
while(val > _in[pos]) pos++;

 // this will handle all exact "points" in the _in array
if (val == _in[pos]) return _out[pos];

 // interpolate in the right segment for the rest
return map(val, _in[pos-1], _in[pos], _out[pos-1], _out[pos]);  
}
  void loop()
{
    EXECUTEFAST() {                    
        UPDATEFAST();  
       
        FAST_2110ms()
       {
          Logic_T54(LDR);
       }
       
        FAST_7110ms()
       {
              float ldr_read = get_lux(in, out, sizeofarray)/100.0;  //ORIGINAL
             if (ldr_read == 0) ldr_read = 0.01;
             Souliss_ImportAnalog(memory_map, LDR, &ldr_read);
       }
       
        FAST_910ms()    {
         // Acquire temperature from the microcontroller ADC
         sensors.requestTemperatures(); //Prepara el sensor para la lectura
         float dallas = sensors.getTempCByIndex(0);
         Souliss_ImportAnalog(memory_map, DALLAS, &dallas);
       }      

        FAST_2110ms()
       {
          Logic_Temperature(DALLAS);
       }
               
        // Execute the code every 101 time_base_fast          
       FAST_910ms()    {
       
         /*  // Acquire temperature from the microcontroller ADC
           AnalogIn(A0, ANALOGDAQ+1, 0.04, -10); // The raw data is 0-1024, scaled as -10 to +30 Celsius
         */
       
            //pulsador
           Logic_T14 (IRLED);

              if(Souliss_Logic_T14(memory_map, IRLED, &data_changed)==Souliss_TRIGGED){  
              if(mOutput(ESTUON) == 1) irsend.sendNEC(0x538DF807, 32);
          }
           if(Souliss_Logic_T14(memory_map, IRLED, &data_changed)==Souliss_TRIGGED){    
               if(mOutput(ESTUMAS) == 1) irsend.sendNEC(0x538D42BD, 32);
            }
           if(Souliss_Logic_T14(memory_map, IRLED, &data_changed)==Souliss_TRIGGED){    
                if(mOutput(ESTUMEN) == 0) irsend.sendNEC(0x538DC23D, 32);
           }/*
           if(Souliss_Logic_T14(memory_map, SLOT3, &data_changed)==Souliss_TRIGGED){    
                if(mOutput(SLOT3) == 0) irsend.sendNEC(0xFF8877, 32);
               if(mOutput(SLOT3) == 1) irsend.sendNEC(0xFF08F7, 32);
           }
           if(Souliss_Logic_T114(memory_map, SLOT4, &data_changed)==Souliss_TRIGGED){    
                if(mOutput(SLOT4) == 0) irsend.sendNEC(0xFF50AF, 32);  
                if(mOutput(SLOT4) == 1) irsend.sendNEC(0xFF708F, 32);
               */
       }      
         // Here we handle here the communication with Android
         FAST_PeerComms();
         
      START_PeerJoin();
     }
     
     EXECUTESLOW() {
      UPDATESLOW();
      SLOW_PeerJoin();
    }                                          
}



You can help me out and thanks in advance

Forgive use the google translator.

a greeting

Miguel Angel de Pablo

unread,
Dec 5, 2017, 9:00:01 AM12/5/17
to souliss

hello, I've tried this code

    

#define ESTUONCOD (0x538DF807, 32)
#define ESTUMASCOD (0x538D42BD, 32)
#define ESTUMENCOD (0x538DC23D, 32)

................

  Logic_PulseOutput (ESTUON); {
                 irsend.sendNEC (ESTUONCOD, Souliss_T1n_Coil, ESTUON);
                 Serial.println ("STOVE");
            }

            Logic_PulseOutput (ESTUMAS); {
                 irsend.sendNEC (ESTUMASCOD, Souliss_T1n_Coil, ESTUMAS);
                 Serial.println ("MORE STOVE");
            }

            Logic_PulseOutput (ESTUMEN); {
                 irsend.sendNEC (ESTUMENCOD, Souliss_T1n_Coil, ESTUMEN);
                 Serial.println ("STOVE LESS");
              }
         

and nothing in the serial port comes out in a loop

STOVE
MORE STOVE
LESS STOVE

You can help me out, thanks

a greeting

Reply all
Reply to author
Forward
0 new messages