Conflict Souliss T11 with libraries onewire & DallasTemperature ?

83 views
Skip to first unread message

guyc

unread,
Jan 9, 2017, 6:02:10 PM1/9/17
to souliss

Hello,

For measuring the temperatures, I'm using the Dallas DS1820 sensors The onwire bus is connected at pin A0 from a Arduino Mega2560.

The push buttons are connected to pins 22 > 37
When I read the value ( mOutput(slot) of the corresponding slots (all T11) I have '0' or '1', with the libraries onewire and Dallastemperature not installed and the output toggles when a push button is activated.

When the  onewire and Dallas Libraries are installed pins 30 to 34 has the value 255 and there is no reaction when I toggle the inputs. On the other pins (22 >29 and 35 >37 ) there is no problem
As far as I could check in the arduino description, pins 30 to 34 has no special functions for timers or something like that.

Fulvio Spelta

unread,
Jan 10, 2017, 2:51:12 PM1/10/17
to souliss
When you initialize the OneWire lib you have to define witch pin you want to use as bus driver check conflict.
Another problem if you are using T52 in order to store the temperatures remember that the T52 slot use 2 byte: check that your slots definition isn't overlapping.
Good work :-)
Message has been deleted

guyc

unread,
Jan 10, 2017, 4:57:44 PM1/10/17
to souliss
Fulvio,

The onewire bus is connected to pin AO, Push buttons are connected on pins 22 > 37, relais outputs pins 38>49, Dimmable lights and some ON/OFF light are connected by DMX.

I receive the right data from the 2 DS1830 sensor without any problem and the value of the indoor measurement I can see as setpoint for the thermostate too.

The problem is when the libraries onewire and DallasTemperature are active, some other slots are not working anymore.
For the T11 who is using one slot, the value is '0' or '1'. I can toggle between these 0 and 1 when the onewire and DallasT libraries are disabled.
Once both libaries are enabled, the problems begin.  I have following feedback on the serial monitor at that moment :

 slot    pin input  pin output   value
   0        32            48           255           no reaction when pushing button
   1        28            49            0/1           ok
   2                                                       slot not used
   3        35            40            0/1           ok
   4        36            42            0/1           ok
   5        --             43                             input from software
   8        29            41            0/1           ok
   9        37            44            0/1           ok
 10        --              45                            input from software
 11        30            46            255           no reaction when pushing button
 12        31            47            25
 22        34           DMX         255           no reaction when pushing button
 23        33           DMX         255           no reaction when pushing button

Please find my test sketch :

// Configure the framework
#include "bconf/StandardArduino.h"          // Use a standard Arduino
#include "conf/ethENC28J60.h"               // Ethernet through ethENC28J60-shield
//#include "conf/Gateway.h"                   // The main node is the Gateway, we have just one node
#include "conf/Gateway_wPersistence.h"
#include <OneWire.h>
#include <DallasTemperature.h>


// Include framework code and libraries
#include <SPI.h>

/*** All configuration includes should be above this line ***/
#include "Souliss.h"

// dmx LIBRARY
#include <DMXSerial.h>

//#include <Wire.h>




// relais - dit zijn alle uitgangen die 230Vac schakelen 



// beschrijving        - slotnr -      output pin arduino    
#define technische_ruimte    0    //48 
#define mansarde                1    //49
#define garage                     3   //40
#define dampkap                 4   //42
#define doorgang                 5   //43
#define B_leeslamp              6   //38
#define C_eethoek                7  //39
#define multimedia               8   //41
#define logeerkamer             9   //44
#define ventilator_WC         10   //45
#define trap                        11  //46
#define binnenkoer              12  //47

//  beschrijving -        slotnr.-         output pin DMX-kaart      ON/OFF (T11)
//#define k_wasbak            20 //DMX 3Red // mag weg, wordt samen gestuurd met keuken
#define douche                  22 //DMX 3Green // is niet geïnstalleerd
#define WC                       23 //DMX 2-white


//DMX outputs - dit zijn uitgangen van 12V dimbare lichtpunten ( 2 slots per lichtpunt)  (T19)

//  beschrijving -        slotnr.- output pin DMX-kaart      DIMMERS
#define eethoek_A1       30    // dmx 1-bleu 
//#define eethoek_A2     32    // dmx 1-green  // is samengezet met A1
#define zithoek_A3        34    // dmx 1-white
#define keuken              36    // dmx 1-red    // D1 (k-wasbak, meesturen met keuken - aanpassen op klemmenrij)
//#define zithoek_A4       38    // dmx 2-bleu   // is samengezet met A1
//#define leeshoek_A5     40    // dmx 2-green  // is samengezet met A1
#define slaapkamer         42    // dmx 2-red

// temparuursmetingen
#define Dallas_1            15    // temperatuur living
#define Dallas_2            17    // buiten temperatuur
#define Thermostaat         45    // thermostaat CV
#define Souliss_T3n_DeadBand      0.2     // Degrees Deadband
#define Souliss_T3n_Hysteresis    0.5     // Degrees Hysteresis

// input temperatuur metingen pin A0
#define One_Wire_Bus  A0

// Pass our oneWire reference to Dallas Temperature.
OneWire oneWire(One_Wire_Bus);
DallasTemperature sensors(&oneWire);

/*-----( Declare Variables )-----*/
// Assign the addresses of your 1-Wire temp sensors.
DeviceAddress sensor1 = { 0x28, 0xEE, 0x44, 0xF8, 0x14, 0x16, 0x02, 0x91 }; // sensor nr 1 DS1820
DeviceAddress sensor2 = { 0x28, 0xEE, 0x87, 0x11, 0x17, 0x16, 0x02, 0xC3 }; // sensor nr 5 DS1820

// netwerk settings (router afhandelijk)
uint8_t ip_address[4]  = {192, 168, 0, 177}; // IP adres domotica Souliss
uint8_t subnet_mask[4] = {255, 255, 255, 0};
uint8_t ip_gateway[4]  = {192, 168, 0, 1};   // IP adress router
#define myvNet_address  ip_address[3]       // The last byte of the IP address (77) is also the vNet address
#define myvNet_subnet   0xFF00


void setup()
{  
    Initialize();
    
      DMXSerial.init(DMXController);
      Serial.begin(9600);  // enkel voor testen programma
      sensors.begin();
     
     // Set network parameters
      Souliss_SetIPAddress(ip_address, subnet_mask, ip_gateway);
      SetAsGateway(myvNet_address);                                   // Set this node as gateway for SoulissApp 

     // definitie en instellen type uitgang
 
      // Aan/uit functies (relais 230V)
      Set_SimpleLight(technische_ruimte);
      Set_SimpleLight(mansarde);
      //Set_SimpleLight(L34);
      Set_SimpleLight(garage);
      Set_SimpleLight(dampkap);
      Set_SimpleLight(doorgang);
      //Set_SimpleLight(B_leeslamp); // wordt niet gebruikt. Enkel bekabeling voorzien
      // Set_SimpleLight(C_eethoek); // wordt niet gebruikt. Enkel bekabeling voorzien
      Set_SimpleLight(multimedia);
      Set_SimpleLight(logeerkamer);
      Set_SimpleLight(ventilator_WC);
      Set_SimpleLight(trap);
      Set_SimpleLight(binnenkoer);
     
      // Aan/uit functies (via DMX - 12V)
      Set_SimpleLight(douche);  
      //Set_SimpleLight(lavabo); // wordt niet gebruikt. Enkel bekabeling voorzien
      Set_SimpleLight(WC); 
     
      // Dimbare lichten (via DMX - 12V)
      Set_DimmableLight(eethoek_A1);
      //Set_DimmableLight(eethoek_A2); // wordt niet gebruikt, gaat samen met A1
      Set_DimmableLight(zithoek_A3);
      Set_DimmableLight(keuken);
      //Set_DimmableLight(zithoek_A4);  // wordt niet gebruikt, gaat samen met A3
      // Set_DimmableLight(leeshoek_A5); // wordt niet gebruikt, gaat samen met A1
      Set_DimmableLight(slaapkamer);
     
   // temperatuursmetingen en thermostaat
      Set_Temperature(Dallas_1);
      Set_Temperature(Dallas_2);
      Set_Thermostat(Thermostaat);          // Set a logic for the thermostat
      sensors.setResolution(sensor1, 10);   // resolutie DS1820
      sensors.setResolution(sensor2, 10);
 
   
 // definiëren ingangen (drukknoppen)
  pinMode(22, INPUT); // living A1/A2 eethoek
  pinMode(24, INPUT); // keuken D1/D2
  pinMode(26, INPUT); // slaapkamer
  pinMode(28, INPUT); // mansarde
  pinMode(30, INPUT); //trap
  pinMode(32, INPUT); // technische ruimte
  pinMode(34, INPUT); // douche
  pinMode(36, INPUT); // dampkap
  pinMode(23, INPUT); // living A3/A4*A5 zithoek
  pinMode(25, INPUT);
  pinMode(27, INPUT); // lavabo 
  pinMode(29, INPUT); // multimedia
  pinMode(31, INPUT); // binnenkoer
  pinMode(33, INPUT); // WC
  pinMode(35, INPUT); // garage
  pinMode(37, INPUT); // logeerkamer (2e verdieping)

  //outputs
  pinMode(38, OUTPUT);  // relais thermostaat CV
  pinMode(40, OUTPUT);  // garage
  pinMode(42, OUTPUT);  // dampkap
  pinMode(44, OUTPUT);  // logeerkamer
  pinMode(46, OUTPUT);  // trap
  pinMode(48, OUTPUT);  // technische ruimte

  pinMode(39, OUTPUT);  // C_eethoek
  pinMode(41, OUTPUT);  // multimedia
  pinMode(43, OUTPUT);  // doorgang
  pinMode(45, OUTPUT);  // ventilator WC
  pinMode(47, OUTPUT);  // binnenkoer
  pinMode(49, OUTPUT);  // mansarde

  // alle relais OFF sturen bij opstart   ( relaiskaart negatieve logica)
  mInput(technische_ruimte) =1;
  mInput(mansarde) =1;
  mInput(dampkap) =1;
  mInput(garage) =1;
  mInput(logeerkamer) =1;
}

void loop()
{
    // uitvoeren programma groepen
   
    EXECUTEFAST() {                    
        UPDATEFAST();  
       
         FAST_210ms() {   // om de 50 msec worden de ingangen gelezen en de functies uitgevoerd
           
        //inlezen drukknoppen voor de ON/OFF lichten
        DigIn(28, Souliss_T1n_ToggleCmd,mansarde);
      DigIn(30, Souliss_T1n_ToggleCmd,trap);
      DigIn(32, Souliss_T1n_ToggleCmd,technische_ruimte);
      DigIn(34, Souliss_T1n_ToggleCmd,douche);
      DigIn(36, Souliss_T1n_ToggleCmd,dampkap);
      //DigIn(25, Souliss_T1n_ToggleCmd,   );not used
      //DigIn(27, Souliss_T1n_ToggleCmd, lavabo);
      DigIn(29, Souliss_T1n_ToggleCmd,multimedia);
      DigIn(31, Souliss_T1n_ToggleCmd,binnenkoer);
      DigIn(35, Souliss_T1n_ToggleCmd,garage);
      DigIn(37, Souliss_T1n_ToggleCmd,logeerkamer);
      DigIn(33, Souliss_T1n_ToggleCmd,WC);
     
      // uitvoeren logica
       Logic_SimpleLight(mansarde);
       Serial.print ("mansarde     ");
           Serial.println(mOutput(mansarde));   
      Logic_SimpleLight(trap);
      Serial.print ("trap     ");
           Serial.println(mOutput(trap));  
      Logic_SimpleLight(technische_ruimte);
      Serial.print ("technische_ruimte     ");
           Serial.println(mOutput(technische_ruimte)); 
      Logic_SimpleLight(douche);
      Serial.print ("douche     ");
           Serial.println(mOutput(douche));
      Logic_SimpleLight(dampkap);
      Serial.print ("DK     ");
          Serial.println(mOutput(dampkap));  
      //  Logic_SimpleLight(lavabo);
      Logic_SimpleLight(multimedia);
      Serial.print ("multimedia     ");
          Serial.println(mOutput(multimedia));
      Logic_SimpleLight(binnenkoer);
      Serial.print ("binnenkoer     ");
          Serial.println(mOutput(binnenkoer));
      Logic_SimpleLight(garage);
      Serial.print ("garage     ");
          Serial.println(mOutput(garage));
      Logic_SimpleLight(logeerkamer);
      Serial.print ("logeerkamer     ");
          Serial.println(mOutput(logeerkamer));
      //Logic_SimpleLight(C_eethoek);
      //Logic_SimpleLight(L34);
      Logic_SimpleLight(WC);
      Serial.print ("WC     ");
           Serial.println(mOutput(WC));     
       

      //  sturen uitgangen ( inverse logica omwille dat de relais-kaart geïnverteerd is)
     
      // if (mOutput(WC)== 0) DMXSerial.write(8, 0);         //DMX 2- white
      // if (mOutput(WC)== 1) DMXSerial.write(8, 255);  
      // if (mOutput(douche)== 0) DMXSerial.write(9, 0);         //DMX 3Green
      // if (mOutput(douche)== 1) DMXSerial.write(9, 255); 
        }
}
}





guyc

unread,
Jan 16, 2017, 5:41:53 PM1/16/17
to souliss

I made some progress. The problem was the way I defined the slots. After reorganizing the slots and increasing the number of slot / node, the outputs were working.
Now I have another problem. As said when I push the buttons, the outputs are going ON and OFF,
but when I read the state of the slots, I always receive "0" even when the output pin is HIGH.

      DigIn(33, Souliss_T1n_ToggleCmd,WC);

      Logic_SimpleLight(WC);
      Serial.print ("WC     ");
      Serial.println(mOutput(WC)); 
      DigOut(13, Souliss_T1n_Coil, WC);

I suppose I have to use the instruction mOutput (slot) to read the status of a slot or aim I wrong ?

Gabriele Ribichini

unread,
Jan 17, 2017, 1:55:39 AM1/17/17
to souliss
Basically you are right.
The only thing I would try is not to write to serial every 50ms with the same input cycle.

I would use a very fast cycle speed for inputs, a 50-100 ms cycle interval for logics but a slow cycle interval for temperature sensor and serial write... Something like 2 seconds.

BR

guyc

unread,
Jan 17, 2017, 6:40:34 PM1/17/17
to souliss

I found the problem.
I decreased the number of nodes to 10 and decrease the  number of slots/node to 41. I did this with adding at the first part of my sketch :

// define max number of slots      (default 45 nodes, 24 slots per node. Aangepast naar 10 nodes, 41 slots/node)
#define VNET_MAX_PAYLOAD_INSKETCH
#define VNET_MAX_PAYLOAD   66
#define MaCaco_NODESIZE_INSKETCH
#define MaCaco_NODES 10 // number of nodes                  
#define MaCaco_SLOT  41 // number of slot /node 


For some reason it doesn't work.
After I did the modification directly in vNetCfg.h and MaCacoCfg.h everything is working. How can do this setup in my sketch ?

Gabriele Ribichini

unread,
Jan 18, 2017, 3:19:43 AM1/18/17
to souliss
Sure,
I use the following define at the top of my sketches:

// Define the souliss network dimensions
#define MaCaco_NODESIZE_INSKETCH
#define MaCaco_NODES 30 // MaCaco_NODES < 255
#define MaCaco_SLOT 40 // MaCaco_SLOT < VNET_MAX_PAYLOAD (def 46) - MaCaco_HEADER (def 5) = 41

Not sure about the PAYLOAD, never changed it.
Message has been deleted

guyc

unread,
Jan 18, 2017, 8:53:09 AM1/18/17
to souliss
Many thanks.
In the beginning it was not working, but you have to put this in the beginning of the sketch before : #include <SPI.h> and #include "Souliss.h"

That was my mistake.

Op woensdag 18 januari 2017 09:19:43 UTC+1 schreef Gabriele Ribichini:

Gabriele Ribichini

unread,
Jan 18, 2017, 9:15:00 AM1/18/17
to souliss
of course before Souliss.h

--
You received this message because you are subscribed to a topic in the Google Groups "souliss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/souliss/5-DMBvmofic/unsubscribe.
To unsubscribe from this group and all its topics, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/souliss/0a842db9-94e5-4df4-9cf7-8b3d1c93f82a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Gabriele Ribichini
mob. +39 329 1920851

Reply all
Reply to author
Forward
0 new messages