Physically small Gateway (to fit inside Raspberry Pi case)



  • I would like to have the gateway within the Raspberry Pi case, instead of connecting for example Arduino Nano through the USB, and connecting the NRF24 using DuPont wires. But how do I do this? None of the examples I have tried so far have worked correctly with the latest Domoticz beta. And yes, as a starting point, the Serial Gateway on Arduino Nano as of Git tag 1.5.3 works perfectly.

    What I have tried so far are

    Any help would be greatly appreciated... I'd really want to have a small gateway within the Raspberry case.





  • OK, found it. It's about the baud rate, 115200 does not work for a Serial Gateway running on a SenseBender. The real baud rate is too much off when the baud rate is generated from the ATmega 328's internal 8 MHz oscillator.

    Unfortunately the 115200 baud rate is hard-coded into Domoticz. I just changed the hardcoded value to 38400 in hardware/MySensorsSerial.cpp, and also rebuilt the 1.5.3 version of the SerialGateway with 38400 as the baud rate.

    Works fine now 🙂 But I think I'll need to make a change & pull request to Domoticz.



  • One more thing. Gizmocuz (Domoticz author) was concerned about performance. Would you think it's fine to run the serial gateway on 8 MHz clock speed?


  • Mod

    My first computer wasn't as fast as 8Mhz. It could still do a lot of things. All a gateway does is to receive and transmit tiny messages every now and then. Would be interesting to know what the basis for corncern is though.



  • OK, I think I'm good to go. I'll try to make a change & pull request into Domoticz (additional checkbox on 'MySensors USB gateway' device) to tell it's a '3.3V 8MHz ATmega328'. In that case the baud rate would be 38400, instead of 115200.

    Maybe the MySensors code could also detect (is there a #define for it?) the clock speed/board model/operating voltage, and set the serial speed to 38400 for 8MHz on 8MHz boards.



  • This sounds really good. I will now also try to reuse my sensebender as a Gateway on the raspberry with a lower baudrate.

    I'm using FHEM and it is possible to set the baudrate in the configuration.

    The strange thing is, that the receiving Messages from nodes and sending the Content to the Controller was working. Only sending values from the Controller to the nodes was not working.
    I think the raspberry is more tolerate in receiving Messages with a Little bit different Baudrate, than the ATmega.



  • @gloob said:

    The strange thing is, that the receiving Messages from nodes and sending the Content to the Controller was working. Only sending values from the Controller to the nodes was not working.

    Yep, I had exactly the same problem. Looks good on the surface, but no commands were sent out.



  • I made a pull request. The sketch GatewaySerial.ino now sets the serial speed to 38400 if the Arduino is running on 8MHz clock speed.

    https://github.com/mysensors/Arduino/pull/391

    EDIT: My pull request was accepted into the Domoticz master branch 🙂


Log in to reply
 

Suggested Topics

  • 1
  • 5
  • 2
  • 1
  • 2
  • 2

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts