Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. General Discussion
  3. Raspberry Pi3 Gateway

Raspberry Pi3 Gateway

Scheduled Pinned Locked Moved General Discussion
16 Posts 3 Posters 3.3k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mfalkviddM mfalkvidd

    @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.

    rajeev2301R Offline
    rajeev2301R Offline
    rajeev2301
    wrote on last edited by
    #7

    @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: []

    mfalkviddM 1 Reply Last reply
    0
    • rajeev2301R rajeev2301

      @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: []

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by
      #8

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

      rajeev2301R 1 Reply Last reply
      0
      • mfalkviddM mfalkvidd

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

        rajeev2301R Offline
        rajeev2301R Offline
        rajeev2301
        wrote on last edited by
        #9

        @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.
        mfalkviddM 1 Reply Last reply
        0
        • rajeev2301R rajeev2301

          @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.
          mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by
          #10

          @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.

          rajeev2301R 1 Reply Last reply
          0
          • mfalkviddM mfalkvidd

            @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.

            rajeev2301R Offline
            rajeev2301R Offline
            rajeev2301
            wrote on last edited by
            #11

            @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.

            mfalkviddM 1 Reply Last reply
            0
            • rajeev2301R rajeev2301

              @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.

              mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by
              #12

              @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.

              rajeev2301R 1 Reply Last reply
              0
              • mfalkviddM mfalkvidd

                @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.

                rajeev2301R Offline
                rajeev2301R Offline
                rajeev2301
                wrote on last edited by
                #13

                @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.

                mfalkviddM 1 Reply Last reply
                0
                • gohanG Offline
                  gohanG Offline
                  gohan
                  Mod
                  wrote on last edited by
                  #14

                  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

                  1 Reply Last reply
                  1
                  • rajeev2301R rajeev2301

                    @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.

                    mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by mfalkvidd
                    #15

                    @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.

                    rajeev2301R 1 Reply Last reply
                    0
                    • mfalkviddM mfalkvidd

                      @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.

                      rajeev2301R Offline
                      rajeev2301R Offline
                      rajeev2301
                      wrote on last edited by
                      #16

                      @mfalkvidd

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

                      1 Reply Last reply
                      1
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      19

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular