Many nodes with simple sketches or less nodes with complex sketches?


  • Hardware Contributor

    Nodes are quite cheap and why not use one node per function? On the other side, you can save many nodes, if you implement multiple functions in one node.

    What do you prefer?

    Why?

    What are the cons and pros?


  • Contest Winner

    I don't look at the amount of sensors on one node. I look at the whole purpose of the node. If multiple sensors are part of a node, like combining temp, humidity and pressure then that is a node.

    If a node only has one specific function then it will contain one sensor. I like to adapt the micro services architecture when creating nodes. I see a node as a functional grouping not as a radio with sensors and actuators.

    The node with the most sensors is my workshop node. It contains a door sensor, a motion sensor, a relay for warning lightning and a temperature sensor. That node is, as you could say, guarding my workshop.

    It is very tempting to combine multiple sensors in one node. But if they don't share a common purpose I don't do it. It keeps simple and flexible.


  • Contest Winner

    I forget to mention the main reason why I have this principle. Whenever one node is down. I only lose that specific function. Losing more functions is worse. For example. If you would create one node with multiple relays attached to it, for controlling the lightning in your living room. Losing that node would mean that you can't control any of the lights. Multiple nodes means that you won't lose all of the lights. Of course you don't want your lamps to be only able to be operated by your home automation system.

    That would be a major design mistake. You wouldn't be able to control your lights anymore if your home automation controller goes down. I always make sure that I'm not to much depending on my home automation. It is meant to make my life easier, not to take it over.



  • @FotoFieber

    @TheoL as a point.

    However once you try it you might start to get into some hardware limitations.

    Smaler arduinos have less memory and pins and you're probably bound to hit one of those.

    I've tried to put all sensors in a sigle skecth. On ardiuno uno its gets about 12 before memory is exausted and you dont have 12 pins available. On a mega memory is fine (about 30 sensors) and you also have plenty of pins.

    Of course you can work around not having enough pins as this example of the irrigation controller

    Cheers


  • Contest Winner

    @barduino Of course you're right. You have to use the arduino that fits the node the best. For a non MySensors arduino project, I'm using a second arduino as an I2C slave to my main controller. That way I can have enough pins and memory. The master Arduino is the controller, the slave is just guarding and controlling the stepper motor in this case. But I wouldn't do that a lot. In this case the ProMini 3.3V is the i2c master and contains the LCD display and triggers an IR led for sending the trigger signal to my Nikon D60. It also tells the second Arduino when it has to move the camera (turn the motor).

    The second Arduino will be a Pro Mini 5.5V, I'm not ready for this part yet. I'll be using a i2c level shifter to connect the arduino's through i2c.



  • Yes depending on the controller (Arduino) you choose will determine the number of sensors or actions a node may support. I will take into consideration if the node can be hidden, or it needs to be small and/or presentable where it is going to be located. This may effect your choices for the controller.

    I will also look at the tasks I'm trying to accomplish for a given objective. Some tasks like knowing if a door or window is open or closed and a motion sensor may not play well with each other in a node.

    Determine if it is going to be using batteries or get power from my house curcit (for example via a wall wart). When determining the power source I will look at the tasks I have defined. One of the tasks could determine if you are able to resonable use batteries to power it. For example a task like knowing if a door or window is open or closed most likely will not be run on batteries.

    If using a battery you should put your controller and radio to sleep as long and often as you can. If you have to use a small controller then the number of interrupts available will be limited and most likely be one. Some tasks will use an interrupt to override the sleep timer, for example a motion sensor. If more then one task (like a motion sensor) needs an interrupt and you are using a small controller you will need to split it up to more then one node or redefine your objective.

    These are just some thoughts I have been running with for now. Any other persectives are greatly appreciated. There are several of you that have a lot more experience with this adventure then I do.


Log in to reply
 

Suggested Topics

  • 4
  • 2
  • 2
  • 9
  • 9
  • 3

7
Online

11.4k
Users

11.1k
Topics

112.7k
Posts