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. Troubleshooting
  3. Sending data from Arduino to Raspberry Pi via NRF24L01+

Sending data from Arduino to Raspberry Pi via NRF24L01+

Scheduled Pinned Locked Moved Troubleshooting
21 Posts 3 Posters 9.1k 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.
  • gohanG Offline
    gohanG Offline
    gohan
    Mod
    wrote on last edited by
    #10

    Maybe you could take a look at this tutorial

    https://forum.mysensors.org/topic/1151/tutorial-raspberry-pi-nrf24l01-direct-connection

    mfalkviddM 1 Reply Last reply
    0
    • gohanG gohan

      Maybe you could take a look at this tutorial

      https://forum.mysensors.org/topic/1151/tutorial-raspberry-pi-nrf24l01-direct-connection

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

      @gohan better to use https://www.mysensors.org/build/raspberry which is compatible with MySensors 2.

      LaMB95L 1 Reply Last reply
      0
      • mfalkviddM mfalkvidd

        @gohan better to use https://www.mysensors.org/build/raspberry which is compatible with MySensors 2.

        LaMB95L Offline
        LaMB95L Offline
        LaMB95
        wrote on last edited by
        #12

        @mfalkvidd @gohan

        What I am trying to do is to put the arduino in my garage and send this data to something like OpenHab or Wordpress such that I can see the parking status from another location.

        And a couple of youtube tutorials I saw were able to send the data from an arduino to a pi (without any USB cable) using this radio.
        I was hoping such a method is possible using the MySensors library.

        Another question I have is what aout using a virtual serial port ? But I think I would need an ethernet shield on the arduino. Am I right?

        mfalkviddM 1 Reply Last reply
        0
        • LaMB95L LaMB95

          @mfalkvidd @gohan

          What I am trying to do is to put the arduino in my garage and send this data to something like OpenHab or Wordpress such that I can see the parking status from another location.

          And a couple of youtube tutorials I saw were able to send the data from an arduino to a pi (without any USB cable) using this radio.
          I was hoping such a method is possible using the MySensors library.

          Another question I have is what aout using a virtual serial port ? But I think I would need an ethernet shield on the arduino. Am I right?

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

          @LaMB95 I don't know about virtual serial ports but sensing data from one Arduino to a gateway (which can be a raspberry pi) is exactly what MySensors is about.

          https://www.mysensors.org/about describes how MySensors works. I suggest you start there, especially the part labelled "The sensor network"

          In MySensors terminology, the arduino in the garage will be a sensor and the raspberry pi will be a gateway.

          LaMB95L 1 Reply Last reply
          0
          • mfalkviddM mfalkvidd

            @LaMB95 I don't know about virtual serial ports but sensing data from one Arduino to a gateway (which can be a raspberry pi) is exactly what MySensors is about.

            https://www.mysensors.org/about describes how MySensors works. I suggest you start there, especially the part labelled "The sensor network"

            In MySensors terminology, the arduino in the garage will be a sensor and the raspberry pi will be a gateway.

            LaMB95L Offline
            LaMB95L Offline
            LaMB95
            wrote on last edited by
            #14

            @mfalkvidd

            I checked the page!
            It was quite helpful and I realise that a serial gateway is not something that I need.

            I need some help to understand the working of a virtual serial port.

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

              As a beginner as I am, I'd go with 2 Arduino boards and use one as gateway; it really simplify the initial setup even if you you actually have more hw. Meanwhile you could study how to use the nrf24 on the rpi3, that's more complicated and if you are not experienced it is easier to make mistakes

              LaMB95L 1 Reply Last reply
              0
              • gohanG gohan

                As a beginner as I am, I'd go with 2 Arduino boards and use one as gateway; it really simplify the initial setup even if you you actually have more hw. Meanwhile you could study how to use the nrf24 on the rpi3, that's more complicated and if you are not experienced it is easier to make mistakes

                LaMB95L Offline
                LaMB95L Offline
                LaMB95
                wrote on last edited by
                #16

                @gohan

                Well considering how difficult it seems at times I think I will stick to it for now.

                Could you point me towards the tutorial you used for your project?
                I might try to create something for the time being with your help!

                Thanks !

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

                  For the serial gateway just read https://www.mysensors.org/build/serial_gateway , it's quite straight forward as you just need to use the code in the example in the library and choose your customization options in the #DEFINE at the beginning of the code (DEBUG, type of radio, power level, if you want the 3 monitoring blinking leds); things get a little more complicated for the sensor nodes if you want to have more sensors attached to a single node, because you need to copy multiple code from examples and try to blend everything together; but if you start with a simple sensor node and tinker a little with it, then you can add more and more complexity looking for ideas around the forum or just google around.
                  To me the most difficult part has been getting the radio working because I bought some crappy modules that I had then replaced with working ones and that cost me a lot of time because I was afraid I was doing mistakes but I actually did everything correctly (as soon as I plugged in the new modules it started to work).
                  After I got communication established I just configured in domoticz a new hardware and I could choose either serial/Ethernet/mqtt mysensors gateway and that was it. As soon as you add new sensors that present themselves you can find them as "unused" sensors in the controller; after that it's all up to you. If you don't like the controller just install a new one and connect the gateway to it and you are ready to go.

                  LaMB95L 1 Reply Last reply
                  0
                  • gohanG gohan

                    For the serial gateway just read https://www.mysensors.org/build/serial_gateway , it's quite straight forward as you just need to use the code in the example in the library and choose your customization options in the #DEFINE at the beginning of the code (DEBUG, type of radio, power level, if you want the 3 monitoring blinking leds); things get a little more complicated for the sensor nodes if you want to have more sensors attached to a single node, because you need to copy multiple code from examples and try to blend everything together; but if you start with a simple sensor node and tinker a little with it, then you can add more and more complexity looking for ideas around the forum or just google around.
                    To me the most difficult part has been getting the radio working because I bought some crappy modules that I had then replaced with working ones and that cost me a lot of time because I was afraid I was doing mistakes but I actually did everything correctly (as soon as I plugged in the new modules it started to work).
                    After I got communication established I just configured in domoticz a new hardware and I could choose either serial/Ethernet/mqtt mysensors gateway and that was it. As soon as you add new sensors that present themselves you can find them as "unused" sensors in the controller; after that it's all up to you. If you don't like the controller just install a new one and connect the gateway to it and you are ready to go.

                    LaMB95L Offline
                    LaMB95L Offline
                    LaMB95
                    wrote on last edited by
                    #18

                    @gohan

                    SO what changes did you make to the gateway arduino in order to recieve the data from a sensor node?

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

                      Here is the code of my ethernet gateway, so for serial just ignore all the part about network and w5100

                      // Enable debug prints to serial monitor
                      #define MY_DEBUG
                      
                      // Enable and select radio type attached
                      #define MY_RADIO_NRF24
                      //#define MY_RADIO_RFM69
                      
                      #define MY_RF24_PA_LEVEL RF24_PA_MAX
                      
                      // Enable gateway ethernet module type
                      #define MY_GATEWAY_W5100
                      
                      // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
                      //#define MY_W5100_SPI_EN 4
                      
                      // Enable Soft SPI for NRF radio (note different radio wiring is required)
                      // The W5100 ethernet module seems to have a hard time co-operate with
                      // radio on the same spi bus.
                      #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
                      #define MY_SOFTSPI
                      #define MY_SOFT_SPI_SCK_PIN 14
                      #define MY_SOFT_SPI_MISO_PIN 16
                      #define MY_SOFT_SPI_MOSI_PIN 15
                      #endif
                      
                      // When W5100 is connected we have to move CE/CSN pins for NRF radio
                      #ifndef MY_RF24_CE_PIN
                      #define MY_RF24_CE_PIN 5
                      #endif
                      #ifndef MY_RF24_CS_PIN
                      #define MY_RF24_CS_PIN 6
                      #endif
                      
                      // Enable to UDP
                      //#define MY_USE_UDP
                      
                      //#define MY_IP_ADDRESS 192,168,178,66   // If this is disabled, DHCP is used to retrieve address
                      // Renewal period if using DHCP
                      #define MY_IP_RENEWAL_INTERVAL 60000
                      // The port to keep open on node server mode / or port to contact in client mode
                      #define MY_PORT 5003
                      
                      // Controller ip address. Enables client mode (default is "server" mode).
                      // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
                      //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
                      
                      // The MAC address can be anything you want but should be unique on your network.
                      // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                      // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                      // #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
                      
                      // Enable inclusion mode
                      #define MY_INCLUSION_MODE_FEATURE
                      // Enable Inclusion mode button on gateway
                      //#define MY_INCLUSION_BUTTON_FEATURE
                      // Set inclusion mode duration (in seconds)
                      #define MY_INCLUSION_MODE_DURATION 60
                      // Digital pin used for inclusion mode button
                      //#define MY_INCLUSION_MODE_BUTTON_PIN  3
                      
                      // Set blinking period
                      #define MY_DEFAULT_LED_BLINK_PERIOD 300
                      
                      // Flash leds on rx/tx/err
                      // Uncomment to override default HW configurations
                      #define MY_DEFAULT_ERR_LED_PIN 1  // Error led pin
                      #define MY_DEFAULT_RX_LED_PIN  2  // Receive led pin
                      #define MY_DEFAULT_TX_LED_PIN  3  // Transmit led pin
                      
                      
                      #if defined(MY_USE_UDP)
                      #include <EthernetUdp.h>
                      #endif
                      #include <Ethernet.h>
                      #include <MySensors.h>
                      
                      
                      void setup()
                      {
                      }
                      
                      void loop()
                      {
                      }
                      

                      In MyConfig.h i changed these so it applies to all nodes/gateways

                      // Enables RF24 encryption (all nodes and gateway must have this enabled, and all must be personalized with the same AES key)
                      //#define MY_RF24_ENABLE_ENCRYPTION
                      #define MY_RF24_ENABLE_ENCRYPTION
                      #define MY_RF24_ENCRYPTKEY 0x15,0x12,0x11,0x08,0x01,0x07,0x01,0x03,0x016,0x14,0x15,0x05,0x03,0x09,0x16,0x07
                      
                      #ifndef MY_RF24_CHANNEL
                      #define MY_RF24_CHANNEL	1
                      #endif
                      
                      LaMB95L 1 Reply Last reply
                      0
                      • gohanG gohan

                        Here is the code of my ethernet gateway, so for serial just ignore all the part about network and w5100

                        // Enable debug prints to serial monitor
                        #define MY_DEBUG
                        
                        // Enable and select radio type attached
                        #define MY_RADIO_NRF24
                        //#define MY_RADIO_RFM69
                        
                        #define MY_RF24_PA_LEVEL RF24_PA_MAX
                        
                        // Enable gateway ethernet module type
                        #define MY_GATEWAY_W5100
                        
                        // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
                        //#define MY_W5100_SPI_EN 4
                        
                        // Enable Soft SPI for NRF radio (note different radio wiring is required)
                        // The W5100 ethernet module seems to have a hard time co-operate with
                        // radio on the same spi bus.
                        #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
                        #define MY_SOFTSPI
                        #define MY_SOFT_SPI_SCK_PIN 14
                        #define MY_SOFT_SPI_MISO_PIN 16
                        #define MY_SOFT_SPI_MOSI_PIN 15
                        #endif
                        
                        // When W5100 is connected we have to move CE/CSN pins for NRF radio
                        #ifndef MY_RF24_CE_PIN
                        #define MY_RF24_CE_PIN 5
                        #endif
                        #ifndef MY_RF24_CS_PIN
                        #define MY_RF24_CS_PIN 6
                        #endif
                        
                        // Enable to UDP
                        //#define MY_USE_UDP
                        
                        //#define MY_IP_ADDRESS 192,168,178,66   // If this is disabled, DHCP is used to retrieve address
                        // Renewal period if using DHCP
                        #define MY_IP_RENEWAL_INTERVAL 60000
                        // The port to keep open on node server mode / or port to contact in client mode
                        #define MY_PORT 5003
                        
                        // Controller ip address. Enables client mode (default is "server" mode).
                        // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
                        //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
                        
                        // The MAC address can be anything you want but should be unique on your network.
                        // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                        // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                        // #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
                        
                        // Enable inclusion mode
                        #define MY_INCLUSION_MODE_FEATURE
                        // Enable Inclusion mode button on gateway
                        //#define MY_INCLUSION_BUTTON_FEATURE
                        // Set inclusion mode duration (in seconds)
                        #define MY_INCLUSION_MODE_DURATION 60
                        // Digital pin used for inclusion mode button
                        //#define MY_INCLUSION_MODE_BUTTON_PIN  3
                        
                        // Set blinking period
                        #define MY_DEFAULT_LED_BLINK_PERIOD 300
                        
                        // Flash leds on rx/tx/err
                        // Uncomment to override default HW configurations
                        #define MY_DEFAULT_ERR_LED_PIN 1  // Error led pin
                        #define MY_DEFAULT_RX_LED_PIN  2  // Receive led pin
                        #define MY_DEFAULT_TX_LED_PIN  3  // Transmit led pin
                        
                        
                        #if defined(MY_USE_UDP)
                        #include <EthernetUdp.h>
                        #endif
                        #include <Ethernet.h>
                        #include <MySensors.h>
                        
                        
                        void setup()
                        {
                        }
                        
                        void loop()
                        {
                        }
                        

                        In MyConfig.h i changed these so it applies to all nodes/gateways

                        // Enables RF24 encryption (all nodes and gateway must have this enabled, and all must be personalized with the same AES key)
                        //#define MY_RF24_ENABLE_ENCRYPTION
                        #define MY_RF24_ENABLE_ENCRYPTION
                        #define MY_RF24_ENCRYPTKEY 0x15,0x12,0x11,0x08,0x01,0x07,0x01,0x03,0x016,0x14,0x15,0x05,0x03,0x09,0x16,0x07
                        
                        #ifndef MY_RF24_CHANNEL
                        #define MY_RF24_CHANNEL	1
                        #endif
                        
                        LaMB95L Offline
                        LaMB95L Offline
                        LaMB95
                        wrote on last edited by
                        #20

                        @gohan
                        Thanks for the code!

                        I have been trying to send data from an Uno to a pro mini. Unfortunately, I have been receiving symbols and gibberish on the mini as it has be assigned as a receiver.
                        Any clue why?
                        I was hoping to send the collected data from the pro mini to the RPi3 via serial gateway and then to Domoticz.

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

                          You probably got the serial port speed wrong on the serial monitor

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


                          18

                          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