Can one arduino present multiple devices?



  • I have a plant sensor arduino.

    It presents 6 capacitive sensors.
    It presents 6 dimmers that indicate the level at which each plant should receive more water.

    A device with 12 children, that's a bit messy.

    Ideally I'd like to help a controller see the arduino as 6 separate devices that each have a sensor a dimmer.

    Is that possible?



  • Hi, if you upload your code then it would be easier to understand.
    Don't forget to use </> when you upload it, thanks


  • Mod

    @alowhum could you clarify why it becomes messy?
    To my knowledge, there is no way to report multiple node ids without very intrusive hacks into the core functions. All routing is dependent on nodes having a single node id.



  • What controller are you using?



  • @mfalkvidd Thanks, that answers my question.

    @flopp Here's an example of my present function:

    void presentation()
    {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo(F("Plant Sensorium"), F("1.2"));
    
      // Present the sensors
      //for (byte i=0; i<NUMBER_OF_SENSORS*2 ; i=i+2) {
        present(0, S_MOISTURE, "1");  delay(RF_DELAY);       // present all the sensors
        present(1, S_DIMMER, "1");  delay(RF_DELAY);       // present the dimmers to set the level with.
        present(2, S_MOISTURE, "2");  delay(RF_DELAY);       // present all the sensors
        present(3, S_DIMMER, "2");  delay(RF_DELAY);       // present the dimmers to set the level with.
        present(4, S_MOISTURE, "3");  delay(RF_DELAY);       // present all the sensors
        present(5, S_DIMMER, "3");  delay(RF_DELAY);       // present the dimmers to set the level with.
        present(6, S_MOISTURE, "4");  delay(RF_DELAY);       // present all the sensors
        present(7, S_DIMMER, "4");  delay(RF_DELAY);       // present the dimmers to set the level with.
        present(8, S_MOISTURE, "5");  delay(RF_DELAY);       // present all the sensors
        present(9, S_DIMMER, "5");  delay(RF_DELAY);       // present the dimmers to set the level with.
        present(10, S_MOISTURE, "6");  delay(RF_DELAY);       // present all the sensors
        present(11, S_DIMMER, "6");  delay(RF_DELAY);       // present the dimmers to set the level with.
      //}
    
    }
    

    I use Domoticz and intend to use Mozilla Gateway. But it shouldn't matter what controller I use really.



  • @alowhum most of the time it is the other way round that there are not enough input pins on the arduino to connect all sensors.
    I never had an issue with childs and what is the difference on controller side?



  • @alowhum, Domoticz can't handle this well. I don't know about other controllers but Domoticz is a bit quirky with multiple sensors of the same kind on the same node. Especially HUM en TEMP are a pain.

    I "solved" this by using Node-Red in between the GW and Domoticz. Then you have all the freedom you want.



  • @gerard-van-seventer One year, one Node, 12 sensors, send Temp every 5 minutes, Domoticz, never skipped a beat. Quirky ?



  • @mfalkvidd I don't mind that MySensors uses one node I per device "under the hood". But perhaps the gateway could present the one device as 6 separate devices to the controller? And when it gets requests for one of those 6 devices, it just merges things back?

    @Gerard-van-Seventer I have also not had any problems with Domoticz receiving data. I send data only once per second (so sending data for 6 sensors takes 6 seconds).



  • @alowhum { I don't mind that MySensors uses one node I per device "under the hood". But perhaps the gateway could present the one device as 6 separate devices to the controller? And when it gets requests for one of those 6 devices, it just merges things back?}
    I really look forward to you developing this concept further with a proven working mechanism, but until your solution is revealed, I guess I don't mind either, the multiple devices per node "on the roof" via a dumb gateway are working just fine, leaving the Controller to do the smart stuff. 😉



  • @zboblamont But I want to help the controller understand the complexity of the device it's talking to. Right now it is told this:

    PARENT

    • child
    • child
    • child
    • child
    • child

    All I'm asking us to explore is adding another level:

    PARENT

    • Group
      • child
      • child
    • Group
      • child
      • child
      • child

    I think it would be very useful.

    • Devices like NRF52 are getting more powerful and have more pins. This may make people want to integrate devices into one hardware form. A thermostat with a BME280 could at the same time present a weather station. A smart clock could at the same time present a security motion sensor. A plant irrigation sensor could at the same time present an air quality sensor.
    • It would be more user friendly. It's nice if you can tell the controller how to initially set up the interface for the user, instead of just dumping all the children on them and going "Ask the user to sort and group this stuff". Controllers tend to think in devices, and accept and represent them as such (with Domoticz being an exception).


  • @alowhum But that is where you are confusing matters when you refer to the Gateway in some role of PRE-controller to make up for a perceived inadequacy in the selected Controller.
    From the Node to the Controller the Gateway is a simple access point for various pathways no matter how complex or simple the Node or Controller functionality.
    Likewise your first example quotes a thermostat and BME280 as if each has some inherent capability to communicate as a Node, despite prior mention of the NRF52 to which they would normally be connected, which Node would then communicate the individual data streams to the Controller.

    How these individual streams are treated at the Controller are down to the User's selected Controller and how it is configured, adding complexity anywhere else in the pipeline doesn't make it more user friendly at all.



  • @zboblamont I have to agree to this.
    With OpenHAB, every child is more or less treated as an individual device (item). No matter if there is one or 100 connected to one arduino.
    On the other hand, I do not think that more powerful devices will change dramatically. I think with sensor networks, decentralization and loose coupling with a gateway which just translates it into a common language is what is key. Putting additional intelligence into the nodes or gateways is not what I would expect and want.
    I am running a lot on mySensors. But I also do have other brands deplyed. It is quite easy to exchange one against the other. The logic and intelligence is in the controller which makes it most flexible.



  • @zboblamont @parachutesj Thanks! Good to hear your perspectives.


 

319
Online

8.0k
Users

8.8k
Topics

94.3k
Posts