Beginner question about mysensor and usage for raspberry pi and arduino project



  • I am really new to the world of IoT, and I'm trying my first RPi and Arduino project. Someone suggested the tools offered by MySensor might help me, but it wasn't clear to me how. So some of my questions are going to be extremely novice.

    My objective is to have my Raspberry Pi 3 B+ act as a gateway to receive audio data from several arduinos. The RPi and arduinos are each equipped with an nrf24l01.

    I want to know specifically how MySensor tools fits into my overall project. For example, I successfully followed each of the steps in this guide here https://www.mysensors.org/build/raspberry . Although I see that running my mysgw command produces the same output shown in the guide, it's not clear to me how I determine values like Receiving Address, Receiving Channel, Receiving Data Rate etc... I'd imagine these are values that I would need to write into my Sketch file which would then be uploaded to my Arduino? Specifically, how do I determine the values needed to be written into the brackets in the sketch code below?

    #include <SPI.h>
    #include <RF24.h>
    
    RF24 radio(7,8);
    
    void setup(){
      Serial.begin(115200);
      Serial.println(0);      //start
    
      radio.begin();
      radio.setPALevel(RF24_PA_MIN);
      radio.setDataRate(<data rate must be same as rpi>);
      radio.setChannel(<channel must be same as rpi>);
      radio.openWritingPipe(<pipe must be same as rpi>);
      radio.enableDynamicPayloads();
      radio.powerUp();
    
    }
    
    void loop() {
      const char text[] = "Hello";
    
      radio.write(&text,sizeof(text))
    }
    

    And subsequently, where does my RPi save the data it receives?

    Maybe I've completely misunderstood the purpose of mysensor. So any clarification would be great, thanks!


  • Plugin Developer

    @july It seems you indeed misunderstood a little bit.

    The cool thing about MySensors is that it takes care of all the really technical stuff for you., so you don't have to mess with the radio. Have a look at this Arduino sketch for example:

    https://www.mysensors.org/build/relay

    Once you have installed the MySensors library in Arduino it will connect to the gateway you created 'automatically'.

    A typical setup would look something like:

    • Raspberry Pi With MySensors gateway software on it, which has it's pins connected to an NRF24. On the Raspberry you also run a 'controller' such as Domoticz. It takes the data from the MySensors network and presents it to you.
    • An Arduino with the MySensors library, connected to an NRF24 as well.

    This is how the data would travel:

    temperature sensor -> Arduino with MySensors library-> NRF24
    ))))) wireless transmission )))))
    NRF24 -> Raspberry Pi -> MySensors Gateway -> Domoticz (or another controller of your choice)



  • Ahhhh, thanks @alowhum , what you said makes so much more sense. I also see some people have attempted to stream audio with Domoticz. Ok now I have a better sense of direction on what to research next. Thank you


 

308
Online

8.9k
Users

9.6k
Topics

100.9k
Posts