Implementing Controller(arduino yun) In Gateway



  • Because none of controllers fit my needs(which is hydroponic greenhouse automation), I want to code my greenhouse automation in gateway, the reason for that is there is no MySensors code for Raspberry PI, but there is for arduino.
    What I need is some help with;
    " How do I pull data to use in my controller code which is actually the gateway instead of forwarding to Raspberry PI. Can you help me with a sample code showing how it can be done?".


  • Admin

    You don't necessarily need to put the code in the actual gateway if you don't want. You can put it on any node your radio network and let the greenhouse and controller communicate by sending messages between each-other.
    Just set static id's like I do below.

    (development branch example code)

    In your controller sketch

    #define MY_NODE_ID 47
    #define MY_RADIO_NRF24
    #define MY_RADIO_RFM69
    #include <SPI.h>
    #include <MySensor.h>
    
    void receive(const MyMessage &message) {
      // Handle incoming messages from your "greenhouse"
    }
    

    And in your "greenhouse" sketch

    #define MY_NODE_ID 11
    #define MY_RADIO_NRF24
    #define MY_RADIO_RFM69
    #include <SPI.h>
    #include <MySensor.h>
    
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP)
    
    void setup() {
        msgHum.setDestination(47);
        msgTemp.setDestination(47);
    }
    
    void loop() {
        send(msgHum.set(87));
        send(msgTemp.set(32));
        wait(10000); // Wait 10 seconds
    }
    
    void receive(const MyMessage &message) {
      // Handle incoming messages from your controller
    }


  • You mention an Arduino Yún. I don't know if this thread Ethernet Gateway on Arduino Yún is of any interest or help. It ports the gateway code to the Arduino bit enabling a controller to run under Linux on the same board.



  • @hek I am sorry but I am confused; what do you mean by controller and what do you mean by greenhouse, by greenhouse do you mean sensors and actuators???
    And also do you suggest having one gateway acting as gateway and also have another arduino having gateway code but used as controller???


  • Admin

    Maybe you could start with explaining exactly what you want to do? 🙂

    I presumed you wanted to control something in your green house via radio link from some other place... the "green-house-controller" without the need of setting up a gateway to the outside world (I.e full fledged controller software).



  • @hek No, the problem is there is no controller on this site that I can use, so I have to write code for my controller, simple one just to fit my needs, but the problem is "mysensors library is not used on the raspberry pi" so controller code will have to run on arduino.


  • Admin

    You mean a standalone arduino sketch running in your greenhouse? No radio communication or anything else MySensors related?

    Hmm.. sorry, can't help you with that one. Guess you need to learn the Arduino basics and start playing around.



  • @hek You got it wrong, of course I want sensors and actuators to be controlled wirelessly, if not why would I want to use MySensors Library, but to write controller on raspberry pi without having mysensors library for Rasp.Pi is too complicated for me, so I decided to do it on arduino since you have the library for arduino, that is all.


  • Plugin Developer

    @azlan said:

    @hek You got it wrong, of course I want sensors and actuators to be controlled wirelessly, if not why would I want to use MySensors Library, but to write controller on raspberry pi without having mysensors library for Rasp.Pi is too complicated for me, so I decided to do it on arduino since you have the library for arduino, that is all.

    @azlan If you elaborate what exactly you are going to do with your greenhouse project, many people will help you here to choose controller for you. I hope definitely a controller will fulfill your requirement.



  • @hek Hi There,
    Thank you for your help,
    I am trying to understand this code. On controller side you define the sensor with first line, but there will be multiple sensors so how do you determine on "void receive()" method that from which sensor we receive the data?


  • Admin

    You'll have to inspect the MyMessage. Many of the actuator examples does this.



  • @hek So you do not want to help no more...


  • Admin



  • @hek Hi There,
    Does MySensors library has any similarities with RF24.h library, for example for receiving data could this"radio.read(&text, sizeof(text));" be used.



  • hey guys, so i want to make a controller for my green house could anyone help me? from what i need to build what platform should i use and a wiring schematic to fit such a design? plz help



  • @phill No one is helping here.............


Log in to reply
 

Suggested Topics

14
Online

11.4k
Users

11.1k
Topics

112.7k
Posts