Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Combining MySensors examples

Combining MySensors examples

Scheduled Pinned Locked Moved Development
12 Posts 10 Posters 19.7k Views 12 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • hekH Offline
    hekH Offline
    hek
    Admin
    wrote on last edited by
    #1

    Found this excellent guide on how to combine MySensors sketches.
    http://www.makeuseof.com/tag/diy-smart-home-sensors-arduino-mysensors-openhab/

    https://www.youtube.com/watch?time_continue=15&v=8qIWPyAJuf4

    YveauxY S 2 Replies Last reply
    5
    • hekH hek

      Found this excellent guide on how to combine MySensors sketches.
      http://www.makeuseof.com/tag/diy-smart-home-sensors-arduino-mysensors-openhab/

      https://www.youtube.com/watch?time_continue=15&v=8qIWPyAJuf4

      YveauxY Offline
      YveauxY Offline
      Yveaux
      Mod
      wrote on last edited by
      #2

      @hek Yay, spreading the word! :satisfied:

      http://yveaux.blogspot.nl

      1 Reply Last reply
      0
      • hekH hek

        Found this excellent guide on how to combine MySensors sketches.
        http://www.makeuseof.com/tag/diy-smart-home-sensors-arduino-mysensors-openhab/

        https://www.youtube.com/watch?time_continue=15&v=8qIWPyAJuf4

        S Offline
        S Offline
        Samuel235
        Hardware Contributor
        wrote on last edited by
        #3

        @hek STICKY STICKY STICKY!

        This is actually one of the first sticking points i had when i migrated over to MySensors.org. Now thanks to this tutorial i hope that others don't get my confusion of how to combine multiple sensor array within one node. I'm sure you're going to get many thanks for spreading this!

        MySensors 2.1.1
        Controller - OpenHAB (Virtual Machine)
        Gateway - Arduino Mega MQTT Gateway W5100

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mihai
          wrote on last edited by
          #4

          Hi,
          I have also developed multi-sensor nodes based on MySensors 1.5, they works fine on the table, few more details here: http://forum.mysensors.org/topic/2747/home-automation-multi-sensor-nodes
          The 1.6 version will follow soon, I hope.

          1 Reply Last reply
          1
          • M Offline
            M Offline
            Mihai
            wrote on last edited by
            #5

            I have updated my project. While still under testing, now it use MySensors 2.0.0 beta , external MQTT and tested examples of sensors on the gateway.

            1 Reply Last reply
            1
            • lrtsenarL Offline
              lrtsenarL Offline
              lrtsenar
              wrote on last edited by lrtsenar
              #6

              Hello,

              Sorry but I've already done the job here :
              Please have a look at "RelayActuatorLrt.ino" in order to know how to use it, it's simple.

              [https://forum.mysensors.org/topic/2537/device-library](link url)

              Is it possible to integrate it in a future release of MySensors ?

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bluezr1
                wrote on last edited by
                #7

                hek,

                Would it be possible if you could make a new video that's more up to date? I know that this could be asking a lot but I tried multiple times to combine sketches/examples to no avail. I presently have nodes next to each other that I would love to be able to combine them together. Also, possibly adding in how to add two of the same examples, for example two door/window sensors?

                I really want to get a grasp on this and have been reading a lot but unfortunately I’m still missing something.

                Either way thanks you for your video. Even though I haven’t been able to get anything working I now have a better understanding of what needs to be done.

                H sinczeS K 3 Replies Last reply
                1
                • B bluezr1

                  hek,

                  Would it be possible if you could make a new video that's more up to date? I know that this could be asking a lot but I tried multiple times to combine sketches/examples to no avail. I presently have nodes next to each other that I would love to be able to combine them together. Also, possibly adding in how to add two of the same examples, for example two door/window sensors?

                  I really want to get a grasp on this and have been reading a lot but unfortunately I’m still missing something.

                  Either way thanks you for your video. Even though I haven’t been able to get anything working I now have a better understanding of what needs to be done.

                  H Offline
                  H Offline
                  hoggin
                  wrote on last edited by
                  #8

                  I too am interested in this.
                  @bluezr1

                  1 Reply Last reply
                  0
                  • B bluezr1

                    hek,

                    Would it be possible if you could make a new video that's more up to date? I know that this could be asking a lot but I tried multiple times to combine sketches/examples to no avail. I presently have nodes next to each other that I would love to be able to combine them together. Also, possibly adding in how to add two of the same examples, for example two door/window sensors?

                    I really want to get a grasp on this and have been reading a lot but unfortunately I’m still missing something.

                    Either way thanks you for your video. Even though I haven’t been able to get anything working I now have a better understanding of what needs to be done.

                    sinczeS Offline
                    sinczeS Offline
                    sincze
                    MySensors Evangelist
                    wrote on last edited by
                    #9

                    @bluezr1 I can imagine your struggle. Have had my fair share as well. The following code is running stable and has around 9 sensors it is serving. Maybe you can grab the pieces you need for your nodes. Unfortunately did not make a video.

                    1 Reply Last reply
                    0
                    • B bluezr1

                      hek,

                      Would it be possible if you could make a new video that's more up to date? I know that this could be asking a lot but I tried multiple times to combine sketches/examples to no avail. I presently have nodes next to each other that I would love to be able to combine them together. Also, possibly adding in how to add two of the same examples, for example two door/window sensors?

                      I really want to get a grasp on this and have been reading a lot but unfortunately I’m still missing something.

                      Either way thanks you for your video. Even though I haven’t been able to get anything working I now have a better understanding of what needs to be done.

                      K Offline
                      K Offline
                      kimot
                      wrote on last edited by
                      #10

                      @bluezr1
                      Do you see "MockMySensors" example sketch which comes with MySensors library?
                      There are all sensors in one sketch together.
                      Presentation, sending its values, receiving ....

                      sinczeS 1 Reply Last reply
                      2
                      • K kimot

                        @bluezr1
                        Do you see "MockMySensors" example sketch which comes with MySensors library?
                        There are all sensors in one sketch together.
                        Presentation, sending its values, receiving ....

                        sinczeS Offline
                        sinczeS Offline
                        sincze
                        MySensors Evangelist
                        wrote on last edited by
                        #11

                        @kimot said in Combining MySensors examples:

                        MockMySensors

                        Haha tnx glad I learned something today. Did not know about this example ;-)

                        1 Reply Last reply
                        1
                        • TRS-80T Offline
                          TRS-80T Offline
                          TRS-80
                          wrote on last edited by TRS-80
                          #12

                          Video in OP was good for "beginner" but you very quickly run into other issues. For me it was getting confused by lots of talk about interrupts (in relation to "input" type sensors). All of Build pages for these type of sensors mention about interrupts only being available on pins 2 and 3 (assuming Arduino Pro Mini, etc.). Which only confused me further (at first). However maybe you are smarter than me. ;) But look closely, most (all?) of MySensors code I have seen for "inputs" (door, motion, etc.) actually DO NOT use interrupts! Notice the code runs right in the main loop. Interrupts are only needed when you sleep the node!

                          Everything I talk about here is for always powered nodes, where you do not need to sleep because you are not on batteries. For batteries you need to sleep to save power, and then we have to do things different. Then you will need to use the hardware interrupts, to wake the node from sleeping. But that I will call "advanced" and beyond the scope of this particular post here, which I am calling "intermediate". So, back to that...

                          You can use any pin you want (almost) for inputs when you are not sleeping the node. OP video does mention about non blocking code, but he does not go into detail. I don't know why not, as it is not complicated. You simply do wait() instead of sleep(). Or, if you are combining one or more thing(s) that needs to "listen" all the time (lets say, an actuator/relay, and for fun let's add a motion sensor, too!), with something that needs to send() periodically (let's say a temperature sensor) then you just keep looping over and over checking all your inputs, and then only enter the output (temperature) part of the code every so many millis(). An example:

                          void loop()     
                          {
                            // put code here to check motion sensor (copy from loop() part of motion sensor sketch)
                          
                            // now we check if enough time has passed to check temperature, if so we enter this subroutine
                            if ( millis() > millisLastTemperature + TEMPERATURE_CHECK_INTERVAL )
                              {
                              // put code here to check temperature sensor(s)
                          
                              // Right before we exit temperature subroutine, note current time as last time temperature was sent.
                              millisLastTemperature = millis();
                              }
                          
                          // That's it for main loop()
                          }
                          
                          // the relay needs code to receive incoming messages
                          void receive(const MyMessage &message)
                          {
                            // Put code here from receive() part of relay sketch
                          }
                          

                          Doing this way, you could even combine multiple sensors (temperature, humidity, light, etc.) to take readings even on different intervals. Just duplicate that subroutine, and give each one their own <SENSOR>_CHECK_INTERVAL variable. Just remember to define all your variables at the top of the sketch, and when dealing with millis() you want to use data type of unsigned long.

                          Speaking of which, I think you also must have some very basic programming or even logical skills. But there is a lot of information in Internet nowadays, so hopefully you can study and teach yourself enough to get by.

                          Good luck, and don't hesitate to post if you run into trouble. Don't suffer along in silence and then give up, without saying anything to anyone. Ask me how I know. ;)

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          14

                          Online

                          11.7k

                          Users

                          11.2k

                          Topics

                          113.0k

                          Posts


                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • MySensors
                          • OpenHardware.io
                          • Categories
                          • Recent
                          • Tags
                          • Popular