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. Hardware
  3. rboard - Cheap relay/radio/arduino board ~$10

rboard - Cheap relay/radio/arduino board ~$10

Scheduled Pinned Locked Moved Hardware
57 Posts 15 Posters 28.3k Views 7 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.
  • D Offline
    D Offline
    Dean
    wrote on last edited by
    #34

    I've decided to try and do a little more with this board. I initially programmed it to only operate the relay on and off to activate the garage door opener, but it's time for me to push myself lol and do more :-)

    The problem with how I have it now, is that my Vera 3 doesn't know if the door is open or closed. I was going to add a tilt sensor to the board and have that mounted to the actual door, which I think would mean that it could send a message reporting if it is closed or not. But then I started thinking about the example above which included a switch.

    So using the relay and the switch to operate the garage door, would that then work to keep Vera 3 in the loop as to whether or not the door is open or closed?

    If I don't get a response soon, I'll just build it and see what happens :-)

    Thanks in advance for everyones help! I have already learnt a lot from this site :-)

    1 Reply Last reply
    0
    • greglG Offline
      greglG Offline
      gregl
      Hero Member
      wrote on last edited by gregl
      #35

      Hi Dean,

      Rather than use a tilt sensor and mount the mini rboard to the moving door, why not just use a reed switch? then you can mount the rboard next to your door controller and run cheap speaker wire to a reed switch and the magnet attached to the moving door..

      Here is a sketch i use for my garage door using reed switch
      https://codebender.cc/sketch:44296

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Dean
        wrote on last edited by
        #36

        Thanks for the tips @gregl!

        I am trying to see if I can build this with the sensors that I have, so I can keep my wife happy. So far I am not doing a very good job lol

        One of my problems is not knowing which pin is what on this board. I see that you stated above that A0 is D14; how do you find this out?

        The other thing I was wondering about is this: If I set up this sensor and garage door to only ever open/close using either my controller sending the message or me pressing a button, then do I even need a reed switch to determine what state the door is in? Can the sketch keep count of the state?

        I like your suggested sketch above; in fact I like both examples, and would like to merge the two. The one above with the motion sensor- I don't need that bit, but I like having a temp sensor. What I would like to do is have the temp sensor and instead of the motion sensor I have a switch. Does that sound possible?

        My wife has given me the rest of the night off, so I'll see what I can come up with :-)

        1 Reply Last reply
        0
        • D Offline
          D Offline
          Dean
          wrote on last edited by
          #37

          I just worked out where you get the info regarding what pin is what :-) you have a link in the sketch :-)

          1 Reply Last reply
          0
          • D Offline
            D Offline
            Dean
            wrote on last edited by
            #38

            lol scratch that last comment.... I have been looking at that PDF and I have no idea how the A0 pin is D14.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              Dean
              wrote on last edited by
              #39

              Ok what I have done is uploaded the sketch that is exampled above which has the temp sensor. Instead of the motion sensor, I will use a switch, and I'll connect the two wires to the 433 module spot; one wire to GND, and the other to DATA. I am hoping that this will mean that when the switch is activated it will operate.

              Gonna go test :-)

              1 Reply Last reply
              0
              • D Offline
                D Offline
                Dean
                wrote on last edited by
                #40

                lol I ended up with a board that now malfunctions sometimes :-) For some reason the relay began to turn on and off repeatedly, then it stopped working altogether, and now it seems to be working as it should... when my son was running past me the other day which lead to the board falling on the ground, it must have fixed whatever the problem is! In any case, I won't be using that relay for anything too important. I have it in my garage now; it opens and closes the garage door, has a motion sensor and tells me if someone goes into the garage, and it is also sending me the temperature outside. I am happy :-)

                So now I want to use another one of these boards to turn a light on, but I want to also have a separate switch which will operate through the board. So basically I am going to use the Garagedoor sketch mentioned above, which is the same as the "Relay with button actuator". I understand what pins I need to assign, but I am a little confused as to how I need to wire up the switch. Am I just completing a circuit, or am I supplying power as the trigger?

                RJ_MakeR 1 Reply Last reply
                0
                • greglG Offline
                  greglG Offline
                  gregl
                  Hero Member
                  wrote on last edited by
                  #41

                  What voltage are you giving the board?
                  I think i recall having an issue when i was giving it just 5v... i think at 6/7v the issue went away....

                  1 Reply Last reply
                  0
                  • D Dean

                    lol I ended up with a board that now malfunctions sometimes :-) For some reason the relay began to turn on and off repeatedly, then it stopped working altogether, and now it seems to be working as it should... when my son was running past me the other day which lead to the board falling on the ground, it must have fixed whatever the problem is! In any case, I won't be using that relay for anything too important. I have it in my garage now; it opens and closes the garage door, has a motion sensor and tells me if someone goes into the garage, and it is also sending me the temperature outside. I am happy :-)

                    So now I want to use another one of these boards to turn a light on, but I want to also have a separate switch which will operate through the board. So basically I am going to use the Garagedoor sketch mentioned above, which is the same as the "Relay with button actuator". I understand what pins I need to assign, but I am a little confused as to how I need to wire up the switch. Am I just completing a circuit, or am I supplying power as the trigger?

                    RJ_MakeR Offline
                    RJ_MakeR Offline
                    RJ_Make
                    Hero Member
                    wrote on last edited by
                    #42

                    @Dean So let me get this straight,, You are using that board to "opens and closes the garage door, has a motion sensor and tells me if someone goes into the garage, and it is also sending me the temperature outside . I am happy ...." and you don't consider that contrary to "I won't be using that relay for anything too important." ?

                    Did I understand you correctly?

                    RJ_Make

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      Dean
                      wrote on last edited by
                      #43

                      @gregl thanks for your suggestion, that thought actually did come to mind when I was trying to troubleshoot what was going on. I had been using 4 AA batteries to power it, and they had been used for quite some time, so I ended up locating an old mobile phone charger and used that to power it. The board has been working reliably every since, but I am reluctant to use the board for anything important.

                      @ServiceXp yes you heard me right :-) the board is currently doing all those things, but I'm not depending on it. My wife is home all the time, so if for some reason the relay decides to open the garage, she will hear it and close out back up. It is my first sensor, and even though it hasn't come together as well as all of you, in still proud of myself for building it, and even though it's reliability is debatable, I like the idea of keeping it running at this stage because it gives me a smile every time I open the Vera dashboard :-)

                      So can anyone give me a little hand with how the actual switch part is supposed to work? Thanks in advance :-)

                      RJ_MakeR 1 Reply Last reply
                      0
                      • D Dean

                        @gregl thanks for your suggestion, that thought actually did come to mind when I was trying to troubleshoot what was going on. I had been using 4 AA batteries to power it, and they had been used for quite some time, so I ended up locating an old mobile phone charger and used that to power it. The board has been working reliably every since, but I am reluctant to use the board for anything important.

                        @ServiceXp yes you heard me right :-) the board is currently doing all those things, but I'm not depending on it. My wife is home all the time, so if for some reason the relay decides to open the garage, she will hear it and close out back up. It is my first sensor, and even though it hasn't come together as well as all of you, in still proud of myself for building it, and even though it's reliability is debatable, I like the idea of keeping it running at this stage because it gives me a smile every time I open the Vera dashboard :-)

                        So can anyone give me a little hand with how the actual switch part is supposed to work? Thanks in advance :-)

                        RJ_MakeR Offline
                        RJ_MakeR Offline
                        RJ_Make
                        Hero Member
                        wrote on last edited by RJ_Make
                        #44

                        @Dean Does the build make it difficult to swap out the rboard, and demote that temperamental rboard to say controlling a light? For me, I consider the garage door to be one of those more important functions.. :-)

                        You will wire one side of the switch to the pin you want to use on the rboard and the other side to GND. When you initialize the pin, you need to use INPUT_PULLUP eg: pinMode(buttonPin, INPUT_PULLUP)

                        http://arduino.cc/en/Reference/pinMode

                        Hope that helps...

                        RJ_Make

                        D 1 Reply Last reply
                        0
                        • RJ_MakeR RJ_Make

                          @Dean Does the build make it difficult to swap out the rboard, and demote that temperamental rboard to say controlling a light? For me, I consider the garage door to be one of those more important functions.. :-)

                          You will wire one side of the switch to the pin you want to use on the rboard and the other side to GND. When you initialize the pin, you need to use INPUT_PULLUP eg: pinMode(buttonPin, INPUT_PULLUP)

                          http://arduino.cc/en/Reference/pinMode

                          Hope that helps...

                          D Offline
                          D Offline
                          Dean
                          wrote on last edited by
                          #45

                          @ServiceXp said:

                          @Dean Does the build make it difficult to swap out the rboard, and demote that temperamental rboard to say controlling a light? For me, I consider the garage door to be one of those more important functions.. :-)

                          You will wire one side of the switch to the pin you want to use on the rboard and the other switch to GND. When you initialize the pin, you need to use INPUT_PULLUP eg: pinMode(buttonPin, INPUT_PULLUP)

                          http://arduino.cc/en/Reference/pinMode

                          Hope that helps...

                          Hi @ServiceXp , that is the exact info I was after! Thank you very much :-)

                          At present the build is just the board, radio and motion sensor all just wired up and sitting above the lightswitch in the garage. For me it was kind of a test to see if I could do this. Like I said, my wife is home all the time so there is no way the garage door will open without someone knowing. If the board keeps working as it is presently, then I'll feel more confident in using the board again somewhere else. But so far it is working very well, which I am very pleased about :-) But you're right, keeping a garage secure is something that is usually pretty important, the other thing is that there is no internal access into our home, so between that and my wife being home, personally I am ok with the present arrangement.

                          Thanks again for your help!

                          1 Reply Last reply
                          0
                          • gaduG Offline
                            gaduG Offline
                            gadu
                            wrote on last edited by
                            #46

                            Cool, this one is also interesting!

                            http://imall.iteadstudio.com/im120618001.html

                            D 1 Reply Last reply
                            0
                            • gaduG gadu

                              Cool, this one is also interesting!

                              http://imall.iteadstudio.com/im120618001.html

                              D Offline
                              D Offline
                              Dean
                              wrote on last edited by
                              #47

                              @gadu said:

                              Cool, this one is also interesting!

                              http://imall.iteadstudio.com/im120618001.html

                              I agree... I placed an order with them last and it arrived yesterday. I bought a few items including a couple more Mini Rboards, but I also bought what you linked. Not sure what I will do with it, but at that price I couldn't say no. :-)

                              1 Reply Last reply
                              0
                              • greglG Offline
                                greglG Offline
                                gregl
                                Hero Member
                                wrote on last edited by
                                #48

                                ive had an rboard in production with mysensors for 6 months or so.... it hasnt missed a beat and caused me absolutely no issues!!!

                                1 Reply Last reply
                                0
                                • epierreE Offline
                                  epierreE Offline
                                  epierre
                                  Hero Member
                                  wrote on last edited by epierre
                                  #49

                                  @gregl I wanted to try mine, but it seems it doesn't commute, have you a test script ?

                                  When I send the order:

                                  echo "9;0;1;1;2;1" >> /dev/ttyUSB0
                                  

                                  I see on the debug:

                                  read: 0-0-9 s=0,c=1,t=2,pt=0,l=1:1
                                  send: 9-9-0-0 s=0,c=1,t=2,pt=0,l=1,st=ok:1
                                  Incoming change for sensor:0, New status: 1
                                  

                                  But I don't hear the relay commute nor mesure a conductivity on the relay limits.

                                  any hint ?

                                  z-wave - Vera -> Domoticz
                                  rfx - Domoticz <- MyDomoAtHome <- Imperihome
                                  mysensors -> mysensors-gw -> Domoticz

                                  1 Reply Last reply
                                  0
                                  • greglG Offline
                                    greglG Offline
                                    gregl
                                    Hero Member
                                    wrote on last edited by
                                    #50

                                    You may not have enough power to drive the relay...five it at least 6v

                                    . ...or the Wong pin in your sketch.

                                    1 Reply Last reply
                                    0
                                    • epierreE Offline
                                      epierreE Offline
                                      epierre
                                      Hero Member
                                      wrote on last edited by
                                      #51

                                      @gregl right this was linked to a powering issue.

                                      :~$ echo "9;1;1;1;2;1" >> /dev/ttyUSB0
                                      :~$ echo "9;1;1;1;2;0" >> /dev/ttyUSB0
                                      

                                      what is strange is that it is the sensor 1 and not the 0, but the way the demo code is you have to do that...

                                      digitalWrite(message.sensor-1+RELAY_1,
                                      

                                      @hek sending a message would be good in http://www.mysensors.org/download/serial_api_14 in § serial communication example, it is missing...

                                      z-wave - Vera -> Domoticz
                                      rfx - Domoticz <- MyDomoAtHome <- Imperihome
                                      mysensors -> mysensors-gw -> Domoticz

                                      1 Reply Last reply
                                      0
                                      • HomerH Offline
                                        HomerH Offline
                                        Homer
                                        wrote on last edited by
                                        #52

                                        Sorry about bumping an old thread...

                                        I am using one of these boards to make a relay and temp sensor. I am trying to use Gregl's example that is linked here and stored on Codebender. For the record, here it is:

                                        //This is Motion/Door & Temp Sensor with Relay 
                                        //Hardware is Mini RBoard ftp://imall.iteadstudio.com/Mainboard/IM140704001_mini_Rboard/SCH_IM140704001_MiniRboard.pdf
                                        
                                        //
                                        
                                        
                                        #include <MySensor.h>
                                        #include <SPI.h>
                                        #include <DallasTemperature.h>
                                        #include <OneWire.h>
                                        
                                        char sketch_name[] = "Multi Sensor";
                                        char sketch_ver[]  = "2014.11.15r1";
                                        
                                        #define MySensorTESTBED 0
                                        
                                        #if MySensorTESTBED == 1
                                        #define CLIENT_ID 9  // Sets MYSensors client id
                                        #define RADIO_CH 96  // Sets MYSensors to use Radio Channel 96
                                        #define RELAY 4   // Set 4 for mini rboard
                                        #define TRIGGER	3	// On Mini Rboard there is D3 (Interupt 1) available on the RX Module pins
                                        
                                        #endif
                                        
                                        #if MySensorTESTBED == 0
                                        #define CLIENT_ID AUTO  // Sets MYSensors client id
                                        #define RADIO_CH 76  // Sets MYSensors to use Radio Channel
                                        #define RELAY 4   // Set 4 for mini rboard
                                        #define TRIGGER	3	// On Mini Rboard there is D3 (Interupt 1) available on the RX Module pins
                                        #endif
                                        
                                        //Temp Sensor bits
                                        #define ONE_WIRE_BUS 14 // Pin where dallas sensor is connected - on Rboard this is A0(D14)
                                        OneWire oneWire(ONE_WIRE_BUS);
                                        DallasTemperature DallasSensors(&oneWire);
                                        float lastTemperature ;
                                        #define CHILD_ID_T1 3 //CHILD ID for relay
                                        
                                        
                                        //Relay Output bits
                                        #define RELAY_ON 0  // GPIO value to write to turn on attached relay
                                        #define RELAY_OFF 1 // GPIO value to write to turn off attached relay
                                        #define CHILD_ID_R1 1 //CHILD ID for relay
                                        
                                        //Trigger Sensor Bits
                                        #define CHILD_ID_S1 2 //CHILD ID for Reed/Motion sensor
                                        boolean lastTripped = 0;
                                        
                                        
                                        
                                        
                                        MySensor gw;
                                        MyMessage triggerMsg(CHILD_ID_S1,V_TRIPPED);
                                        MyMessage relayMsg(CHILD_ID_R1,V_LIGHT);
                                        MyMessage tempMsg(CHILD_ID_T1,V_TEMP);
                                        
                                        
                                        
                                        void setup()
                                        {
                                        	// Startup OneWire Temp Sensors
                                        	DallasSensors.begin();
                                        	
                                        	// Initialize library and add callback for incoming messages
                                        	gw.begin(incomingMessage, CLIENT_ID , false,AUTO,RF24_PA_MAX,RADIO_CH,RF24_250KBPS);
                                        	
                                        	// Send the sketch version information to the gateway and Controller
                                        	gw.sendSketchInfo(sketch_name, sketch_ver);
                                        
                                        	// Register all sensors to gw (they will be created as child devices)
                                        	gw.present(CHILD_ID_R1, S_LIGHT);
                                        	gw.present(CHILD_ID_T1, S_TEMP);
                                        	gw.present(CHILD_ID_S1, S_MOTION);
                                        	
                                        		
                                        	// Then set relay pins in output mode
                                        	pinMode(RELAY, OUTPUT);
                                        	pinMode(TRIGGER,INPUT_PULLUP);
                                        	
                                        	//Ensure relay is off
                                        	digitalWrite(RELAY,RELAY_OFF); //turn relay off
                                        	
                                        	
                                        }
                                        
                                        
                                        void loop()
                                        {
                                        	// Alway process incoming messages whenever possible
                                        	gw.process();
                                        	
                                        	
                                        	// Check for motion change value
                                        		boolean tripped = digitalRead(TRIGGER) == HIGH; 
                                        
                                        		if (lastTripped != tripped ) {
                                        			gw.send(triggerMsg.set(tripped?"1":"0")); // Send new state and request ack back
                                        			Serial.println("Tripped");
                                        			lastTripped=tripped;
                                        		}
                                        		
                                        		
                                        	// Fetch temperatures from Dallas sensors
                                        		DallasSensors.requestTemperatures();
                                        		float tempC = DallasSensors.getTempCByIndex(1);
                                        		
                                        		// Only send data if temperature has changed and no error
                                        		if (lastTemperature != tempC && tempC != -127.00) {
                                        			
                                        			// Send in the new temperature
                                        			gw.send(tempMsg.set(tempC,1));
                                        			lastTemperature=tempC;
                                        		}
                                        		
                                        }
                                        
                                        
                                        
                                        void incomingMessage(const MyMessage &message) {
                                        	// We only expect one type of message from controller. But we better check anyway.
                                        	if (message.type==V_LIGHT && !(message.isAck()) ) { // look for messages for the relay and that are not ACK messages
                                        		// Change relay state
                                        		digitalWrite(RELAY, message.getBool()?RELAY_ON:RELAY_OFF);
                                        		Serial.print("Incoming change for sensor:");
                                        		Serial.print(message.sensor);
                                        		Serial.print(", New status: ");
                                        		Serial.println(message.getBool());
                                        				
                                        	}
                                        }
                                        

                                        Just as the code stands, when I try to compile it, I get an error. First I got one because the Mysensors library had the last letter 's' missing, but even after I make that correction I can't get it to compile. This is the error that I get:

                                        Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino Duemilanove or Diecimila, ATmega328P"

                                        WARNING: Spurious .ci folder in 'MySensors' library
                                        WARNING: Spurious .mystools folder in 'MySensors' library
                                        In file included from C:\Users\Dean\Documents\Arduino\testingagain\testingagain.ino:7:0:

                                        C:\Users\Dean\Documents\Arduino\libraries\MySensors/MySensors.h:405:2: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.

                                        #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.

                                        ^

                                        Multiple libraries were found for "MySensors.h"
                                        Used: C:\Users\Dean\Documents\Arduino\libraries\MySensors
                                        Not used: C:\Users\Dean\Documents\Arduino\libraries\MySensors-2.3.1
                                        Multiple libraries were found for "DallasTemperature.h"
                                        Used: C:\Users\Dean\Documents\Arduino\libraries\DallasTemperature
                                        Not used: C:\Users\Dean\Documents\Arduino\libraries\MAX31850_DallasTemp
                                        exit status 1
                                        Error compiling for board Arduino Duemilanove or Diecimila.

                                        This report would have more information with
                                        "Show verbose output during compilation"
                                        option enabled in File -> Preferences.

                                        I really don't know where to go to from here, because all I have done is tried to compile a working sketch so it should work, shouldn't it?

                                        Keen to hear back from someone who knows a lot more about this stuff than me! Thanks

                                        mfalkviddM 1 Reply Last reply
                                        0
                                        • HomerH Homer

                                          Sorry about bumping an old thread...

                                          I am using one of these boards to make a relay and temp sensor. I am trying to use Gregl's example that is linked here and stored on Codebender. For the record, here it is:

                                          //This is Motion/Door & Temp Sensor with Relay 
                                          //Hardware is Mini RBoard ftp://imall.iteadstudio.com/Mainboard/IM140704001_mini_Rboard/SCH_IM140704001_MiniRboard.pdf
                                          
                                          //
                                          
                                          
                                          #include <MySensor.h>
                                          #include <SPI.h>
                                          #include <DallasTemperature.h>
                                          #include <OneWire.h>
                                          
                                          char sketch_name[] = "Multi Sensor";
                                          char sketch_ver[]  = "2014.11.15r1";
                                          
                                          #define MySensorTESTBED 0
                                          
                                          #if MySensorTESTBED == 1
                                          #define CLIENT_ID 9  // Sets MYSensors client id
                                          #define RADIO_CH 96  // Sets MYSensors to use Radio Channel 96
                                          #define RELAY 4   // Set 4 for mini rboard
                                          #define TRIGGER	3	// On Mini Rboard there is D3 (Interupt 1) available on the RX Module pins
                                          
                                          #endif
                                          
                                          #if MySensorTESTBED == 0
                                          #define CLIENT_ID AUTO  // Sets MYSensors client id
                                          #define RADIO_CH 76  // Sets MYSensors to use Radio Channel
                                          #define RELAY 4   // Set 4 for mini rboard
                                          #define TRIGGER	3	// On Mini Rboard there is D3 (Interupt 1) available on the RX Module pins
                                          #endif
                                          
                                          //Temp Sensor bits
                                          #define ONE_WIRE_BUS 14 // Pin where dallas sensor is connected - on Rboard this is A0(D14)
                                          OneWire oneWire(ONE_WIRE_BUS);
                                          DallasTemperature DallasSensors(&oneWire);
                                          float lastTemperature ;
                                          #define CHILD_ID_T1 3 //CHILD ID for relay
                                          
                                          
                                          //Relay Output bits
                                          #define RELAY_ON 0  // GPIO value to write to turn on attached relay
                                          #define RELAY_OFF 1 // GPIO value to write to turn off attached relay
                                          #define CHILD_ID_R1 1 //CHILD ID for relay
                                          
                                          //Trigger Sensor Bits
                                          #define CHILD_ID_S1 2 //CHILD ID for Reed/Motion sensor
                                          boolean lastTripped = 0;
                                          
                                          
                                          
                                          
                                          MySensor gw;
                                          MyMessage triggerMsg(CHILD_ID_S1,V_TRIPPED);
                                          MyMessage relayMsg(CHILD_ID_R1,V_LIGHT);
                                          MyMessage tempMsg(CHILD_ID_T1,V_TEMP);
                                          
                                          
                                          
                                          void setup()
                                          {
                                          	// Startup OneWire Temp Sensors
                                          	DallasSensors.begin();
                                          	
                                          	// Initialize library and add callback for incoming messages
                                          	gw.begin(incomingMessage, CLIENT_ID , false,AUTO,RF24_PA_MAX,RADIO_CH,RF24_250KBPS);
                                          	
                                          	// Send the sketch version information to the gateway and Controller
                                          	gw.sendSketchInfo(sketch_name, sketch_ver);
                                          
                                          	// Register all sensors to gw (they will be created as child devices)
                                          	gw.present(CHILD_ID_R1, S_LIGHT);
                                          	gw.present(CHILD_ID_T1, S_TEMP);
                                          	gw.present(CHILD_ID_S1, S_MOTION);
                                          	
                                          		
                                          	// Then set relay pins in output mode
                                          	pinMode(RELAY, OUTPUT);
                                          	pinMode(TRIGGER,INPUT_PULLUP);
                                          	
                                          	//Ensure relay is off
                                          	digitalWrite(RELAY,RELAY_OFF); //turn relay off
                                          	
                                          	
                                          }
                                          
                                          
                                          void loop()
                                          {
                                          	// Alway process incoming messages whenever possible
                                          	gw.process();
                                          	
                                          	
                                          	// Check for motion change value
                                          		boolean tripped = digitalRead(TRIGGER) == HIGH; 
                                          
                                          		if (lastTripped != tripped ) {
                                          			gw.send(triggerMsg.set(tripped?"1":"0")); // Send new state and request ack back
                                          			Serial.println("Tripped");
                                          			lastTripped=tripped;
                                          		}
                                          		
                                          		
                                          	// Fetch temperatures from Dallas sensors
                                          		DallasSensors.requestTemperatures();
                                          		float tempC = DallasSensors.getTempCByIndex(1);
                                          		
                                          		// Only send data if temperature has changed and no error
                                          		if (lastTemperature != tempC && tempC != -127.00) {
                                          			
                                          			// Send in the new temperature
                                          			gw.send(tempMsg.set(tempC,1));
                                          			lastTemperature=tempC;
                                          		}
                                          		
                                          }
                                          
                                          
                                          
                                          void incomingMessage(const MyMessage &message) {
                                          	// We only expect one type of message from controller. But we better check anyway.
                                          	if (message.type==V_LIGHT && !(message.isAck()) ) { // look for messages for the relay and that are not ACK messages
                                          		// Change relay state
                                          		digitalWrite(RELAY, message.getBool()?RELAY_ON:RELAY_OFF);
                                          		Serial.print("Incoming change for sensor:");
                                          		Serial.print(message.sensor);
                                          		Serial.print(", New status: ");
                                          		Serial.println(message.getBool());
                                          				
                                          	}
                                          }
                                          

                                          Just as the code stands, when I try to compile it, I get an error. First I got one because the Mysensors library had the last letter 's' missing, but even after I make that correction I can't get it to compile. This is the error that I get:

                                          Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino Duemilanove or Diecimila, ATmega328P"

                                          WARNING: Spurious .ci folder in 'MySensors' library
                                          WARNING: Spurious .mystools folder in 'MySensors' library
                                          In file included from C:\Users\Dean\Documents\Arduino\testingagain\testingagain.ino:7:0:

                                          C:\Users\Dean\Documents\Arduino\libraries\MySensors/MySensors.h:405:2: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.

                                          #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.

                                          ^

                                          Multiple libraries were found for "MySensors.h"
                                          Used: C:\Users\Dean\Documents\Arduino\libraries\MySensors
                                          Not used: C:\Users\Dean\Documents\Arduino\libraries\MySensors-2.3.1
                                          Multiple libraries were found for "DallasTemperature.h"
                                          Used: C:\Users\Dean\Documents\Arduino\libraries\DallasTemperature
                                          Not used: C:\Users\Dean\Documents\Arduino\libraries\MAX31850_DallasTemp
                                          exit status 1
                                          Error compiling for board Arduino Duemilanove or Diecimila.

                                          This report would have more information with
                                          "Show verbose output during compilation"
                                          option enabled in File -> Preferences.

                                          I really don't know where to go to from here, because all I have done is tried to compile a working sketch so it should work, shouldn't it?

                                          Keen to hear back from someone who knows a lot more about this stuff than me! Thanks

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

                                          @homer that sketch was made for MySensors 1.x and needs to be converted to work for MySensors 2.x.
                                          Followthe guide at https://forum.mysensors.org/topic/4276/converting-a-sketch-from-1-5-x-to-2-0-x to convert it.

                                          Alternatively, remove MySensors 2 and install MySensors 1 instead.

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


                                          23

                                          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