DS18B20 + multi relay



  • Hello everyone.

    My setup is Arduino 2560 + Domoticz on Rpi.

    I need for my system a Dallas DS18B20 sketch with multiple relays.
    Sketch should have an option of storage of Dallas addresses.

    After couple of hours searching I found nice sketch on the Internet for my purpose, but there are two issues with it, maybe you will be able to help me with that.

    The first one:
    There is a specific timing, in which temperature is sent by onewire, now set to 10 sec. If I try to set the relay ON or OFF in this specific time, when onewire values are sent to Arduino, Domoticz will see, that I changed something, but this something will not be executed by the Arduino. For example I will click the relay ON at the time, when Arduino reads the values, in Domoticz status will be changed to ON, but the relay actually will stay OFF.

    This is quite important for me to be working, because those relays will be operated by SVT automatically, so I will not be able to check if the relay went ON or OFF.

    The second issue is that I can not (I don't know how) set the child ID's of termometers, which I would like to be starting from 101.

    Below I'm sending you my code:

    https://pastebin.com/xj6h35gC

    Thank you in advance for your help.



  • Edit: The first thing is solved already. I changed sleep to wait in (conversionTime).

    Anyhow I would like to be able to give my DS unique child ID and also a description, so it would be easier to recognize in Domoticz.



  • Don't know much about Domoticz, but most likely you just have to set the name (the address?) as third argument whithin present().
    Perhaps you find some reusable parts in https://github.com/rejoe2/MySensors-Dallas-Address-ChildID-Consistency/blob/master/DallasTemperatureSimple/DallasTemperatureSimple.ino



  • This should give you a description in domoticz: present(0, S_TEMP,"A-DS18S20");

    I dont know about the child id but the unit id will be the same as the number you present them with.

    I dont get the whole scope of your setup but I would just have domoticz control the relays based on whatever calc you do on the temps.



  • Hi
    I have a similar setup but I'm using MCP23017 for the relays wich only takes two pins and it works perfect.
    As to your question about presenting sensors to gateway. Code snippet below is one way to do this I think

    // in my setup ID for tempsensors starts with number of relays plus one
    
    uint8_t RELAY_First_Child_ID = 1;//First relay Child-ID
    uint8_t DS_First_Child_ID = NUMBER_OF_RELAYS + 1; //First Child-ID to be used by Dallas Bus; set this to be higher than number of relays who need EEPROM storage to avoid conflicts
    
    // in YOUR setup ID för trmpsensors could be like below
    
    uint8_t RELAY_First_Child_ID = 1;//First relay Child-ID
    uint8_t DS_First_Child_ID =100; //
    
    //PRESENT TO GATEWAY
    
    void presentation()
    {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Your info", "1.0");
    
      // Register relays to gateway
      
      for (int i = 0; i <= NUMBER_OF_RELAYS-1; i++) {
      present(RELAY_First_Child_ID + i, S_BINARY);// 
    
        delay(200);//uncomment if all relays not being registered correct
      }// end for loop
    
     
    //-----------------------------------------------------------------------------
      // Register temperature sensors to gateway as child devices
      // Fetch the number of attached temperature sensors
      // Present all temperature sensors to controller
      for (int i = 0; i < numberOfDevices; i++) {
        present(DS_First_Child_ID + i, S_TEMP);// in your case first ID=100
        //delay(200);//uncomment if all sensors not being registered correct 
    
      }// end for loop
    
    
    

    Hope this might give you an idea how to. If you want I can give you my sketch doing what you want to accomplish but as I said it's based on MCP23017 to drive relays


Log in to reply
 

Suggested Topics

  • 3
  • 8
  • 1
  • 2
  • 5

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts