💬 Building a Raspberry Pi Gateway


  • Mod

    @joaoabs said in 💬 Building a Raspberry Pi Gateway:

    ust run ./configure -h and there is a list of options. Leaving it here just for future reference

    it is already written in the article


  • Contest Winner



  • Thanks for the replies.

    I've changed the PI from a PI1 to a PI3 and was able to make it working with signing. Its running smoothly, I guess the GW is chosen :).

    I'll now focus on the nodes, specially the SenseBender micros that are 2xAA battery powered and are consuming ~3% bat per day, but that will be for another post...

    Thanks!
    Joaoabs



  • Hi, is there any way to check the current gateway operating parameters? My purpose is to check the radio channel and power level set before compilation but I would be glad if I could check other configurable parameters. I looked at Makefile.inc and found some flags set, but not the information I was looking for (does it mean that the default values are set)? Debug logs neither provide these informations.


  • Mod

    What radio are you using?



  • @gohan nrf24, one deployment pa+lna version with external antenna and the other standard with build-in "zig-zag" antenna.


  • Mod

    I always set gw to max power if the radio is shielded



  • Hi,

    Is it normal to have frequently these errors in the RPI GW?

    May 11 00:43:54 nettemp mysgw: RF24: Recovered from a bad interrupt trigger.
    May 11 00:43:54 nettemp mysgw: RF24: Recovered from a bad interrupt trigger.
    May 11 00:43:56 nettemp mysgw: RF24: Recovered from a bad interrupt trigger.
    May 11 00:43:56 nettemp mysgw: RF24: Recovered from a bad interrupt trigger.
    May 11 00:43:58 nettemp mysgw: RF24: Recovered from a bad interrupt trigger.
    May 11 00:43:58 nettemp mysgw: RF24: Recovered from a bad interrupt trigger.
    May 11 00:44:00 nettemp mysgw: RF24: Recovered from a bad interrupt trigger.
    May 11 00:44:00 nettemp mysgw: RF24: Recovered from a bad interrupt trigger.
    

    Thanks



  • @gohan Well, that is not an answer to my question apparently 🙂 I suppose that max power lever is the default setting according to the configure script's help.


  • Mod

    also look for a channel outside the WiFi range



  • Openhab2 on pi3b+ using nrf24 radios and mqtt. I can follow the wiring diagram, but the commands are a bit confusing and seem to jump around randomly. Do I put all the --my-blah-blah together after the ./configure to build a file? Should I do development version? Do the nfr improvements go together with everything else?


  • Mod

    @kberck3 said in 💬 Building a Raspberry Pi Gateway:

    Do I put all the --my-blah-blah together after the ./configure to build a file?

    From the article "Note: All options must be added to the same line, after ./configure"

    Leave the development version for now, the stable works fine.


  • Mod

    @gohan to be fair, I added that note this morning so kberck3 might not have seen it 🙂



  • Appreciate the reply mfalkvidd and gohan! Service is running, will report back if I run into other issues.



  • Hi Guys,

    Is anyone here using the Pi with OTA updates? I'm finding them painfully slow (1-2 stream messages every few seconds). It's taking 1 hour per OTA update compared with 2-3 minutes when using the Arduino gateway!


  • Mod

    I did some tests on pi3 and I found slow ota too. Tekka has an open issue on github about this.



  • Hey guys,

    I tried to setup my Raspberry running Node-RED and serial gateway but I got stuck halfway. I followed the serial gateway compilation above and got it up and running, however using the serial nodes an Node-RED I could not manage to get them to connect tho the gateway.

    First I tried to connect to /dev/ttyMySensorsGateway which did not work due to permissions (owned by root). When checking out /dev/ttyMySensorsGateway I found it links to /dev/pts/1
    which belongs to root and the tty group. But I could not connect to this as the tty group only has write privileges. I think I miss some crucial point connecting those two together so I hope somebody can save the day by pointing me in the right direction.

    Thanks in advance,
    mirodin


  • Admin

    @mirodin

    So you run a separate arduino board as a mysensors gateway, connected with serial (USB) to your raspberry pi? Or do you mean that you are using the rpi directly with radio, and then run the rpi variant of the mysensors gateway code?



  • @tbowmo I run the gateway on my Pi directly with the radio is connected to the Pi's GPIOs. Compilation and gateway do just fine I, if only I could convince my Pi to let Node-RED talk to the device 😄

    EDIT:
    This is my output:

    dietpi@buddy:~ $ ll /dev/ttMySensorsGateway 
    lrwxrwxrwx 1 root root 10 Jun 18 14:38 /dev/ttMySensorsGateway -> /dev/pts/2
    dietpi@buddy:~ $ ll /dev/pts/
    total 0
    crw--w---- 1 dietpi tty  136, 0 Jun 18 14:38 0
    crw--w---- 1 dietpi tty  136, 1 Jun 18 14:38 1
    crw--w---- 1 root   tty  136, 2 Jun 18 14:38 2
    crw--w---- 1 dietpi tty  136, 3 Jun 18 14:38 3
    c--------- 1 root   root   5, 2 Nov  3  2016 ptmx
    

  • Mod

    wasn't it the problem of the missing permission on the dialup group?



  • Unfortunately adding my nodered user to dialout did not bring the hoped success. I still get premission denied messages after a reboot of my raspberry.

    As my console print above shows the /dev/pts device belongs to tty but adding nodered to tty did not work out either (since the group only has write privileg). I have no idea how to fix this other then chowning the port to nodered but that feels wrong for me after years using linux based systems.


  • Mod

    it is not a solution, but you could switch to ethernet GW and you will avoid all the permissions problems.


  • Admin

    My 5 cents:
    Run it as a MQTT gateway, if possible. It makes things so much easier, when you interact with the data in node-red. Even integrating other controllers is easier, as you have the MQTT as standard backbone bus between everything.

    You need to have a MQTT broker (mosquitto) running as well.. But it's worth it..



  • Yes I came to the conclusion that this might be my only option even if it sucks as I have to subscribe to all events from MySensors, process them with Node-RED and republish again which screws my logging a bit. Right now I have another flow subscribed to "#" and write every event into my DB.

    Since I have everything talking to mosquitto setup to follow Homie Convention I was hoping for only having my MQTT broker bombarded with compliant messages and have Node-RED convert everything (assign device names, etc. using a SQLite DB) from serial so the rather cryptic MySensors topics do not show up there.


  • Mod

    @mirodin you actually need only mysensors-in and mysensors-out topics and their subtopics



  • @gohan Yes I know but now I can no longer just wildcard-dump every event on my mosquitto instance into my DB as I need to filter out the mysensor-in and -out topics.


  • Mod

    Or meanwhile just use the ethernet gw



  • Well... I think I fixed it, let's hear it for documentation. Just when I had MQTT setup half way I got struck by the idea that there was some group flag for configure. And indeed there is, setting --my-serial-groupname=nodered did the trick making /dev/pts/X owned by group nodered and let Node-RED connect to it, writing and reading works just fine now.

    Thanks @gohan for your input I think I would have gone the ethernet route in the end if this last test had failed.



  • I am currently trying to update to 2.3
    Have stopped service and deleted the file (systemctl status mysgw -> Unit mysgw.service could not be found.)
    Also renamed the config file /etc/mysensors.dat
    Renamed the old folder, then copied new files.
    Checked readme.md in MySensors-folder: MySensors Library v2.3.0
    Then I configured the radio and -> make, no errors
    However, changing to bin folder and executing mysgw shows: Protocol 2.2.0
    What am I missing?



  • @inso Did you sudo make install after building it? This command copies the service file and mysgw to their respective locations.


  • Mod

    @inso remember to unregister the service and then make a new make install of the new gw


  • Mod

    @gohan how is the unregistration done? I didn’t know that was needed. We should probably add upgrade instructions to the build page.



  • @mirodin
    make install before testing did the trick, now it is 2.3.0 . 😃
    Was just going step by step through tutorial, there it´s make -> test -> make install. Didn´t realized it would use old parts if it´s not first install ☺

    @gohan
    thought stop, disable and remove the service would be enough to ensure the service is completely "uninstalled" - could you give me a hint what I´ve missed? 😅



  • Hi,
    I try to access log info from my gateway installed on my domoticz raspberry pi, but I get no success..
    First, I can't find the mysensors.conf file : nothing in the /etc folder. I tried to use "find / -name 'mysensors.conf' 2>/dev/null" command, but it finds nothing.
    I tried creating such a file (then it's found by the fond command above) and in which I have the lines

    log_pipe=0
    log_pipe_file=/tmp/mysgw.pipe
    

    as instructed above.
    I restarted the wole Raspberry PI, then tried the command cat /tmp/mysgw.pipe but error message:

    cat: /tmp/mysgw.pipe: Aucun fichier ou dossier de ce type
    

    (= no file or folder like that)
    I then tried this: sudo mysgw -c /etc/mysensors.conf and I got also error message:

    mysgw: invalid option -- 'c'
    

    I installed the Mysensor gateway on 17th October 2017 and my raspberry pi is working on Wheezy. In Domoticz, I see the Mysensor gateway has version 2.1.1.
    MY gateway seems working fine, communicating properly with sensors (both ways). I'm trying to find log because I face an issue with a new sensor which works properly when powered with external FTDI 3.3V and only 1 way (sensor to gateway only) when powered on battery (I raised question in another post, where I was suggested to check log fil on gtw side..)

    Any idea of what I should do (except "reinstall whole raspberry pi with latest OS..) ?
    Thanks a lot,
    Ricorico


  • Mod

    @ricorico94 there seems to have been some major changes in the raspberry pi gateway, without vorresponding updates to the documentation.

    I have not been able to locate the exact changes though. @marceloaqno might know.


  • Mod



  • @mfalkvidd : thanks a lot ! I had searched for such version history and couldn't find it.
    Indeed it seems introduction of the switches for log files was introduced in February, so I should probably update my install.

    Precisely, talking about upgrade process: I read in previous posts that we should uninstall/unregister the install/service. WHat would be commands to do so ? Should it be:

    sudo systemctl disable mysgw.service
    

    and executed before anything else ? So upgrade process would be:

    sudo systemctl disable mysgw.service
    make
    sudo make install
    sudo systemctl enable mysgw.service
    

    (and maybe test the gateway before the "systemctl enable..")
    Is there anyfile to remove manually ? or any other command to apply before or after ?


  • Plugin Developer

    Would someone be willing to create a post that lists each step required to set up the simple encryption+signing option? I understand I have to add a password line to the arduino sketch. But how exactly one sets up the server side is still a bit of a mystery to me. It would rock if there was a similar simple command to give during the make process.


  • Contest Winner

    @alowhum https://www.mysensors.org/apidocs/group__RaspberryPiGateway.html
    That is straight from the documentation. Which in the case of Linux ports is also what you get if you issue ./configure --help
    I believe.



  • @alowhum
    I also need this info...


  • Code Contributor

    @ricorico94 to update your install run:

    sudo make install
    sudo systemctl restart mysgw.service
    


  • Thank you for the clarification !


  • Plugin Developer

    @anticimex said in 💬 Building a Raspberry Pi Gateway:

    https://www.mysensors.org/apidocs/group__RaspberryPiGateway.html

    @Anticimex Thanks, but a documentation page (which I have checked before) is not the same as an easy to use guide for beginners.

    In my ideal world it would be this:

    1. Add the MY_SIMPLE_PASSWORD line to your Arduino sketch.
    2. Compile the gateway with --MY_SIMPLE_PASSWORD="yabadabad000!"
    3. Done

  • Contest Winner

    @alowhum it is not easy to have simple guides tailored for specific usecases when there are so many options.
    Those tend to not follow implementation and our documentation is made to live with the implementation to ensure it is always up to date. Maintaining a simple guide for every conceivable use case is simply not feasible. The signing and security documentation does have a step by step guide for setting up security.


  • Plugin Developer

    @Anticimex: I understand, but:

    • Currently even the outline of the steps eludes me. Seeing the steps for usecase #14 or #385 would already help me understand the scope, and to see what ballpark of difficulty it's in. It's easier to mod a guide when there is something to go on.
    • Secondly, there must be a common use case? The defaults that MySensors uses already suggests a lot of these: a Raspberry Pi with the default settings of the software (ethernet), with the nRF24 radio.

  • Contest Winner

    @alowhum ok, well first of all, I don't have a rPi setup to test on, secondly I don't have time to look into that (this) environment.
    But, this is a open source project so anyone is free to contribute with both code and documentation (which in our case lives in the same repositories) so if there are guides missing enyone is welcome to contribute with experiences and guides to help others out.
    It is just important to understand that the guides need to be maintained in order to remain valid.
    I don't mind guides at all. But it makes little sense for me to write guides for an environment which I am not familiar with nor can test on.


  • Plugin Developer

    @Anticimex: Sure, that's totally understandable. There are other people on the forum 🙂 Can anyone help me and @pepson out?

    And it is exactly my goal to create a more elaborate guide after someone points out the basic steps.



  • I have designed a 3D printable enclosure for this and the design/STL files are available here: https://www.thingiverse.com/thing:3072244


  • Admin

    @John-Oliva, nice! Added it to the MySensors collection:
    https://www.thingiverse.com/mysensors/collections/mysensors



  • @korleone HI
    I have same error
    Can you write that rigth do you ser to folder ?
    Andrey



  • @cadet I just remove /usr/local/bin/mysgw and compile again
    And I have one question - why is it happened?
    MysGW work fine about 3 months.


  • Mod

    what problem did you have?



  • @gohan mysgw: ERROR accept: Bad file descriptor - today morning


  • Mod

    I get that when another instance of the process is already running



  • @gohan I was try to find it with ps -ef, but nothing found. Reload RPI.
    @korleone was write about this
    "Hello, it seems I found the problem: Complete newbie thing: 🔰
    sudo ./bin/mysgw -h worked, but /usr/local/bin/mysgw didn't
    I just gave the right to the folder, and now it's working."

    But what right hi gave ?


  • Mod

    sudo ./bin/mysgw -h could work, it only depends in which folder you are running the command from



  • FYI looks like on the 2.3.1 beta the transport has been changed to rf24 instead of nrf24



  • Is the rasberry pi serving as a gateway and a server in this project? Or do you have to have a separate pi to host something like openhab and another pi for your gateway?


  • Mod

    Hi @magjef29, welcome to the MySensors forum!

    You can run your controller(s) on the same Raspberry Pi.

    Depending on what tou mean by ”server”, the gateway can be a server, but the gateway is not a controller.

    If you haven’t already, see the getting started guide for information about the different parts.



  • Hi! Does anybody test Cubieboard as Gateway? I have a cubieboard runing archlinux with spi enabled in kernel. How i define pins for nrf24 gateway connection? Or i need to make big changes in code to star work with different bord than Rpi?
    Best regards



  • This is my old dream to connect directly nrf to Cubieboard GPIOs. Few years ago i try to do this without success using this lib - https://github.com/bearpawmaxim/librf24-sunxi


  • Mod

    Hi @артем-тихонович, welcome to the MySensors forum!

    For the NRF24, the same defines as for normal sketches are used. Documentation: https://www.mysensors.org/apidocs/group__RF24SettingGrpPub.html
    The defines can be added to the Raspberry Pi gateway by following the instructions on https://www.mysensors.org/build/raspberry#advanced

    I have not heard about anyone using the Cubieboard but hopefully someone else has. The information provided on https://www.mysensors.org/build/orange might be useful if the Cubieboard is similar to the Orange Pie.

    oh, and in case you haven't already, see the ./configure --help text about the most common NRF24 defines; you might not need the advanced build options.



  • Thank you, @mfalkvidd. Ihave a little troubles with correct defining gpios from Cubie. In fex file the gpios defines is:
    [gpio_para]
    gpio_used = 1
    gpio_num = 2
    gpio_pin_1 = port:PH07<0><default><default><default>
    gpio_pin_2 = port:PH15<6><default><default><default>
    in sys/gpio:
    [root@Archey boot]# ls -ls /sys/class/gpio/
    total 0
    0 --w------- 1 root root 4096 Nov 21 11:58 export
    0 lrwxrwxrwx 1 root root 0 Nov 18 17:01 gpio1_ph7 -> ../../devices/platform/gpio-sunxi/gpio/gpio1_ph7
    0 lrwxrwxrwx 1 root root 0 Nov 21 11:54 gpio2_ph15 -> ../../devices/platform/gpio-sunxi/gpio/gpio2_ph15
    0 lrwxrwxrwx 1 root root 0 Nov 18 10:45 gpiochip1 -> ../../devices/platform/gpio-sunxi/gpio/gpiochip1
    0 --w------- 1 root root 4096 Nov 18 16:52 unexport

    When i define in configure: --my-rf24-ce-pin=1 --my-rf24-cs-pin=2 build is ok, but test failed with error:
    Nov 21 11:58:15 ERROR Could not open /sys/class/gpio/gpio1/direction[root@Archey MySensors]#
    when i define --my-transport=nrf24 --my-rf24-ce-pin=gpio1_ph7 the build failed wirh error:
    ./drivers/RF24/RF24.cpp: In function 'void RF24_ce(bool)':
    <command-line>:0:16: error: 'gpio1_ph7' was not declared in this scope
    ./drivers/RF24/RF24.cpp:52:17: note: in expansion of macro 'MY_RF24_CE_PIN'
    hwDigitalWrite(MY_RF24_CE_PIN, level);

    How can i resolve this problem? Please help.



  • I just see for another app using nrf24 on cubieboard
    and funcrtion to use nrf24 have GPIO defining is RF24 radio(SUNXI_GPB(10), SUNXI_GPB(11), "/dev/spidev0.0");
    GPIO set using this style: SUNXI_GPB(10), this type of gpio defined in #include "gpio_sun4i.h" file. Maybe this specific defining in ARCHLINUX ARM distro.


  • Plugin Developer

    I hereby donate these images:

    4_1542918057729_step1.png 3_1542918057729_step2.png 2_1542918057728_step3.png 1_1542918057727_step4.png 0_1542918057727_step5.png


  • Mod

    In case someone can help @артем-тихонович, please post the answer in https://forum.mysensors.org/post/95304 so we don’t unnecessarily discuss the same thing in separate threads.



  • I get weird errors when "make"ing. Branch master.
    My command:
    sudo ./configure --my-transport=rf24 --my-rf24-irq-pin=15 --my-signing-debug --my-signing=password --my-security-password=ZZZZZZZZZZ --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-user=XXXX --my-mqtt-password=YYYYY --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1 --my-leds-err-pin=12 --my-leds-rx-pin=16 --my-leds-tx-pin=18 --my-config-file=/etc/mysensors.conf

    M -c examples_linux/mysgw.cpp -o build/examples_linux/mysgw.o
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp: In function ‘bool signerAtsha204SoftGetNonce(MyMessage&)’:
    ./core/MySigningAtsha204Soft.cpp:173:55: error: no matching function for call to ‘min(unsigned int, int)’
      msg.set(_signing_verifying_nonce, MIN(MAX_PAYLOAD, 32));
                                                           ^
    In file included from /usr/include/c++/6/algorithm:62:0,
                     from ./drivers/Linux/Arduino.h:32,
                     from ./MySensors.h:39,
                     from examples_linux/mysgw.cpp:82:
    /usr/include/c++/6/bits/stl_algo.h:3453:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
         min(initializer_list<_Tp> __l, _Compare __comp)
         ^~~
    /usr/include/c++/6/bits/stl_algo.h:3453:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:173:55: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’
      msg.set(_signing_verifying_nonce, MIN(MAX_PAYLOAD, 32));
                                                           ^
    In file included from /usr/include/c++/6/algorithm:62:0,
                     from ./drivers/Linux/Arduino.h:32,
                     from ./MySensors.h:39,
                     from examples_linux/mysgw.cpp:82:
    /usr/include/c++/6/bits/stl_algo.h:3447:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
         min(initializer_list<_Tp> __l)
         ^~~
    /usr/include/c++/6/bits/stl_algo.h:3447:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:173:55: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’
      msg.set(_signing_verifying_nonce, MIN(MAX_PAYLOAD, 32));
                                                           ^
    In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                     from /usr/include/c++/6/ios:40,
                     from /usr/include/c++/6/ostream:38,
                     from /usr/include/c++/6/iostream:39,
                     from examples_linux/mysgw.cpp:20:
    /usr/include/c++/6/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
         min(const _Tp& __a, const _Tp& __b, _Compare __comp)
         ^~~
    /usr/include/c++/6/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:173:55: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’)
      msg.set(_signing_verifying_nonce, MIN(MAX_PAYLOAD, 32));
                                                           ^
    In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                     from /usr/include/c++/6/ios:40,
                     from /usr/include/c++/6/ostream:38,
                     from /usr/include/c++/6/iostream:39,
                     from examples_linux/mysgw.cpp:20:
    /usr/include/c++/6/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
         min(const _Tp& __a, const _Tp& __b)
         ^~~
    /usr/include/c++/6/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:173:55: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’)
      msg.set(_signing_verifying_nonce, MIN(MAX_PAYLOAD, 32));
                                                           ^
    ./core/MySigningAtsha204Soft.cpp: In function ‘void signerAtsha204SoftPutNonce(MyMessage&)’:
    ./core/MySigningAtsha204Soft.cpp:190:89: error: no matching function for call to ‘min(unsigned int, int)’
      (void)memcpy((void *)_signing_nonce, (const void *)msg.getCustom(), MIN(MAX_PAYLOAD, 32));
                                                                                             ^
    In file included from /usr/include/c++/6/algorithm:62:0,
                     from ./drivers/Linux/Arduino.h:32,
                     from ./MySensors.h:39,
                     from examples_linux/mysgw.cpp:82:
    /usr/include/c++/6/bits/stl_algo.h:3453:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
         min(initializer_list<_Tp> __l, _Compare __comp)
         ^~~
    /usr/include/c++/6/bits/stl_algo.h:3453:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:190:89: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’
      (void)memcpy((void *)_signing_nonce, (const void *)msg.getCustom(), MIN(MAX_PAYLOAD, 32));
                                                                                             ^
    In file included from /usr/include/c++/6/algorithm:62:0,
                     from ./drivers/Linux/Arduino.h:32,
                     from ./MySensors.h:39,
                     from examples_linux/mysgw.cpp:82:
    /usr/include/c++/6/bits/stl_algo.h:3447:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
         min(initializer_list<_Tp> __l)
         ^~~
    /usr/include/c++/6/bits/stl_algo.h:3447:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:190:89: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’
      (void)memcpy((void *)_signing_nonce, (const void *)msg.getCustom(), MIN(MAX_PAYLOAD, 32));
                                                                                             ^
    In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                     from /usr/include/c++/6/ios:40,
                     from /usr/include/c++/6/ostream:38,
                     from /usr/include/c++/6/iostream:39,
                     from examples_linux/mysgw.cpp:20:
    /usr/include/c++/6/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
         min(const _Tp& __a, const _Tp& __b, _Compare __comp)
         ^~~
    /usr/include/c++/6/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:190:89: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’)
      (void)memcpy((void *)_signing_nonce, (const void *)msg.getCustom(), MIN(MAX_PAYLOAD, 32));
                                                                                             ^
    In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                     from /usr/include/c++/6/ios:40,
                     from /usr/include/c++/6/ostream:38,
                     from /usr/include/c++/6/iostream:39,
                     from examples_linux/mysgw.cpp:20:
    /usr/include/c++/6/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
         min(const _Tp& __a, const _Tp& __b)
         ^~~
    /usr/include/c++/6/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:190:89: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’)
      (void)memcpy((void *)_signing_nonce, (const void *)msg.getCustom(), MIN(MAX_PAYLOAD, 32));
                                                                                             ^
    ./core/MySigningAtsha204Soft.cpp: In function ‘bool signerAtsha204SoftSignMsg(MyMessage&)’:
    ./core/MySigningAtsha204Soft.cpp:229:50: error: no matching function for call to ‘min(unsigned int, int)’
                   MIN(MAX_PAYLOAD-mGetLength(msg), 32));
                                                      ^
    In file included from /usr/include/c++/6/algorithm:62:0,
                     from ./drivers/Linux/Arduino.h:32,
                     from ./MySensors.h:39,
                     from examples_linux/mysgw.cpp:82:
    /usr/include/c++/6/bits/stl_algo.h:3453:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
         min(initializer_list<_Tp> __l, _Compare __comp)
         ^~~
    /usr/include/c++/6/bits/stl_algo.h:3453:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:229:50: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’
                   MIN(MAX_PAYLOAD-mGetLength(msg), 32));
                                                      ^
    In file included from /usr/include/c++/6/algorithm:62:0,
                     from ./drivers/Linux/Arduino.h:32,
                     from ./MySensors.h:39,
                     from examples_linux/mysgw.cpp:82:
    /usr/include/c++/6/bits/stl_algo.h:3447:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
         min(initializer_list<_Tp> __l)
         ^~~
    /usr/include/c++/6/bits/stl_algo.h:3447:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:229:50: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’
                   MIN(MAX_PAYLOAD-mGetLength(msg), 32));
                                                      ^
    In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                     from /usr/include/c++/6/ios:40,
                     from /usr/include/c++/6/ostream:38,
                     from /usr/include/c++/6/iostream:39,
                     from examples_linux/mysgw.cpp:20:
    /usr/include/c++/6/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
         min(const _Tp& __a, const _Tp& __b, _Compare __comp)
         ^~~
    /usr/include/c++/6/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:229:50: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’)
                   MIN(MAX_PAYLOAD-mGetLength(msg), 32));
                                                      ^
    In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                     from /usr/include/c++/6/ios:40,
                     from /usr/include/c++/6/ostream:38,
                     from /usr/include/c++/6/iostream:39,
                     from examples_linux/mysgw.cpp:20:
    /usr/include/c++/6/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
         min(const _Tp& __a, const _Tp& __b)
         ^~~
    /usr/include/c++/6/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:229:50: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’)
                   MIN(MAX_PAYLOAD-mGetLength(msg), 32));
                                                      ^
    ./core/MySigningAtsha204Soft.cpp: In function ‘bool signerAtsha204SoftVerifyMsg(MyMessage&)’:
    ./core/MySigningAtsha204Soft.cpp:283:55: error: no matching function for call to ‘min(unsigned int, int)’
                        MIN(MAX_PAYLOAD-mGetLength(msg), 32))) {
                                                           ^
    In file included from /usr/include/c++/6/algorithm:62:0,
                     from ./drivers/Linux/Arduino.h:32,
                     from ./MySensors.h:39,
                     from examples_linux/mysgw.cpp:82:
    /usr/include/c++/6/bits/stl_algo.h:3453:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
         min(initializer_list<_Tp> __l, _Compare __comp)
         ^~~
    /usr/include/c++/6/bits/stl_algo.h:3453:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:283:55: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’
                        MIN(MAX_PAYLOAD-mGetLength(msg), 32))) {
                                                           ^
    In file included from /usr/include/c++/6/algorithm:62:0,
                     from ./drivers/Linux/Arduino.h:32,
                     from ./MySensors.h:39,
                     from examples_linux/mysgw.cpp:82:
    /usr/include/c++/6/bits/stl_algo.h:3447:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
         min(initializer_list<_Tp> __l)
         ^~~
    /usr/include/c++/6/bits/stl_algo.h:3447:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:283:55: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’
                        MIN(MAX_PAYLOAD-mGetLength(msg), 32))) {
                                                           ^
    In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                     from /usr/include/c++/6/ios:40,
                     from /usr/include/c++/6/ostream:38,
                     from /usr/include/c++/6/iostream:39,
                     from examples_linux/mysgw.cpp:20:
    /usr/include/c++/6/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
         min(const _Tp& __a, const _Tp& __b, _Compare __comp)
         ^~~
    /usr/include/c++/6/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:283:55: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’)
                        MIN(MAX_PAYLOAD-mGetLength(msg), 32))) {
                                                           ^
    In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                     from /usr/include/c++/6/ios:40,
                     from /usr/include/c++/6/ostream:38,
                     from /usr/include/c++/6/iostream:39,
                     from examples_linux/mysgw.cpp:20:
    /usr/include/c++/6/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
         min(const _Tp& __a, const _Tp& __b)
         ^~~
    /usr/include/c++/6/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:283:55: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’)
                        MIN(MAX_PAYLOAD-mGetLength(msg), 32))) {
                                                           ^
    ./core/MySigningAtsha204Soft.cpp: In function ‘void signerCalculateSignature(MyMessage&, bool)’:
    ./core/MySigningAtsha204Soft.cpp:307:48: error: no matching function for call to ‘min(uint8_t&, int)’
       uint8_t bytes_to_include = MIN(bytes_left, 32);
                                                    ^
    In file included from /usr/include/c++/6/algorithm:62:0,
                     from ./drivers/Linux/Arduino.h:32,
                     from ./MySensors.h:39,
                     from examples_linux/mysgw.cpp:82:
    /usr/include/c++/6/bits/stl_algo.h:3453:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
         min(initializer_list<_Tp> __l, _Compare __comp)
         ^~~
    /usr/include/c++/6/bits/stl_algo.h:3453:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:307:48: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned char’
       uint8_t bytes_to_include = MIN(bytes_left, 32);
                                                    ^
    In file included from /usr/include/c++/6/algorithm:62:0,
                     from ./drivers/Linux/Arduino.h:32,
                     from ./MySensors.h:39,
                     from examples_linux/mysgw.cpp:82:
    /usr/include/c++/6/bits/stl_algo.h:3447:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
         min(initializer_list<_Tp> __l)
         ^~~
    /usr/include/c++/6/bits/stl_algo.h:3447:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:307:48: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned char’
       uint8_t bytes_to_include = MIN(bytes_left, 32);
                                                    ^
    In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                     from /usr/include/c++/6/ios:40,
                     from /usr/include/c++/6/ostream:38,
                     from /usr/include/c++/6/iostream:39,
                     from examples_linux/mysgw.cpp:20:
    /usr/include/c++/6/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
         min(const _Tp& __a, const _Tp& __b, _Compare __comp)
         ^~~
    /usr/include/c++/6/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:307:48: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned char’ and ‘int’)
       uint8_t bytes_to_include = MIN(bytes_left, 32);
                                                    ^
    In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                     from /usr/include/c++/6/ios:40,
                     from /usr/include/c++/6/ostream:38,
                     from /usr/include/c++/6/iostream:39,
                     from examples_linux/mysgw.cpp:20:
    /usr/include/c++/6/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
         min(const _Tp& __a, const _Tp& __b)
         ^~~
    /usr/include/c++/6/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
    In file included from ./MySensors.h:148:0,
                     from examples_linux/mysgw.cpp:82:
    ./core/MySigningAtsha204Soft.cpp:307:48: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned char’ and ‘int’)
       uint8_t bytes_to_include = MIN(bytes_left, 32);
                                                    ^
    ./core/MySigningAtsha204Soft.cpp: In function ‘bool signerAtsha204SoftVerifyMsg(MyMessage&)’:
    ./core/MySigningAtsha204Soft.cpp:289:1: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^
    Makefile:98: recipe for target 'build/examples_linux/mysgw.o' failed
    make: *** [build/examples_linux/mysgw.o] Error 1
    

    Can someone better versed help?
    EDIT: tested branch development, no problems.


  • Mod



  • @mfalkvidd It sure looks the same. I did a fresh git clone to update my gateway, so shouldn't it be fixed? From what appears on github it looked fixed..
    EDIT appears fixed in development branch. But not master?


  • Mod

    @masmat said in 💬 Building a Raspberry Pi Gateway:

    EDIT appears fixed in development branch. But not master?

    Yes that is correct



  • hi,
    is it possible to conect NRF24 to SPI1 channel on RBpi3?
    (i mean pins 26, 35, 36,38,40)??


  • Mod

    Welcome to the forum @robert-król
    I have not tried it myself, but I beleive https://forum.mysensors.org/post/76079 shows how to do it.



  • Hello

    Is it possible to redefine pin used for DI00 with rfm69 (with configure option for example) ?
    Indeed, DI00 is on pin 22 on raspberry, and pin 2 on arduino.
    But with NRF, pin 2 on arduino is for IRQ, which is connected to pin 15 on raspberry.

    So if it was possible to force pin 15 for DI00, we could use adaptator card like this one https://www.mysensors.org/hardware/nrf2rfm69.



  • Hi, just build an Ethernet gateway on a raspberry pi B+ following the instructions on this site. And it works! I'm running raspbian stretch lite and used the master branch. No issues. I use the RFM69 radio and this gateway has the HW model. I did have to update al my nodes to use the new RFM69 drivers but that was clearly mentioned in the article.
    I have two questions:

    1. In this section :
    log_pipe=0
    log_pipe_file=/tmp/mysgw.pipe
    

    Is this correct, I think there should be a 1 to enable this type of logging.

    1. When a new version of mysensors is released, how do I update the gateway version on the raspberry pi?

    And here is a picture of my work:
    alt text

    Thanks for the effort you put into this project!



  • Has the issue with RFM automatic transmission control been addressed?



  • @kted Can you give me a pointer to the details of this issue? I'm willing to do some tests and report back my findings. Some info about my configuration, I have 5 nodes at this moment, all battery feeded, they are sending only nodes. They all work but they have a interval of several minutes between sending. The gateway is connected to Domoticz running on another Raspberry PI.



  • @rolo6442u I built an Raspberry gateway using an RFM69 radio, to replace one built around a NodeMCU.
    All nodes are transmit only, and using the latest stable API.
    I noticed that all sensors were using max TX power after the first couple of transmissions, although they were respecting the ATC setting before, and were using minimum power most of the time.
    Now I am concerned about battery life, so I switched back to the NodeMCU gateway, waiting for a fix.
    I'll put together a temporary net, with a RPi0 gateway and a single node later, to show some real data, if you need any more information.



  • @kted I wil do some tests to check if I see this behavior. Just build a simple test node with a pushbutton, on 2 AA batteries. This node has the low power W radio module. How did you discover/measure that the max TX power was used?


  • Mod

    @kted could be the same problem as discussed in https://forum.mysensors.org/topic/9796/rfm69-atc-not-working/



  • @rolo6442u From what the node itself reports from transportGetSignalReport(SR_TX_POWER_PERCENT). It starts from say 50%, and after a coule of transmissions it goes up to 100%, when the nodes are 1m apart. When using a stand alone ESP8266 gateway, it drops to 0%.
    I'll have the nodes ready in a couple of hours, after I come home from work...



  • Did some tests and I do see the TX power climbing to 100% after a few transmits :

    -42 :transportGetReceivingRSSI()
    127 :transportGetSendingRSSI()
    -256 :transportGetReceivingSNR()
    -256 :transportGetSendingSNR()
    6 :transportGetTxPowerLevel()
    77 :transportGetTxPowerPercent()
    0 :transportInternalToRSSI(_transportSM.uplinkQualityRSSI)
    
    -46 :transportGetReceivingRSSI()
    -102 :transportGetSendingRSSI()
    -256 :transportGetReceivingSNR()
    -256 :transportGetSendingSNR()
    7 :transportGetTxPowerLevel()
    80 :transportGetTxPowerPercent()
    0 :transportInternalToRSSI(_transportSM.uplinkQualityRSSI)
    
    -47 :transportGetReceivingRSSI()
    -102 :transportGetSendingRSSI()
    -256 :transportGetReceivingSNR()
    -256 :transportGetSendingSNR()
    10 :transportGetTxPowerLevel()
    90 :transportGetTxPowerPercent()
    0 :transportInternalToRSSI(_transportSM.uplinkQualityRSSI)
    
    -47 :transportGetReceivingRSSI()
    -105 :transportGetSendingRSSI()
    -256 :transportGetReceivingSNR()
    -256 :transportGetSendingSNR()
    11 :transportGetTxPowerLevel()
    93 :transportGetTxPowerPercent()
    0 :transportInternalToRSSI(_transportSM.uplinkQualityRSSI)
    
    -47 :transportGetReceivingRSSI()
    -103 :transportGetSendingRSSI()
    -256 :transportGetReceivingSNR()
    -256 :transportGetSendingSNR()
    13 :transportGetTxPowerLevel()
    100 :transportGetTxPowerPercent()
    0 :transportInternalToRSSI(_transportSM.uplinkQualityRSSI)
    
    -47 :transportGetReceivingRSSI()
    -106 :transportGetSendingRSSI()
    -256 :transportGetReceivingSNR()
    -256 :transportGetSendingSNR()
    13 :transportGetTxPowerLevel()
    100 :transportGetTxPowerPercent()
    0 :transportInternalToRSSI(_transportSM.uplinkQualityRSSI)
    
    

    Not sure if this has a great impact on battery life, depends on how often the node sends a message. Al my nodes have an interval of about 10 minutes. I leave the gateway running for now. Having it running on this PI is a great advantage for me. Will try to do some current measurement on this node and calculate what the impact is on battery life.


  • Mod

    @barrydou I gave a double gateway running on my raspberry both nrf24 and rfm69, still on v. 2.2



  • @gohan Nice. I was thinking to do that same at some time, but I wasn't sure if the Raspberry could handle the load, since I also run domoticz on it, along with pi-hole.
    How many devices do you have on each gateway?


  • Mod

    I got the same, domoticz and pi hole, but the load of the gateway is minimal



  • @gohan I meant multiple gateways on the same raspberry.
    Right now, I have an NRF24L01 gateway, Domoticz, pi-hole, and a VPN server running, with 2 more gateways connected, one local and one remote RFM69 on ESP8266.
    It would be nice if I could combine the two local gateways, the RFM and the NRF on the same Raspberry's GPIO...


  • Mod

    Yes, I have both radios on the same raspberry.



  • More problems when I try to "make" after configuring. Tried with and without sudo...

    dietpi@Domoticz:~/MySensors$ sudo make
    gcc -MT build/hal/architecture/Linux/drivers/core/log.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_SIGNING_SIMPLE_PASSWD=\"ZZZZZZZ\" -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_CONFIG_FILE=\"/etc/mysensors.conf\" -DMY_DEFAULT_TX_LED_PIN=18 -DMY_DEFAULT_RX_LED_PIN=16 -DMY_DEFAULT_ERR_LED_PIN=12 -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_MQTT_PASSWORD=\"YYYYY\" -DMY_MQTT_USER=\"XXXX\" -DMY_CONTROLLER_IP_ADDRESS=127,0,0,1 -DMY_DEBUG_VERBOSE_SIGNING -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15  -Ofast -g -Wall -Wextra  -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/log.c -o build/hal/architecture/Linux/drivers/core/log.o
    In file included from hal/architecture/Linux/drivers/core/log.c:20:0:
    hal/architecture/Linux/drivers/core/log.h:24:19: fatal error: stdio.h: File not found
     #include <stdio.h>
                       ^
    compilation terminated.
    Makefile:102: recipe for target 'build/hal/architecture/Linux/drivers/core/log.o' failed
    make: *** [build/hal/architecture/Linux/drivers/core/log.o] Error 1
    

    EDIT: ...and here's the fix: "sudo apt-get install g++" (I'm using DietPi now to make it lighter for Pi Zero W).



  • Running Version 2.3.2-beta just cloned today. On a raspberry pi B rev2.
    A little bug/problem I have discovered with the MQTT gateway.

    When you run the gateway with command and switch:-

    mysgw -c /etc/mysensors.conf
    

    It segfaults.

    When its run with the command and switch :-

    mysgw --config-file /etc/mysensors.conf
    

    It works fine

    I was playing with the ethernet gateway compile and the -c worked fine.



  • Another thing I have found is I cannot get any logging working with the mqqt gateway compile.

    It worked fine (named pipe) with the ethernet gateway compile.

    Edit
    It seems logging with the mqtt is not instant. It seem to dump the log out of memory periodically, is this expected? Makes it a bit hard to debug real-time.


  • Mod

    Just use mqtt client


  • Mod

    @coza I have experienced that the raspberry pigateway does not flush the logs immediately when logging to file. Syslog logs immediately though. See if switching to syslog helps.



  • @gohan Sorry I miss your answer a few days ago
    I don't want to a gateway with both rfm69 and nrf24..

    I'm planning to change my nrf24 sensors with rfm69, to have a better transmission distance. My two nodes are outside, and i have communication trouble if i put them where i wanted, specially for my rain gauge.
    So I wanted to use those adaptors https://www.openhardware.io/view/16/NRF2RFM69.
    I received them, and I'm still waiting RFM69 board to test it.

    But as the pinout is not the same between nrf24 and rfm69 on raspberry gateway, I could not use the adaptor on the gateway. So before making a new board for my raspberry, I wanted to know if it's possible to change the default pin configuration, to have exactly the same as nrf24, and use an adaptor on the gateway too.
    For that, I "just" need to redefine DIO0 on pin 15 (default is 22). So I wonder if it's possible to do it.

    And "bonus question", I'd like to know why pin configuration is not the same between arduino and raspberry. Why pin 15 is not used for DIO0 on raspberry (equivalent to pin 2 on arduino). I'm telling myself it should be a good reason, but I don't get it.


  • Mod

    @barrydou is this what you need (from the documentation and ./configure--help)

    --my-rfm69-irq-pin=<PIN>    Pin number connected to RFM69 IRQ pin.
    

    For the bonus question: I wasn't aware that there was a mapping between Raspberry Pi gpio and Arduino pins. Could you share he rest of the list?



  • @mfalkvidd I don't know what DI00 is, and if it's equivalent to IRQ ? If Yes, it's exactly what I need ! Thank you !!! 🙂 I will test it as soon as I get my RFM69

    Here is the pin mapping between RFM69W/NRF24 and Arduino/Raspberry

    Arduino mini - NRF24  - RFM69 - Raspberry GW NRF - Raspberry GW RFM 
    9            - CE     - N/A   - 22               - N/A
    10           - CSN/CS - NSS   - 24               - 24
    13           - SCK    - SCK   - 23               - 23
    11           - MOSI   - MOSI  - 19               - 19
    12           - MISO   - MISO  - 21               - 21
    2            - IRQ    - DI00  - 15               - 22
    

    So, the only mismatch breaking pin compatibility (and preventing to use adaptors on the raspberry pi gateway) is on IRQ/DI00. Adaptors wire RFM69 DI00 on NRF24 IRQ pin, but they don't use, by default, the same pin on raspberry, depending the radio type.


  • Mod

    @barrydou I don't know what dio0 is either, but https://learn.sparkfun.com/tutorials/rfm69hcw-hookup-guide/all describes it like this:

    Digital I/O 0
    RX interrupt Received data ready interrupt signal from RFM69HCW to microcontroller

    which sounds like it could be interrupt. It might be worth a try at least.



  • @mfalkvidd Thank you.
    I've found that too https://www.mysensors.org/apidocs/RFM69_8h_source.html
    It's clearly indicated that DIO0 is IRQ.

    So I think with "--my-rfm69-irq-pin=" it will do the job.

    I'll test it as soon as i'll receive RFM69.

    Thank you again



  • @marceloaqno Sorry to kick this old topic, but I will soon be trying to build my gateway with a Raspberry pi. I was wondering if the capacitor is also required for the gateway, or just for the nodes?

    Because at the instruction page on how to wire and build a Raspberry Pi gateway, the capacitor isn't mentioned.

    I'll be using a RPI 1 and NRF24L01+


  • Mod

    @rolandow yes the capacitor is needed. I'll add that info to the page. Thanks for noticing.



  • Ok, one more question. I thought I read somewhere that the wiring between the RPI and de radio should be as short as possible, but I can't find exactly where I read that anymore.

    At another project (zigbee2mqtt) I read that users had better reception when they placed the transceiver further away from the controller, because there was less inteference. So if possible, I would like to use a piece of UTP cable to wire the radio to the raspberry pi. That way I can put the rpi inside a closet, but the radio outside.

    So I am not sure if longer wires (say 2, 3 meters) is going to be a problem?


  • Mod

    @rolandow there could be a problem.

    There are two things to consider.

    1. Power drop due to resistance in the cable. See https://electronics.stackexchange.com/questions/113253/voltage-drop-and-safe-current-load-on-cat5-cable for details but use the current used by the radio (provided in the datasheet) instead of the 2.5A used in that question.

    2. SPI communication problems due to capacitance in the cable. See https://electronics.stackexchange.com/questions/163468/spi-max-distance for details. See also my post at https://forum.mysensors.org/post/92967 for oscilloscope pictures of what an i2c signal can look like through a long cable. SPI can handle longer cable lengts than i2c though.


Log in to reply
 

Suggested Topics

  • 3
  • 347
  • 584
  • 110
  • 164
  • 2

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts