Serial Baud Rate for Adapter



  • Hi, Anyway of overriding the Baud Rate for the adapter.
    It seems to be 'hardcoded' at 15200 - I'd like to modify to suit the performance of the UART on the Clone Nano
    self.GATEWAY = mysensors.SerialGateway(
    dev_port, baud=15200,
    #timeout=1.0,
    #reconnect_timeout=10.0,
    event_callback=self.mysensors_message, persistence=True,
    persistence_file=self.persistence_file_path, protocol_version='2.2')



  • @Westie This Serial Adapter has been a total frustration. Without the control on port speed I am forced to manual change the python code which I dont do very well and am not interested in pursuing - sorry nice effort but gets my no vote. I dont know what controller you test on but it is impossible to get any of the ones I have tried to stick on 115200 which is hard coded into the adapter.

    Has anyone had any success in change the port speed that the adapter uses - seems to be stuck on 57600 - I have tried both FTDI and CH340 on Linux Containers using Nano and Pro Mini 5v 16 Mhz.



  • the USB to UART adapter uses the baud rate it's host requests. I have a lot of CH340 here which work perfectly @115200.

    @Westie said in Serial Baud Rate for Adapter:

    dev_port, baud=15200,

    If this line is really in your code, please change it to baud=115200 🙂

    The baud rate MySensors uses can be set with

    #define MY_BAUD_RATE 9600
    

    see https://www.mysensors.org/download/sensor_api_20



  • Thanks frits ... my issue is trying to get the arduino or ftdi adapter to talk at 115200 -
    Either the FTDI or arduino promini gateway is talking at 57600 so the webthings mysensors adapter is hardcoded at 115200.

    I have set #define MY_BAUD_RATE 115200 in the gateway with no joy, I even tried a Seral.begin(115200) in setup(). So Im thinking my FTDI is fixed on 57600 no matter what I send to it

    My attempts at customising the python code in the adapter to change to 57600 has been tricky due to the clash of pyserial and serial modules in a webthings docker image etc etc....

    Currently running a pro mini as the gateway as the knockoff nano CH340 couldnt achieve better comms better than 19200.. I have ordered another nano perhaps the hardware will resolve it all - fingers crossed.

    Mysensors is a great alternative to the commercial networks or even LoraWan as the data stays where it should.



  • The kind people at Candle have updated the adapter to include a parameter for baud rate. V1.2.0. It should automatically update :). I'll test and report back.



  • @Westie Testing using a docker image of the gateway... Update looking good - I have dropped the baud rate down to something more compatible with my clone nano.
    I found a useful tool to check the incoming serial from a Python point of view (not running the adapter when I do it) - python3 -m serial.tools.miniterm --parity N /dev/ttyUSB0 19200. This prints out the messages from the Serial Gateway in nice text when the speed is correct.



Suggested Topics

  • 3
  • 6
  • 13
  • 7
  • 4
  • 2

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts