Raspberry Pi3 Gateway



  • When I am running command to setup PiGatewaySerial , I get the below error. ![alt text](![image url](image url))

    Raspberry $ make all && sudo make install

    g++ -c -o PiGatewaySerial.o PiGatewaySerial.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
    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 ./MyMessage.h:37,
    from ./MySensor.h:18,
    from ./MyGateway.h:16,
    from PiGatewaySerial.cpp:36:
    /usr/include/c++/6/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
    min(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
    /usr/include/c++/6/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
    In file included from ./MySensor.h:18:0,
    from ./MyGateway.h:16,
    from PiGatewaySerial.cpp:36:
    /usr/include/c++/6/bits/stl_algobase.h:195:5: error: expected unqualified-id before ‘const’
    min(const _Tp& __a, const _Tp& __b)
    ^
    /usr/include/c++/6/bits/stl_algobase.h:195:5: error: expected ‘)’ before ‘const’
    /usr/include/c++/6/bits/stl_algobase.h:195:5: error: expected initializer before ‘const’
    /usr/include/c++/6/bits/stl_algobase.h:219:5: error: expected unqualified-id before ‘const’
    max(const _Tp& __a, const _Tp& __b)
    ^
    /usr/include/c++/6/bits/stl_algobase.h:219:5: error: expected ‘)’ before ‘const’
    /usr/include/c++/6/bits/stl_algobase.h:219:5: error: expected initializer before ‘const’
    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 ./MyMessage.h:37,
    from ./MySensor.h:18,
    from ./MyGateway.h:16,
    from PiGatewaySerial.cpp:36:
    /usr/include/c++/6/bits/stl_algobase.h:243:5: error: ‘std::min’ declared as an ‘inline’ variable
    min(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^~~
    /usr/include/c++/6/bits/stl_algobase.h:246:7: error: expected primary-expression before ‘if’
    if (__comp(__b, __a))
    ^~
    /usr/include/c++/6/bits/stl_algobase.h:246:7: error: expected ‘}’ before ‘if’
    /usr/include/c++/6/bits/stl_algobase.h:246:7: error: expected ‘;’ before ‘if’
    /usr/include/c++/6/bits/stl_algobase.h:248:7: error: expected unqualified-id before ‘return’
    return __a;
    ^~~~~~
    /usr/include/c++/6/bits/stl_algobase.h:265:5: error: ‘max’ declared as an ‘inline’ variable
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^~~
    /usr/include/c++/6/bits/stl_algobase.h:268:7: error: expected primary-expression before ‘if’
    if (__comp(__a, __b))
    ^~
    /usr/include/c++/6/bits/stl_algobase.h:268:7: error: expected ‘}’ before ‘if’
    /usr/include/c++/6/bits/stl_algobase.h:268:7: error: expected ‘;’ before ‘if’
    /usr/include/c++/6/bits/stl_algobase.h:270:7: error: expected unqualified-id before ‘return’
    return __a;
    ^~~~~~
    /usr/include/c++/6/bits/stl_algobase.h:271:5: error: expected declaration before ‘}’ token
    }
    ^
    Makefile:61: recipe for target 'PiGatewaySerial.o' failed
    make: *** [PiGatewaySerial.o] Error 1


  • Mod

    @rajeev2301 could you post the configure command you used and what linux distribution you are running on the pi? Which version of MySensors are you using?



  • @mfalkvidd

    I. am using Raspbian which was achieved through NOOBs


  • Mod

    @rajeev2301 please also include the configure settings you used and what mysensors version you are using



  • [0_1516950236523_config.txt](Uploading 100%) @gohan
    Please find the attached config settings.
    Sensor version : git clone https://github.com/TMR20/RF24.git

    <<problem comes here, when I tried installing PiRaspberrySerial========================>>

    pi@raspberrypi:~ $ git clone https://github.com/mysensors/Raspberry.git
    Cloning into 'Raspberry'...
    remote: Counting objects: 292, done.
    remote: Total 292 (delta 0), reused 0 (delta 0), pack-reused 292
    Receiving objects: 100% (292/292), 220.51 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (126/126), done.
    pi@raspberrypi:~ $ cd Raspberry
    pi@raspberrypi:~/Raspberry $ make all && make install
    g++ -c -o MyGateway.o MyGateway.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
    MyGateway.cpp: In member function ‘void MyGateway::setInclusionMode(boolean)’:
    MyGateway.cpp:234:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
    if (newMode != inclusionMode)
    ^~
    MyGateway.cpp:237:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
    serial(PSTR("0;0;%d;0;%d;%d\n"), C_INTERNAL, I_INCLUSION_MODE, inclusionMode?1:0);
    ^~~~~~
    g++ -c -o MySensor.o MySensor.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
    g++ -c -o MyMessage.o MyMessage.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
    g++ -c -o PiEEPROM.o PiEEPROM.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
    g++ -c -o PiGateway.o PiGateway.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
    g++ -o PiGateway MyGateway.o MySensor.o MyMessage.o PiEEPROM.o PiGateway.o -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24 -lrf24-bcm
    g++ -c -o PiGatewaySerial.o PiGatewaySerial.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
    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 ./MyMessage.h:37,
    from ./MySensor.h:18,
    from ./MyGateway.h:16,
    from PiGatewaySerial.cpp:36:
    /usr/include/c++/6/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
    min(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
    /usr/include/c++/6/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
    In file included from ./MySensor.h:18:0,
    from ./MyGateway.h:16,
    from PiGatewaySerial.cpp:36:
    /usr/include/c++/6/bits/stl_algobase.h:195:5: error: expected unqualified-id before ‘const’
    min(const _Tp& __a, const _Tp& __b)
    ^
    /usr/include/c++/6/bits/stl_algobase.h:195:5: error: expected ‘)’ before ‘const’
    /usr/include/c++/6/bits/stl_algobase.h:195:5: error: expected initializer before ‘const’
    /usr/include/c++/6/bits/stl_algobase.h:219:5: error: expected unqualified-id before ‘const’
    max(const _Tp& __a, const _Tp& __b)
    ^
    /usr/include/c++/6/bits/stl_algobase.h:219:5: error: expected ‘)’ before ‘const’
    /usr/include/c++/6/bits/stl_algobase.h:219:5: error: expected initializer before ‘const’
    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 ./MyMessage.h:37,
    from ./MySensor.h:18,
    from ./MyGateway.h:16,
    from PiGatewaySerial.cpp:36:
    /usr/include/c++/6/bits/stl_algobase.h:243:5: error: ‘std::min’ declared as an ‘inline’ variable
    min(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^~~
    /usr/include/c++/6/bits/stl_algobase.h:246:7: error: expected primary-expression before ‘if’
    if (__comp(__b, __a))
    ^~
    /usr/include/c++/6/bits/stl_algobase.h:246:7: error: expected ‘}’ before ‘if’
    /usr/include/c++/6/bits/stl_algobase.h:246:7: error: expected ‘;’ before ‘if’
    /usr/include/c++/6/bits/stl_algobase.h:248:7: error: expected unqualified-id before ‘return’
    return __a;
    ^~~~~~
    /usr/include/c++/6/bits/stl_algobase.h:265:5: error: ‘max’ declared as an ‘inline’ variable
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^~~
    /usr/include/c++/6/bits/stl_algobase.h:268:7: error: expected primary-expression before ‘if’
    if (__comp(__a, __b))
    ^~
    /usr/include/c++/6/bits/stl_algobase.h:268:7: error: expected ‘}’ before ‘if’
    /usr/include/c++/6/bits/stl_algobase.h:268:7: error: expected ‘;’ before ‘if’
    /usr/include/c++/6/bits/stl_algobase.h:270:7: error: expected unqualified-id before ‘return’
    return __a;
    ^~~~~~
    /usr/include/c++/6/bits/stl_algobase.h:271:5: error: expected declaration before ‘}’ token
    }
    ^
    Makefile:61: recipe for target 'PiGatewaySerial.o' failed
    make: *** [PiGatewaySerial.o] Error 1


  • Mod

    @rajeev2301 the raspberry pi code you are trying to use isn't functional anymore. Use the instructions at https://www.mysensors.org/build/raspberry instead.

    Do you remember where you found the instructions you are following? We should try to get them removed if we can, so they don't fool someone else.



  • @mfalkvidd Thanks a lot ! I followed the exact process at https://www.mysensors.org/build/raspberry.It looks like I have the required environment setup correctly. But when I run the below code , I still don't receive the correct message comming from Arduino ( I am using NRFL01 transceivers) .. Please suggest what am I missing..

    mport RPi.GPIO as GPIO
    from lib_nrf24 import NRF24
    import time
    import spidev

    GPIO.setmode(GPIO.BCM)

    pipes = [[0xE8, 0xE8, 0xF0, 0xF0, 0xE1], [0xF0, 0xF0, 0xF0, 0xF0, 0xE1]]
    radio = NRF24(GPIO, spidev.SpiDev())

    radio.begin(0,8)

    radio.setPayloadSize(32)
    radio.setChannel(0x76)
    radio.setDataRate(NRF24.BR_1MBPS)
    radio.setPALevel (NRF24.PA_MAX)
    radio.setAutoAck(True)
    radio.enableDynamicPayloads()
    radio.enableAckPayload()
    radio.openReadingPipe(1 ,pipes[1])
    radio.printDetails()
    radio.startListening()
    radio.GPIO.cleanup()

    while True:

    while not radio.available(0):
       time.sleep(1/100)
       
    Temp = []
    radio.read(Temp, radio.getDynamicPayloadSize())
    print("Received Temp: {}".format(Temp))
    print("Translating our received Message into Unicode character...")
    
    string1 = ""
    for n in Temp:
              if (n >=32 and n <= 126):
                 string1 += chr(n)
    print (" Our received message decodes to : {} ".format(string1))
    

    ===============output =========
    STATUS = 0x01 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=1
    RX_ADDR_P0-1 � =
    0x001effffff 0xffffffffff
    RX_ADDR_P2-5 � =
    0xff
    0xfe
    0xfe
    0xfe

    TX_ADDR =
    0xffffffffff
    RX_PW_P0-6 � =
    0x00
    0x00
    0x00
    0x00
    0x00
    0x00

    EN_AA =
    0x03

    EN_RXADDR � =
    0x00

    RF_CH =
    0x07

    RF_SETUP � =
    0x00

    CONFIG =
    0x00

    DYNPD/FEATURE � =
    0x00
    0x00

    Data Rate = 1MBPS
    Model = nRF24L01
    CRC Length = Disabled
    PA Power = PA_MIN
    Received: [4]
    Translating the receivedMessage into unicode characters
    Out received message decodes to:
    Received: [5]
    Translating the receivedMessage into unicode characters
    Out received message decodes to:
    Received: []
    Translating the receivedMessage into unicode characters
    Out received message decodes to:
    Received: []
    Translating the receivedMessage into unicode characters
    Out received message decodes to:
    Received: []
    Translating the receivedMessage into unicode characters
    Out received message decodes to:
    Received: []


  • Mod

    @rajeev2301 that looks like python code. To my knowledge, MySensors does not have any pyhon code. I'm completely lost. Sorry.



  • @mfalkvidd

    1. What is your recommendation for doing general programming on raspeberry Pi?
    2. if not python , what code/programming language do you recommend to setup a serial gateway on raspberry pi so that I can receive messages from multiple arduino,s.

  • Mod

    @rajeev2301 I would suggest no programming at all. Just create a raspberry pi gateway and connect a controller to it.

    If you want to program yourself, use the serial api and connect to the gateway using a tcp, mqtt or serial port connection.



  • @mfalkvidd

    Thanks , I really appreciate your time for helping me out on this. I have recently started diggging into IOT world so I may be asking a trivial question. ( my apology and Thanks in advance

    I have a following scenario:

    I am trying to pull the temperature and humidity data from Arduino Nano and then transmitting it through NRF24L01 transreceivers. It works perfectly fine between arduino to Arduino Communication. However I am stuck when I am trying to receive the same information into my Raspeberry Pi3.
    I believe , I have successfully setup a gateway by following step by step instruction (https://www.mysensors.org/build/raspberry) but now I want to receive the message relaying through my Arduino Nano for which I need to write a code in Raspberry Pi. That’s the reason I am writing a simple python code to receive that message. Please suggest if there are alternate way to receive the message from my arduino’s.

    Thanks again for your kind guidance.


  • Mod

    @rajeev2301 thanks for explaining your use case.

    You can compile the MySensors raspbery pi gateway as an ethernet gateway, and let your python program connect to the raspberry pi gateway using tcp. The python program would not be concerned with nrf at all. MySensors will present sensor information the same way regardless which transport (nrf, rfm or rs485) used by the sensors.

    The information presented by the gateway will follow the specification of the serial protocol that I linked earlier.



  • @mfalkvidd

    Thanks , really appreciate your quick response. Yes , I am aware of TCP but isn’t that it needs an Internet for communication.My plan is to exchange data between sensors wirelessly using radio frequency ( e.g, NRF24L01) so that I don’t have dependency on TCP/Internet. Also, my plan is to create a master-slave kind of setup. Where all sensor’s data really into central raspberry pi environment and then I can play around with dataset from multiple sources.
    Your guidance would be highly appreciated.


  • Mod

    If I were you I'd start looking at controllers like Domoticz, MyController, Home Assistant, Node-red etc etc, as there is already documentation on how to connect to a MySensors gateway and the rest


  • Mod

    @rajeev2301 it sounds like you want to do pretty much what MySensor does, but you want to program every detail yourself? If that's the case, MySensors might not be the right forum/library. Most people use MySensors because they don't want to program all the details themselves. We just want a communication network, and that's what MySensors provides.



  • @mfalkvidd

    Thanks for your valuable input. I think I got some direction to move on.


Log in to reply
 

Suggested Topics

  • 4
  • 2
  • 3
  • 4
  • 9
  • 8

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts