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 32.5k 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.
  • 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
    • E Offline
      E 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
        • E Offline
          E 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
              • mfalkviddM mfalkvidd

                @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 Offline
                HomerH Offline
                Homer
                wrote on last edited by
                #54

                @mfalkvidd said in rboard - Cheap relay/radio/arduino board ~$10:

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

                Thanks mate! I was thinking something like that might be the case, but I didn't know for sure.

                Thank you so much for pointing me in the right direction!!

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

                  I just wanted to say that I managed to upload a sketch and I have it working!

                  I attempted to change the code so it was compatible but I gave that up and decided to merge two sketches. It was good fun, and I enjoyed learning!

                  1 Reply Last reply
                  1
                  • alowhumA Offline
                    alowhumA Offline
                    alowhum
                    Plugin Developer
                    wrote on last edited by
                    #56

                    Could you share the sketch? Perhaps others will learn from it too?

                    HomerH 1 Reply Last reply
                    1
                    • alowhumA alowhum

                      Could you share the sketch? Perhaps others will learn from it too?

                      HomerH Offline
                      HomerH Offline
                      Homer
                      wrote on last edited by mfalkvidd
                      #57

                      @alowhum said in rboard - Cheap relay/radio/arduino board ~$10:

                      Could you share the sketch? Perhaps others will learn from it too?

                      Great idea! :relaxed:

                      Here it is

                      // Enable debug prints to serial monitor
                      #define MY_DEBUG
                      
                      // Enable and select radio type attached
                      #define MY_RADIO_NRF24
                      //#define MY_RADIO_RFM69
                      
                      #include <SPI.h>
                      #include <MySensors.h>
                      #include <DallasTemperature.h>
                      #include <OneWire.h>
                      
                      // Setup Relay bits
                      #define RELAY_PIN 4  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
                      #define NUMBER_OF_RELAYS 1 // Total number of attached relays
                      #define RELAY_ON 1  // GPIO value to write to turn on attached relay
                      #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
                      
                      // Setup Temperature bits
                      #define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No
                      #define ONE_WIRE_BUS 14 // Pin where dallase sensor is connected 
                      #define MAX_ATTACHED_DS18B20 16
                      unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
                      OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
                      DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature.
                      float lastTemperature[MAX_ATTACHED_DS18B20];
                      int numSensors = 0;
                      bool receivedConfig = false;
                      bool metric = true;
                      // Initialize temperature message
                      MyMessage tempMsg(0, V_TEMP);
                      
                      void before()
                      {
                        for (int sensor = 1, pin = RELAY_PIN; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
                          // Then set relay pins in output mode
                          pinMode(pin, OUTPUT);
                          // Set relay to last known state (using eeprom storage)
                          digitalWrite(pin, loadState(sensor) ? RELAY_ON : RELAY_OFF);
                        }
                      
                        // Startup up the OneWire library
                        sensors.begin();
                      }
                      
                      void setup()
                      {
                        // requestTemperatures() will not block current thread
                        sensors.setWaitForConversion(false);
                      }
                      
                      void presentation()
                      {
                        // Send the sketch version information to the gateway and Controller
                        sendSketchInfo("Temp and Relay", "1.0");
                      
                        // Fetch the number of attached temperature sensors
                        numSensors = sensors.getDeviceCount();
                      
                        // Present all sensors to controller
                        for (int i = 0; i < numSensors && i < MAX_ATTACHED_DS18B20; i++) {
                          present(i, S_TEMP);
                      
                          for (int sensor = 1, pin = RELAY_PIN; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
                            // Register all sensors to gw (they will be created as child devices)
                            present(sensor, S_BINARY);
                      
                          }
                        }
                      }
                      
                      void loop()
                      {
                        // Fetch temperatures from Dallas sensors
                        sensors.requestTemperatures();
                      
                        // query conversion time and sleep until conversion completed
                        int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
                        // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
                        wait(conversionTime);
                      
                        // Read temperatures and send them to controller
                        for (int i = 0; i < numSensors && i < MAX_ATTACHED_DS18B20; i++) {
                      
                          // Fetch and round temperature to one decimal
                          float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric ? sensors.getTempCByIndex(i) : sensors.getTempFByIndex(i)) * 10.)) / 10.;
                      
                          // Only send data if temperature has changed and no error
                      #if COMPARE_TEMP == 1
                          if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
                      #else
                          if (temperature != -127.00 && temperature != 85.00) {
                      #endif
                      
                            // Send in the new temperature
                            send(tempMsg.setSensor(i).set(temperature, 1));
                            // Save new temperatures for next compare
                            lastTemperature[i] = temperature;
                          }
                        }
                        wait(SLEEP_TIME);
                      }
                      
                      void receive(const MyMessage &message)
                      {
                        // We only expect one type of message from controller. But we better check anyway.
                        if (message.type == V_STATUS) {
                          // Change relay state
                          digitalWrite(message.sensor - 1 + RELAY_PIN, message.getBool() ? RELAY_ON : RELAY_OFF);
                          // Store state in eeprom
                          saveState(message.sensor, message.getBool());
                          // Write some debug info
                          Serial.print("Incoming change for sensor:");
                          Serial.print(message.sensor);
                          Serial.print(", New status: ");
                          Serial.println(message.getBool());
                        }
                      }
                      
                      1 Reply Last reply
                      1

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      10

                      Online

                      12.0k

                      Users

                      11.2k

                      Topics

                      113.4k

                      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