Please , Error while setting serial port parameters: 115,200 N 8 1



  • Please, I am very new to Mysensors. I just setup Serial Gateway by using Arduino Nano and nRF24L01p with PA and LNA and a MQ2 gas sensor by using Arduino Nano and nRF24L01p with PA and LNA. For the Serial Gateway, It seems to have no problem as shown below.

    0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSM:RADIO:OK
    0;255;3;0;9;TSM:GW MODE
    0;255;3;0;9;TSM:READY
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.0.0
    0;255;3;0;9;No registration required
    0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
    0;255;3;0;9;TSP:SANCHK:OK
    0;255;3;0;9;TSP:SANCHK:OK
    0;255;3;0;9;TSP:SANCHK:OK
    0;255;3;0;9;TSP:SANCHK:OK

    But for the MQ2 sensors, Sometimes it shows message "Error while setting serial port parameters: 115,200 N 8 1" Sometimes It hangs after started the serial monitor as shown below.

    Starting sensor (RNNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID

    I am so sure that the connections of both setup are correct. and I tried to swap between the two setups but it always shows error on the sensor side. I also tried to change to another sensors like distance sensor, It showed the same error. But if I compile with other library in Arduino IDE, The sensors work perfectly. The problem occurred only when compiled with mysensors. If you could give suggestion or comment, It would be grateful. Thank you very much in advanced for your help.


  • Mod

    @parnu2000 How are you powering your Arduino's, radios and the MQ2 sensor ?



  • I connected Serial Gateway Arduino Nano through the USB port of one computer and powered the MQ2 sensor Arduino to the USB port of another computer. Both nRF24L01p connected to 3.3v pins of individual Arduino Nanos. Yveaux, Thank you for your question.


  • Mod

    @parnu2000 it's likely the voltage regulator of the Nano isn't able to supply enough power for the amplified radios.
    Try with a separate 3v3 supply, or with regular, non amplified radio's.



  • Thanks a lot, Yveaux. I 'll try as you suggested. Have a nice weekend.



  • I have changed to use external 3v3 power supply as suggested. The distance sensor start working but it does not report the distance and it fails to register to Serial Gateway as shown below. I try to change CHILD_ID to 5 and upload the sketch. But the CHILD_ID does not change even though I cleared Eeprom before uploading. Then I have downgraded both Serial Gateway and distance sensor to 1.5.4 version. The sensor works and it could report the correct distance on the Serial Monitor. But the gateway does not receive the distance value from the sensor. Do I have to change anything in the distance sensor sketch before I upload the sketch in order that the Serial Gateway show the distance value from the sensor? Actually I would like to use Mysensors version 2 library but I could not change the CHILD_ID, so it failed. Your suggestion is very useful to me. Thank you very much.

    Starting sensor (RNNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSM:FPAR
    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 0-0-255 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:FPAR:OK
    TSM:ID
    TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    TSM:ID
    TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    TSM:ID
    TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    TSM:ID
    TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    !TSM:CHKID:FAIL (ID=255)
    !TSM:FAILURE
    TSM:PDT
    TSM:INIT
    TSM:RADIO:OK
    TSM:FPAR
    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 0-0-255 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:FPAR:OK
    TSM:ID
    TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    TSM:ID
    TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    TSM:ID
    TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    TSM:ID
    TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    !TSM:CHKID:FAIL (ID=255)
    !TSM:FAILURE
    TSM:PDT
    

    This is my gateway.

    0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSM:RADIO:OK
    0;255;3;0;9;TSM:GW MODE
    0;255;3;0;9;TSM:READY
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.0.0
    0;255;3;0;9;No registration required
    0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
    0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSP:MSG:BC
    0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
    0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
    0;255;3;0;9;TSP:MSG:GWL OK
    0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSP:MSG:BC
    0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
    0;255;3;0;9;TSP:CHKUPL:OK
    0;255;3;0;9;TSP:MSG:GWL OK
    0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSP:MSG:BC
    0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
    0;255;3;0;9;TSP:CHKUPL:OK
    0;255;3;0;9;TSP:MSG:GWL OK
    0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:SANCHK:OK
    0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSP:MSG:BC
    0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
    0;255;3;0;9;TSP:CHKUPL:OK
    0;255;3;0;9;TSP:MSG:GWL OK
    0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSP:MSG:BC
    0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)```

  • Mod

    @parnu2000 it looks like the node is either configured to use id 255 (which is not allowed) or is configured to get an id from the controller, but gets nno response from the controller. Which controller are you using and is it connected to the gateway?



  • Thank you very much, mfalkvidd. I could not change node number. I try to change CHILD_ID many times It doesn't change. I just connected my Serial Gateway to the USB port of a computer running Arduino IDE 1.6.8 so that I could see the results from the Serial Monitor. and I also connected the distance sensor node to another computer running the same IDE 1.6.8 to see the responding results on the Serial Monitor. Actually I intended to connect my Serial Gateway to the Home Assistant controller, But I have not configured the Home Assistant yet. Because I would like to make sure whether this part of my sensor and serial gateway works properly before bringing them to connect to the Home Assistant. Do I have to connect Serial Gateway to USB port of Raspberry PI 3 running configured Home Assistant In order to see the results? or Could I see the distance result on Serial monitor transmitted from the mysensors in the environment of Arduino? I am sorry if I asked these are silly questions. Thanks a lot in advanced.


  • Mod

    @parnu2000 starting as small as possible is generally a good idea, so you are doing the right thing by not involving a controller yet. What you are describing is a good way to start.

    The node id is set by

    #define MY_NODE_ID 1
    

    where 1 is a number between 1 and 254. This needs to be done before include MySensors.h.

    The automatic id assignment requires a controller, but if you define a static node id you should be able to see the distance result on the serial monitor, both for the node and the gateway.



  • It works, Thanks to you, mfalkvidd and thanks to this community. Now I could try connecting to Home Assistant. Here is the result from my distance sensor.

    Insert Code Here
    !TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=13,pt=2,l=2,sg=0,ft=0,st=fail:6
    Ping: 169 cm
    TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=13,pt=2,l=2,sg=0,ft=1,st=ok:169
    Ping: 169 cm
    Ping: 170 cm
    TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=13,pt=2,l=2,sg=0,ft=0,st=ok:170
    Ping: 169 cm
    TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=13,pt=2,l=2,sg=0,ft=0,st=ok:169
    Ping: 131 cm
    TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=13,pt=2,l=2,sg=0,ft=0,st=ok:131
    Ping: 0 cm
    TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=13,pt=2,l=2,sg=0,ft=0,st=ok:0
    Ping: 144 cm
    '''
    
    

    Below is the result from Serial Gateway. Thanks to you all.

    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=13,pt=2,l=2,sg=0:148
    1;1;1;0;13;148
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=13,pt=2,l=2,sg=0:0
    1;1;1;0;13;0
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=13,pt=2,l=2,sg=0:169
    1;1;1;0;13;169
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=13,pt=2,l=2,sg=0:170
    1;1;1;0;13;170
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=13,pt=2,l=2,sg=0:169
    1;1;1;0;13;169
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=13,pt=2,l=2,sg=0:131
    1;1;1;0;13;131
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=13,pt=2,l=2,sg=0:0
    1;1;1;0;13;0
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=13,pt=2,l=2,sg=0:144
    1;1;1;0;13;144
    '''

  • Mod

    Very nice @parnu2000 Thanks for reporting back on your success.


Log in to reply
 

Suggested Topics

  • 3
  • 3
  • 15
  • 1
  • 24
  • 2

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts