Dallas DS18B20 Parasite Mode



  • Hi there,

    I have an existing One Wire network with 10 sensors connected. When I set them up I used Parasite Mode.

    I am having some difficulty trying to get the MySensors Dallas Sketch to read the sensors. Has anyone got any tips on changes required to read the sensors in Parasite Mode. The Network was read by a Raspberry Pi but I want to migrate to a Arduino and Mysensors, so I can fire the results via my newly set-up MQTT Gateway to OpenHab.

    To change the my network would require a complete rewire so please don't suggest that!!

    Look forward to any tips.

    cheers,

    Ally


  • Admin

    @Ally-Smith

    Can you test parts of the OneWire network to see when it fails?



  • Perhaps I have not been clear enough. The one wire network works perfect;y well. I am having problems connecting that to the arduino and reading it via the MySensors Dallas sketch. I have set up small test with one DS sensor in parasite mode and this is not read either by the same sketch.

    When I use the standard One Wire example DS sketch it reads the sensor in parasite mode OK. So I am looking for some help how to reconfigure the MySensors Dallas sketch so it can read a Dallas DS in parasite mode.

    Hope you can assist.


  • Admin

    If you manage to read the temperatures using "the standard One Wire example DS sketch" then do.

    If you look at the provided example it just does presentation and send in temperatures for each sensor.



  • Thanks - Will give it a go. Just kind of hoped someone might have had the same issue and there was a simple solution that I was missing.


  • Admin

    @Ally-Smith

    one thought.. Are you using the same pin on the arduino for DS1820 network, in both sketches?



  • Using digital pin 3 on both sketches for the data pin from the Dallas DS.



  • Hello, sorry about loaning this question but...

    I have similar network than original writer and mine works fine. Only problem is that I want to make child id for every sensors and I just cant figure it out how to? I have already checked addresses of sensors but how can I address these in different id's.

    Sorry about my english but hopefully somebody understood my question.



  • @kapperi From the Temperature Sensor sketch on the 'build' page:

    // Present all sensors to controller
    for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
    gw.present(i, S_TEMP);
    }

    This should create child devices of each dallas sensor.



  • Yes it does, but I tried to ask that how can I define known sensor address to specific child_id. Or does the sketch always put same sensor to same child_id?



  • @kapperi I do not know exactly. I assume the child ids are assigned in the same order as the Dallas sensors are called, likely in numerical order.


  • Hero Member

    like @Dwalt said, the child_id's are numbered the same as the dallas sensor addresses.

    gw.send(msg.setSensor(i).set(temperature,1));
    


  • @AWI But this does lead to another kind of problem. If I want to add another sensor to net and its address is between two another sensors, the sketch will change child_ids to new order.

    In the controller head it means that controller thinks that child_id is same sensor and charts gets confused..

    This means too that i cannot put sensors one by one.

    How should I do this so I can say for real that my sensor one is in livingroom and three sensors are in different bedrooms and so on...

    It was easy when I had plaine arduino and lcd witch showed temps one by one...



  • @kapperi If you add another sensor node to your network, the original node and child id#s will not be affected. The Controller does not reorder the individual Dallas sensors because it never knows their serial numbers, the controller will only know them by their assigned child ids when they are first included. If you, however, add more Dallas sensors to an existing node (hardwired) it could confuse the controller. In that case it would be best to delete the node and re-introduce the node and all its children to the controller.


  • Hero Member

    @kapperi There is no real problem IMHO with adding another layer of abstraction.
    just add an array

    int child_ids[] = {1, 2, 4, 3};
    

    and in the sketch use:

    gw_present(child_ids[i], S_TEMP);
    .
    .
    .
    .
    gw_send(msg.setSensor(child_ids[i])....);
    

    (code is unchecked but you should get the gist of it)
    The child ids are logical so you can set whatever you like as long as you are consistent in using it. You might have to delete the node and re-include it to get it to work right the first time you change things around.



  • @Dwalt sorry I meant that if I add another sensor in same node.

    Thats the problem, I wanted to hardcode the sensors address to specific child_id so that it can never change.

    @Moshe-Livne I didn't understand what thats supposed to do?



  • Okey, after reading the different examles, I realized that it is pretty easy to hardcode sensors addresses to specific node_ids but if I do it my way, I have to send and fetch temperatures one by one. I´ll prefer if it can be done in same sentence...

    I have tested my setup again, and still can´t get any order to child_ids. If i put sensors to node one by one, I can name the child_id in the controller, but as soon as I put third sensor it will steal the first sensors place.

    But best is to put every sensors at the same time so the child_ids remain the same all the time, only problem is that I can´t know which sensors is which.


  • Hero Member

    @kapperi this code is supposed to attach a specific child id (the numbers in the array) to a specific order of sensor discovery. so, if your order gets mixed up you can still sort it out. its not the best solution but if this is not a very common problem and you do not add and remove sensors all the time it should solve your problem.



  • I had to use a smaller pull up resistor (2.2k) to make my system work.


Log in to reply
 

Suggested Topics

  • 87
  • 3
  • 5
  • 2
  • 5
  • 10

37
Online

11.4k
Users

11.1k
Topics

112.6k
Posts