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. My Project
  3. [example] GPS Sensor

[example] GPS Sensor

Scheduled Pinned Locked Moved My Project
gpsexample
18 Posts 8 Posters 14.2k Views 6 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 hek

    Ok, my GPS sensor had been collecting dust in the drawer too long so I decided to create a MySensors example on how you could incorporate position data in a MySensors powered home automation setup.

    I've used the GY-NEO6MV2 module containing a Ublox GPS which communicates serially with the Arduino.

    So what should we use this for in a HA setup you might ask? Well the amount of use cases aren't exactly overwhelming but here are a few:

    1. Attach it to your robot lawn mower to get a notification when it has stuck somewhere.
    2. Build a gps tracked pet collar (preferably using the HW RF69 module for long range operation). Used for geo fencing the dog to get a notification when it runs away. Or why not use it while hunting?
    3. The GPS gives a very accurate (atomic) time information which can be used in the rest of your HA setup.

    The (new) message type sent to controller contains latitude, longitude and altitude information.

    Wiring it up is very simple:
    gps.jpg

    3v3 or 5V to VCC
    GND to GND
    A0 to TX

    You can of course change the A0 pin to something else in the code.

    And here comes the example code. Note that this code only runs on the development branch. Codebender does not host this branch yet so you'll have to build it locally on your computer in the IDE:
    https://codebender.cc/sketch:182035

    The module can be found here:
    http://www.ebay.com/itm/390647042336?rmvSB=true
    or
    http://www.aliexpress.com/item/2pcs-lot-GY-NEO6MV2-new-GPS-module-with-Flight-Control-Flight-Control-EEPROM-MWC-APM2-5/1811853522.html

    Output from Serial Monitor

    send: 2-2-0-0 s=255,c=0,t=17,pt=0,l=10,sg=0,st=ok:1.6.0-beta
    send: 2-2-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    sensor started, id=2, parent=0, distance=1
    Position: 55.722511;13.018091;12
    send: 2-2-0-0 s=1,c=1,t=49,pt=0,l=22,sg=0,st=ok:55.722511;13.018091;12
    GPS Time: 11/08/2015 22:59:11
    Position: 55.722527;13.018097;13
    send: 2-2-0-0 s=1,c=1,t=49,pt=0,l=22,sg=0,st=ok:55.722527;13.018097;13
    
    RJ_MakeR Offline
    RJ_MakeR Offline
    RJ_Make
    Hero Member
    wrote on last edited by
    #2

    @hek whats up with that NORDIC board?

    RJ_Make

    hekH 1 Reply Last reply
    0
    • RJ_MakeR RJ_Make

      @hek whats up with that NORDIC board?

      hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #3

      @ServiceXp

      Ah.. it's a Nordic Uno shield I've had for a long time. It came with some dev-kit for the NRF-board. Use it sometimes when prototyping.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        betonishard
        wrote on last edited by
        #4

        Nice example!!!

        What I was thinking of, is can it also be a part of the gateway (GPS gateway). In that way things such as(just an example could also be connected to mysensors):

        http://www.safewise.com/blog/10-wearable-safety-gps-devices-kids/

        1 Reply Last reply
        0
        • mrc-coreM Offline
          mrc-coreM Offline
          mrc-core
          wrote on last edited by
          #5

          hi. trying to use the code but i'm getting problems with this line "MyMessage msg(CHILD_ID_GPS, V_POSITION);"

          sketch_nov15a:68: error: 'V_POSITION' was not declared in this scope
          sketch_nov15a.ino: In function 'void present()':
          sketch_nov15a:93: error: 'sendSketchInfo' was not declared in this scope
          sketch_nov15a:96: error: 'S_GPS' was not declared in this scope
          sketch_nov15a.ino: In function 'void loop()':
          sketch_nov15a:125: error: 'send' was not declared in this scope
          'V_POSITION' was not declared in this scope

          Not getting this to work at all

          1 Reply Last reply
          0
          • hekH Offline
            hekH Offline
            hek
            Admin
            wrote on last edited by
            #6

            @mrc-core

            V_POSITION and S_GPS is only defined in the development branch.

            https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/core/MyMessage.h#L85

            1 Reply Last reply
            0
            • mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by
              #7

              Yes, V_POSITION is not present, not even in the MySensors development branch. Do you have some unpushed code @hek ?

              1 Reply Last reply
              0
              • hekH Offline
                hekH Offline
                hek
                Admin
                wrote on last edited by
                #8

                https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/core/MyMessage.h#L146

                ;)

                1 Reply Last reply
                0
                • mfalkviddM Offline
                  mfalkviddM Offline
                  mfalkvidd
                  Mod
                  wrote on last edited by mfalkvidd
                  #9

                  Thanks. I was pulling my own development branch instead of MySensor's :flushed: No wonder nothing had happened in a few days...

                  1 Reply Last reply
                  1
                  • mrc-coreM Offline
                    mrc-coreM Offline
                    mrc-core
                    wrote on last edited by
                    #10

                    had to insert in the code "MySensor gw;" and some "gw." at sendSketchInfo and present to stop the errors, flash the code to arduino nano but no info at monitor serie or at domoticz gateway can't seem to find the gps...

                    No understanding the new problem...

                    1 Reply Last reply
                    0
                    • hekH Offline
                      hekH Offline
                      hek
                      Admin
                      wrote on last edited by
                      #11

                      The new S_GPS/V_POSITION is only 7 days old.

                      I doubt @GizMoCuz has had time to implement support for it in Domoticz.

                      You should use the development branch like I mentioned above to make it compile out of the box.

                      1 Reply Last reply
                      0
                      • mrc-coreM Offline
                        mrc-coreM Offline
                        mrc-core
                        wrote on last edited by
                        #12

                        @hek said:

                        development branch

                        Thanks for the quick replay. Gona try the development branch. Once again thnaks

                        1 Reply Last reply
                        0
                        • hekH hek

                          Ok, my GPS sensor had been collecting dust in the drawer too long so I decided to create a MySensors example on how you could incorporate position data in a MySensors powered home automation setup.

                          I've used the GY-NEO6MV2 module containing a Ublox GPS which communicates serially with the Arduino.

                          So what should we use this for in a HA setup you might ask? Well the amount of use cases aren't exactly overwhelming but here are a few:

                          1. Attach it to your robot lawn mower to get a notification when it has stuck somewhere.
                          2. Build a gps tracked pet collar (preferably using the HW RF69 module for long range operation). Used for geo fencing the dog to get a notification when it runs away. Or why not use it while hunting?
                          3. The GPS gives a very accurate (atomic) time information which can be used in the rest of your HA setup.

                          The (new) message type sent to controller contains latitude, longitude and altitude information.

                          Wiring it up is very simple:
                          gps.jpg

                          3v3 or 5V to VCC
                          GND to GND
                          A0 to TX

                          You can of course change the A0 pin to something else in the code.

                          And here comes the example code. Note that this code only runs on the development branch. Codebender does not host this branch yet so you'll have to build it locally on your computer in the IDE:
                          https://codebender.cc/sketch:182035

                          The module can be found here:
                          http://www.ebay.com/itm/390647042336?rmvSB=true
                          or
                          http://www.aliexpress.com/item/2pcs-lot-GY-NEO6MV2-new-GPS-module-with-Flight-Control-Flight-Control-EEPROM-MWC-APM2-5/1811853522.html

                          Output from Serial Monitor

                          send: 2-2-0-0 s=255,c=0,t=17,pt=0,l=10,sg=0,st=ok:1.6.0-beta
                          send: 2-2-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
                          sensor started, id=2, parent=0, distance=1
                          Position: 55.722511;13.018091;12
                          send: 2-2-0-0 s=1,c=1,t=49,pt=0,l=22,sg=0,st=ok:55.722511;13.018091;12
                          GPS Time: 11/08/2015 22:59:11
                          Position: 55.722527;13.018097;13
                          send: 2-2-0-0 s=1,c=1,t=49,pt=0,l=22,sg=0,st=ok:55.722527;13.018097;13
                          
                          Pierre PP Offline
                          Pierre PP Offline
                          Pierre P
                          wrote on last edited by
                          #13

                          @hek said:

                          1. Attach it to your robot lawn mower to get a notification when it has stuck somewhere.
                          1. Build a gps tracked pet collar (preferably using the HW RF69 module for long range operation). Used for geo fencing the dog to get a notification when it runs away. Or why not use it while hunting?

                          I'm in. For the mower.
                          For the radio, the lower frequency the better. But, we need a new gateway no ?
                          Or there is a trick, like a repeater node with two radio of different frequency ?

                          No quote, no forum notification (else, the mail box ring every minutes !). Thanks, and have a very good MySensors day !

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            drock1985
                            wrote on last edited by
                            #14

                            Hey @Pierre-P

                            Yeah, you would need a new gateway for each radio type.

                            My Projects
                            2 Door Chime Sensor
                            Washing Machine Monitor

                            1 Reply Last reply
                            0
                            • f.mathieuF Offline
                              f.mathieuF Offline
                              f.mathieu
                              wrote on last edited by
                              #15

                              Hi Guys,

                              new in this forum. really interresting project :-)

                              trid to follow your recommendations, but still have S_GPS error... do you have any developpment since the last message ?

                              i added the declared ligne in the MyMessage.h file, V_POSITION, but saw the S_GPS vairiable in the file.

                              what will need more ?

                              regards,

                              Franck

                              1 Reply Last reply
                              0
                              • hekH Offline
                                hekH Offline
                                hek
                                Admin
                                wrote on last edited by
                                #16

                                @f-mathieu

                                Use this version
                                https://github.com/mysensors/Arduino/archive/development.zip

                                1 Reply Last reply
                                0
                                • f.mathieuF Offline
                                  f.mathieuF Offline
                                  f.mathieu
                                  wrote on last edited by
                                  #17

                                  @hek said:

                                  ode only runs on the development branch. Codebender does not host this branch yet so you'll have to build it locally on your computer in the IDE:

                                  Thanks Hek for your fast answer. now i can compile it, but i have a radio init failed...

                                  any idea ?

                                  Pierre PP 1 Reply Last reply
                                  0
                                  • f.mathieuF f.mathieu

                                    @hek said:

                                    ode only runs on the development branch. Codebender does not host this branch yet so you'll have to build it locally on your computer in the IDE:

                                    Thanks Hek for your fast answer. now i can compile it, but i have a radio init failed...

                                    any idea ?

                                    Pierre PP Offline
                                    Pierre PP Offline
                                    Pierre P
                                    wrote on last edited by
                                    #18

                                    @drock1985 said:

                                    Hey @Pierre-P

                                    Yeah, you would need a new gateway for each radio type.

                                    I found a new mysensors page ! here:
                                    https://www.mysensors.org/download/sensor_api_15#create-repeating-nodes

                                    Advanced initialization

                                    It's also possible to construct an instance with RFM69 radio driver and/or enable signing support. You can choose one of the following radio drivers:

                                    MyTransportNRF24 transport(RF24_CE_PIN, RF24_CS_PIN, RF24_PA_LEVEL_GW);
                                    

                                    or

                                    MyTransportRFM69 transport(RFM69_FREQUENCY, RFM69_NETWORKID, RF69_SPI_CS, RF69_IRQ_PIN, isRFM69HW, RF69_IRQ_NUM);
                                    

                                    No quote, no forum notification (else, the mail box ring every minutes !). Thanks, and have a very good MySensors day !

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


                                    13

                                    Online

                                    11.7k

                                    Users

                                    11.2k

                                    Topics

                                    113.1k

                                    Posts


                                    Copyright 2025 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