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. Gateway just another sensor node?

Gateway just another sensor node?

Scheduled Pinned Locked Moved Development
11 Posts 5 Posters 3.2k Views 5 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.
  • gohanG Offline
    gohanG Offline
    gohan
    Mod
    wrote on last edited by
    #2

    I think the code is missing the send command for the voltage. Also include a little longer serial output. Did you check with myscontroller if actually no values are sent?

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

      Use wait(), never delay().

      A 1 Reply Last reply
      0
      • A Offline
        A Offline
        Akkarin
        wrote on last edited by
        #4

        i'm trying to send the R0 value which is calculated from voltage

        for(int x = 0 ; x < 100 ; x++)
        {
          sensorValue = sensorValue + analogRead(A0);
        }
        sensorValue = sensorValue/100.0;
        /*-----------------------------------------------*/
        
        sensor_volt = sensorValue/1024*5.0;
        RS_air = (5.0-sensor_volt)/sensor_volt; // omit *RL
        R0 = RS_air/9.9; // The ratio of RS/R0 is 9.9 in LPG gas
        
        1 Reply Last reply
        0
        • gohanG Offline
          gohanG Offline
          gohan
          Mod
          wrote on last edited by
          #5

          OK, but you need to post complete code that gives problem and longer serial output

          A 1 Reply Last reply
          0
          • hekH hek

            Use wait(), never delay().

            A Offline
            A Offline
            Akkarin
            wrote on last edited by
            #6

            @hek
            i've changed delay to wait, but the behaviour is still the same. Seems like "my" serial output in the loop is overwritten by the "debug" serial output.
            It is somehow related to the send command and usage of gateway as a sensor, but i don't get whats wrong :confused:

            1 Reply Last reply
            0
            • gohanG gohan

              OK, but you need to post complete code that gives problem and longer serial output

              A Offline
              A Offline
              Akkarin
              wrote on last edited by
              #7

              @gohan
              the code was complete in the first post (now its only "wait" instead of "delay" in the end).

              Here is a longer serial output for active "send command":
              0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.1.1
              IP: 192.168.0.151
              0;255;3;0;9;MCO:BGN:STP
              0;255;3;0;9;MCO:REG:NOT NEEDED
              0;255;3;0;9;MCO:BGN:INIT OK,TSP=NA
              sensor_volt = 0.0;0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.1.1
              IP: 192.168.0.151
              0;255;3;0;9;MCO:BGN:STP
              0;255;3;0;9;MCO:REG:NOT NEEDED
              0;255;3;0;9;MCO:BGN:INIT OK,TSP=NA
              sensor_volt = 0.0;0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.1.1
              0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.1.1
              IP: 192.168.0.151
              0;255;3;0;9;MCO:BGN:STP
              0;255;3;0;9;MCO:REG:NOT NEEDED
              0;255;3;0;9;MCO:BGN:INIT OK,TSP=NA
              sensor_volt = 0.0;0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.1.1
              IP: 192.168.0.151
              0;255;3;0;9;MCO:BGN:STP
              0;255;3;0;9;MCO:REG:NOT NEEDED
              0;255;3;0;9;MCO:BGN:INIT OK,TSP=NA
              sensor_volt = 0.0;0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.1.1
              0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.1.1
              IP: 192.168.0.151
              0;255;3;0;9;MCO:BGN:STP
              0;255;3;0;9;MCO:REG:NOT NEEDED
              0;255;3;0;9;MCO:BGN:INIT OK,TSP=NA
              sensor_volt = 0.0;0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.1.1
              IP: 192.168.0.151
              0;255;3;0;9;MCO:BGN:STP
              0;255;3;0;9;MCO:REG:NOT NEEDED
              0;255;3;0;9;MCO:BGN:INIT OK,TSP=NA
              sensor_volt = 0.0;0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.1.1
              ...

              And here is how its look like if send command is commented:
              0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.1.1
              IP: 192.168.0.151
              0;255;3;0;9;MCO:BGN:STP
              0;255;3;0;9;MCO:REG:NOT NEEDED
              0;255;3;0;9;MCO:BGN:INIT OK,TSP=NA
              sensor_volt = 0.05V
              R0 = 10.84
              sensor_volt = 0.05V
              R0 = 10.83
              sensor_volt = 0.05V
              R0 = 10.83

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

                You cannot print your own debug messages on a serial gateway as it is the mean of communication against the gateway. The controller will try to interpret your prints according to the serial protocol.

                core_cC 1 Reply Last reply
                0
                • Michiel van der WulpM Offline
                  Michiel van der WulpM Offline
                  Michiel van der Wulp
                  wrote on last edited by
                  #9

                  Please check if you are not having resets in your gateway due to this:

                  https://forum.mysensors.org/topic/4462/gatewayw5100-unable-to-get-working-w-v2-0-0

                  https://forum.mysensors.org/topic/4680/mysensors-2-0-ethernet-gateway-atmega-w5100-restart-all-time/6

                  Regards,
                  Michiel

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    Akkarin
                    wrote on last edited by
                    #10

                    @Michiel-van-der-Wulp and @hek
                    Guys, thank you for fast help. Both answers helped me to solve the problem!

                    1 Reply Last reply
                    1
                    • hekH hek

                      You cannot print your own debug messages on a serial gateway as it is the mean of communication against the gateway. The controller will try to interpret your prints according to the serial protocol.

                      core_cC Offline
                      core_cC Offline
                      core_c
                      wrote on last edited by
                      #11

                      @hek I found that out while testing my very first/current gateway. Also, it is no good idea to define MY_DISABLED_SERIAL. (sssst, don't tell anyone i did that).
                      ..but still, it's assuring to have my findings confirmed by an expert.

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


                      24

                      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