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. Troubleshooting
  3. serial reading

serial reading

Scheduled Pinned Locked Moved Troubleshooting
34 Posts 5 Posters 16.7k Views 2 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.
  • epierreE Offline
    epierreE Offline
    epierre
    Hero Member
    wrote on last edited by epierre
    #1

    Hello,

    I've managed to make my first emaitter/receptor !

    Now I'm trying to read from the serial port on the controller and get

    0;0;4;11;Message available on pipe 1
    0;0;4;11;Sent ack msg to 255
    0;0;4;11;Rx: fr=255,to=0,la=255,ci=255,mt=4,t=5,cr=136(ok):
    255;255;4;5;

    serial api documentation says the message is "radioId;childId;messageType;subType;payload\n", but I can't match them all given the sensor is an humidity DHT11.

    in a perl script reading the serial interface I get only "255 255 4 5", not the last value, any clue ?

    1 Reply Last reply
    0
    • epierreE Offline
      epierreE Offline
      epierre
      Hero Member
      wrote on last edited by
      #2

      I restarted both, it seems the sensor can't get an id

      Sensor:

      Started sensor. 0 0 0 0
      Relay=0, distance=1 0 0 0 0
      No radio id found in EEPROM fetching one 0 0 0 0
      from sensor net gateway
      Relaying message back to gateway.
      Tx: fr=255,to=0,la=255,ne=0,ci=255,mt=4,ty=5,cr=136:
      Ack: received OK
      Relaying message back to gateway.
      Tx: fr=255,to=0,la=255,ne=0,ci=255,mt=4,ty=5,cr=136:
      Ack: received OK

      Gateway:
      0;0;4;11;Arduino startup complete.
      0;0;4;11;Message available on pipe 1
      0;0;4;11;Sent ack msg to 255
      0;0;4;11;Rx: fr=255,to=0,la=255,ci=255,mt=4,t=5,cr=136(ok):
      0;0;4;11;Message available on pipe 1
      0;0;4;11;Sent ack msg to 255
      0;0;4;11;Rx: fr=255,to=0,la=255,ci=255,mt=4,t=5,cr=136(ok):

      any hint why the gateway doesn't answer ?

      1 Reply Last reply
      0
      • epierreE Offline
        epierreE Offline
        epierre
        Hero Member
        wrote on last edited by epierre
        #3

        other point: I have the external antenna... and tried the gw.begin(AUTO, RF24_PA_LOW) but I get:

        SerialGateway.ino: In function ‘void setup()’:
        SerialGateway:50: error: invalid conversion from ‘int’ to ‘rf24_pa_dbm_e’
        SerialGateway:50: error: initializing argument 1 of ‘void Gateway::begin(rf24_pa_dbm_e, uint8_t, rf24_datarate_e, void ()(char))’

        any hint ?

        I've moved to a standard emitter, same issue as above

        1 Reply Last reply
        0
        • W Offline
          W Offline
          wannabee
          wrote on last edited by
          #4

          225;255;4;5 is the first message sent from a node at startup if it hasn't a RADIO_ID in it's EEPROM.
          255 is the startup ID
          255 is node or the arduino it self.
          4 is internal message
          5 is I_REQUEST_ID

          The node expect to get a
          255;255:4;5;<RAIDO_ID_THAT_YOU_WANT_TO_ASSIGN_TO_THE_NODE>

          It's an automated way to assign RADIO_ID from the controller. usally a Vera or in your case your perl script needs to do that.

          Or if I rember correctly you can set the RAIDO_ID in the arduion when compiling the code:
          change in the .ino file.
          sensors.begin();
          to
          sensors.begin(<RAIDO_ID_THAT_YOU_WANT_TO_ASSIGN_TO_THE_NODE>);

          To decode the messages sent to and from a node check the tables in http://www.mysensors.org/build/sensor_api#the-serial-protocol

          /WB

          1 Reply Last reply
          0
          • epierreE Offline
            epierreE Offline
            epierre
            Hero Member
            wrote on last edited by
            #5

            Hello,

            Thanks for your answer, this is what I thought but I don't understand why it can't get the node from the gateway ? I flashed it again but with no more success.

            The correct method is gw.begin(1) in my case.

            Now it answers with all the presentation, but get stuck in sending mesurement unit:

            0;0;4;11;Rx: fr=1,to=0,la=1,ci=255,mt=4,t=13,cr=73(ok):

            1 Reply Last reply
            0
            • epierreE Offline
              epierreE Offline
              epierre
              Hero Member
              wrote on last edited by
              #6

              it looks like the gateway never answers, any hint ? bad wiring ? other issue ?

              1 Reply Last reply
              0
              • epierreE Offline
                epierreE Offline
                epierre
                Hero Member
                wrote on last edited by
                #7

                similar issue here, I regroup it:

                link text

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

                  Controller normally answer the unit setting requests from sensor. You have to answer manually (or from your perl program).

                  Check the Troubleshooting section on our website if you're unable to communicate.

                  epierreE 1 Reply Last reply
                  0
                  • hekH hek

                    Controller normally answer the unit setting requests from sensor. You have to answer manually (or from your perl program).

                    Check the Troubleshooting section on our website if you're unable to communicate.

                    epierreE Offline
                    epierreE Offline
                    epierre
                    Hero Member
                    wrote on last edited by epierre
                    #9

                    @hek right, I've not read thoroughly what @wannabee told me about who sets the ID. I'll know it for the next time.

                    Should I answer also for the metric ?

                    I have a strange behavior having commented out the metric line although they are close::

                    0;0;4;11;Relaying message back to gateway.
                    0;0;4;11;Tx: fr=0,to=0,la=0,ne=0,ci=255,mt=4,ty=13,cr=52:
                    0;0;4;11;Ack: receive timeout

                    1 Reply Last reply
                    0
                    • W Offline
                      W Offline
                      wannabee
                      wrote on last edited by
                      #10

                      You perl program needs to tell the arudion Gateway if it Imperial or Metric it should you for it's number. The gateway will forward that information to the node

                      Here is post where I explain how it works.
                      http://forum.mysensors.org/topic/62/#315

                      Basicly the arduion gatweway don't controll high level stuff. It only controlls the low level stuff. the raido communication.

                      Your perl program needs to do all the higlevel stuff like responed to request from the network about raido_id, metric system, storing the data,etc. This is what the vera does. you are replacing the vera with your program so now you have to do all the stuff. a quick way forward is to translate https://github.com/mysensors/Vera/blob/master/L_Arduino.lua to perl. You have to build some more function since the Vera is doing stuff like storing data and configuration hat is not in the lua-file.

                      This is what I have done in python see https://github.com/wbcode/ham and it transform the mysensor api to/from openhab api.

                      /WB

                      epierreE 1 Reply Last reply
                      0
                      • epierreE Offline
                        epierreE Offline
                        epierre
                        Hero Member
                        wrote on last edited by
                        #11

                        perfect, this is what I was searching for...

                        I'm too much accustomed to RFX433 or z-Wave that handles many things themself, I now understand that only the basic is here.

                        I can read easily lua, logic can be simple, afterward I have my scripts, in fact I thought of doing the bidirectionnal integration with domoticz and/or cosm/xively for I've got already many of it. For the first, I guess some local logic must be implemented, discovered devices can be created through JSON, and then updated/queried as you already know, so the glue is possible ;-)

                        jendrushJ 1 Reply Last reply
                        0
                        • epierreE epierre

                          perfect, this is what I was searching for...

                          I'm too much accustomed to RFX433 or z-Wave that handles many things themself, I now understand that only the basic is here.

                          I can read easily lua, logic can be simple, afterward I have my scripts, in fact I thought of doing the bidirectionnal integration with domoticz and/or cosm/xively for I've got already many of it. For the first, I guess some local logic must be implemented, discovered devices can be created through JSON, and then updated/queried as you already know, so the glue is possible ;-)

                          jendrushJ Offline
                          jendrushJ Offline
                          jendrush
                          wrote on last edited by
                          #12

                          @epierre +1 for Domoticz integration

                          Do you want to make gateway working in the same way as RFX433?

                          1 Reply Last reply
                          0
                          • epierreE Offline
                            epierreE Offline
                            epierre
                            Hero Member
                            wrote on last edited by epierre
                            #13

                            @jendrush could be a possibility... but to have it exaclty the same, the gateway should do all the work meaning push when a new node is discovered, give all values... the whole vera programm should be built inside the arduino... I don't know how it would fit, but in the meantime some outside scripts can do it.

                            1 Reply Last reply
                            0
                            • W wannabee

                              You perl program needs to tell the arudion Gateway if it Imperial or Metric it should you for it's number. The gateway will forward that information to the node

                              Here is post where I explain how it works.
                              http://forum.mysensors.org/topic/62/#315

                              Basicly the arduion gatweway don't controll high level stuff. It only controlls the low level stuff. the raido communication.

                              Your perl program needs to do all the higlevel stuff like responed to request from the network about raido_id, metric system, storing the data,etc. This is what the vera does. you are replacing the vera with your program so now you have to do all the stuff. a quick way forward is to translate https://github.com/mysensors/Vera/blob/master/L_Arduino.lua to perl. You have to build some more function since the Vera is doing stuff like storing data and configuration hat is not in the lua-file.

                              This is what I have done in python see https://github.com/wbcode/ham and it transform the mysensor api to/from openhab api.

                              /WB

                              epierreE Offline
                              epierreE Offline
                              epierre
                              Hero Member
                              wrote on last edited by
                              #14

                              @wannabee I'm desesperatly (as a newbee ) trying to send the message back, but it doesn't seem to work with

                              echo -en '1;255;4;13;M' > /dev/ttyUSB0

                              any idea ? my script doesn't seem to write too, strange...

                              hekH 1 Reply Last reply
                              0
                              • epierreE epierre

                                @wannabee I'm desesperatly (as a newbee ) trying to send the message back, but it doesn't seem to work with

                                echo -en '1;255;4;13;M' > /dev/ttyUSB0

                                any idea ? my script doesn't seem to write too, strange...

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

                                @epierre

                                Don't forget the newline character.

                                epierreE 1 Reply Last reply
                                0
                                • hekH hek

                                  @epierre

                                  Don't forget the newline character.

                                  epierreE Offline
                                  epierreE Offline
                                  epierre
                                  Hero Member
                                  wrote on last edited by
                                  #16

                                  @hek right the -n option removed newline, but I have still the same behavior. Can both gateway and sensors on the same machine usb port make a difference in this ?

                                  So this one should be good, but no behavior change (same when writing from perl to the port):

                                  echo -e '1;255;4;13;M' > /dev/ttyUSB0

                                  does reading through perl locks it ? well I'm new on this ...

                                  1 Reply Last reply
                                  0
                                  • epierreE Offline
                                    epierreE Offline
                                    epierre
                                    Hero Member
                                    wrote on last edited by
                                    #17

                                    Looks like one got to the sensor:

                                    Sent ack msg to 0 0 0 0 0
                                    Rx: fr=0,to=1,la=0,ci=255,mt=4,t=13,cr=57(ok): M 0 0 0 0
                                    Message addressed for this node. 0 0 0 0
                                    675 Relaying message back to gateway.
                                    Tx: fr=1,to=0,la=1,ne=0,ci=1,mt=1,ty=0,cr=216: 20.0

                                    Relaying message back to gateway. 0 0 0 0
                                    Tx: fr=1,to=0,la=1,ne=0,ci=1,mt=1,ty=0,cr=216: 20.0 0 0 0 0
                                    676 Ack: received OK
                                    T: 20.00
                                    Relaying message back to gateway.
                                    Tx: fr=1,to=0,la=1,ne=0,ci=0,mt=1,ty=1,cr=162: 56.0
                                    Ack: received OK
                                    H: 56.00

                                    Relaying message back to gateway. 0 0 0 0
                                    Tx: fr=1,to=0,la=1,ne=0,ci=1,mt=1,ty=0,cr=216: 20.0 0 0 0 0
                                    676 Ack: received OK
                                    T: 20.00

                                    Relaying message back to gateway.
                                    Tx: fr=1,to=0,la=1,ne=0,ci=0,mt=1,ty=1,cr=162: 56.0
                                    Ack: received OK
                                    H: 56.00

                                    707 Relaying message back to gateway.
                                    Tx: fr=1,to=0,la=1,ne=0,ci=0,mt=1,ty=1,cr=84: 55.0
                                    Ack: receive timeout
                                    H: 55.00

                                    Relaying message back to gateway. 0 0 0 0
                                    Tx: fr=1,to=0,la=1,ne=0,ci=0,mt=1,ty=1,cr=84: 55.0 0 0 0 0
                                    Ack: receive timeout 0 0 0 0
                                    H: 55.00 0 0 0 0

                                    then nothing...

                                    I unplugged the node, plugged it back and it is asking again the metric...

                                    1 Reply Last reply
                                    0
                                    • epierreE Offline
                                      epierreE Offline
                                      epierre
                                      Hero Member
                                      wrote on last edited by
                                      #18
                                      This post is deleted!
                                      1 Reply Last reply
                                      0
                                      • epierreE Offline
                                        epierreE Offline
                                        epierre
                                        Hero Member
                                        wrote on last edited by epierre
                                        #19

                                        I'm getting closer, since I launched the arduino console log my scripts works, and is able so write back the answer...

                                        Starting
                                        1 255 0 17 1.3b3 (67f4ca1)
                                        1 255 4 7 0
                                        1 255 4 14 Humidity
                                        1 255 4 15 1.0
                                        1 255 4 13 0
                                        W : 1;255;4;13;M
                                        1 1 1 0 21.0
                                        1 0 1 1 52.0

                                        looks like it is sleeping forever ?

                                        1 Reply Last reply
                                        0
                                        • epierreE Offline
                                          epierreE Offline
                                          epierre
                                          Hero Member
                                          wrote on last edited by epierre
                                          #20

                                          Hello,

                                          Looks like it's good, in one hour I've had 12 metering values, given I modified the timer in the sensor to 10 instead of 30. It is reporting only changed values which is smart (should be documented, extra value !)

                                          1 1 1 0 21.0
                                          1 0 1 1 52.0
                                          1 0 1 1 53.0
                                          1 0 1 1 54.0
                                          1 1 1 0 20.0
                                          1 1 1 0 21.0
                                          1 1 1 0 20.0
                                          1 0 1 1 55.0
                                          1 0 1 1 54.0
                                          1 0 1 1 55.0
                                          1 0 1 1 54.0
                                          1 0 1 1 55.0
                                          1 1 1 0 21.0

                                          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