Is it ok to have two gateways?
Posts made by fakeJake
-
RE: Newbie Problem! Get Started with NRF24L01+
@hek Thank you! I will try it as soon as I go home. Can you tell me what is the expected output from the gateway if I use static id 2 for a relayActuator that I turned on?
will it be just "2;1;1;0;2;1" or will "2;255;x;x;x;x" appear? only the read/send data is hidden
-
RE: Newbie Problem! Get Started with NRF24L01+
@hek can you please help me on what should I comment out?
-
RE: Newbie Problem! Get Started with NRF24L01+
Should I post my new question on another board?
Re: s there a way to receive only the last state of the sensors/actuators in the serial?
-
RE: Newbie Problem! Get Started with NRF24L01+
@Stric Removed it but still the read and send appears
-
RE: Newbie Problem! Get Started with NRF24L01+
I placed if statement in serial function inside MyGateway.cpp
where 0 is the gateway addressvoid MyGateway::serial(MyMessage &msg) { if (msg.sender != 0); serial(PSTR("%d;%d;%d;%d;%d;%s\n"),msg.sender, msg.sensor, mGetCommand(msg), mGetAck(msg), msg.type, msg.getString(convBuf)); }
Still it doesnt work.
Heres the format:
msg.sender = GATEWAY_ADDRESS; msg.destination = destination; msg.sensor = sensor; msg.type = type; mSetCommand(msg,command); mSetRequestAck(msg,ack?1:0); mSetAck(msg,false); if (command == C_STREAM) msg.set(bvalue, blen); else msg.set(value);
-
RE: Newbie Problem! Get Started with NRF24L01+
Is there a way to receive only the last state of the sensors/actuators in the serial?
instead of:
0;0;3;0;9;read: 2-2-0 s=1,c=1,t=2,pt=2,l=2:1 0;0;3;0;9;send: 0-0-2-2 s=1,c=1,t=2,pt=2,l=2,st=ok:1 2;1;1;0;2;1
it only print the "2;1;1;0;2;1" on the serial
-
RE: Newbie Problem! Get Started with NRF24L01+
@rvendrame You know what. I'm really thankful for you help and I'm really sorry for dragging you with me. I can turn the light on now. I just have to print "2;1;1;1;2;0;" instead of "2;1;1;1;2;1".
I will check if I will encounter any problem because of my relay module.
Again, thank you so much for your help. And I'm really sorry. -
RE: Newbie Problem! Get Started with NRF24L01+
@rvendrame My relay is more like this http://www.elecdesignworks.com/images/stories/virtuemart/product/img_62112.jpg
Thank you for your reference.
It has a transistor. I hope it's ok to use. I have tested it by following an instructable. -
RE: Newbie Problem! Get Started with NRF24L01+
@rvendrame No transistor. I just followed MySensors: Build Relay Actuator. I directly connected the 5v, gnd and signal to the arduino.
-
RE: Newbie Problem! Get Started with NRF24L01+
@rvendrame The light is still not turning on
I even change it to "2;257;1;1;2;1" just incase 255 is the message.sensor but it still prints "2;1;1;1;2;1" so I there's no problem there.sensor started, id 2 send: 2-2-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1 send: 2-2-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0 send: 2-2-0-0 s=255,c=3,t=11,pt=0,l=5,st=ok:Relay send: 2-2-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0 send: 2-2-0-0 s=1,c=0,t=3,pt=0,l=5,st=ok:1.4.1 read: 0-0-2 s=1,c=1,t=2,pt=0,l=1:1 send: 2-2-0-0 s=1,c=1,t=2,pt=0,l=1,st=ok:1 Incoming change for sensor:1, New status: 1
-
RE: Newbie Problem! Get Started with NRF24L01+
I just changed the gw.begin();
// Example sketch showing how to control physical relays. // This example will remember relay state even after power failure. #include <MySensor.h> #include <SPI.h> #define RELAY_1 3 // 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 MySensor gw; void setup() { // Initialize library and add callback for incoming messages gw.begin(incomingMessage, 2); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Relay", "1.0"); // Fetch relay status for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) gw.present(sensor, S_LIGHT); // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF); } } void loop() { // Alway process incoming messages whenever possible gw.process(); } void incomingMessage(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_LIGHT) { // Change relay state digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom gw.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()); } }
-
RE: Newbie Problem! Get Started with NRF24L01+
It still doesn't open the light even if I change it to "2;255;1;1;2;1;"
I checked the relay using relay.ino from an instructable controlling ac light with relay and it's working. -
RE: Newbie Problem! Get Started with NRF24L01+
@rvendrame Sorry I forgot to include that, I edited the post
-
RE: Newbie Problem! Get Started with NRF24L01+
I tried entering message on the serial monitor of the gateway but still no luck.
This is the closest thing that I did to tell the relay to turn the light on.Gateway output after I enter "2;0;1;1;2;1;" to the Serial monitor:
0;0;3;0;14;Gateway startup complete. 0;0;3;0;9;read: 2-2-0 s=255,c=0,t=17,pt=0,l=5:1.4.1 2;255;0;0;17;1.4.1 0;0;3;0;9;read: 2-2-0 s=255,c=3,t=6,pt=1,l=1:0 2;255;3;0;6;0 0;0;3;0;9;read: 2-2-0 s=255,c=3,t=11,pt=0,l=5:Relay 2;255;3;0;11;Relay 0;0;3;0;9;read: 2-2-0 s=255,c=3,t=12,pt=0,l=3:1.0 2;255;3;0;12;1.0 0;0;3;0;9;read: 2-2-0 s=1,c=0,t=3,pt=0,l=5:1.4.1 2;1;0;0;3;1.4.1 0;0;3;0;9;send: 0-0-2-2 s=0,c=1,t=2,pt=0,l=1,st=ok:1 0;0;3;0;9;read: 2-2-0 s=0,c=1,t=2,pt=0,l=1:1 2;0;1;1;2;1
Relay output after "2;0;1;1;2;1;" :
sensor started, id 2 send: 2-2-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1 send: 2-2-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0 send: 2-2-0-0 s=255,c=3,t=11,pt=0,l=5,st=ok:Relay send: 2-2-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0 send: 2-2-0-0 s=1,c=0,t=3,pt=0,l=5,st=ok:1.4.1 read: 0-0-2 s=0,c=1,t=2,pt=0,l=1:1 send: 2-2-0-0 s=0,c=1,t=2,pt=0,l=1,st=ok:1 Incoming change for sensor:0, New status: 1
Still it doesn't turn on the light
-
RE: Newbie Problem! Get Started with NRF24L01+
Good news! The gateway is now working
I changed the dallas temperature to relay actuator and, yes, it's now working!
Bad news is I still don't know what went wrong with my temperature sensor.
I'll investigate on it soon.This is the gateway output:
0;0;3;0;14;Gateway startup complete. 0;0;3;0;9;read: 2-2-0 s=255,c=0,t=18,pt=0,l=5:1.4.1 2;255;0;0;18;1.4.1 0;0;3;0;9;read: 2-2-0 s=255,c=3,t=6,pt=1,l=1:0 2;255;3;0;6;0 0;0;3;0;9;read: 2-2-0 s=255,c=3,t=11,pt=0,l=5:Relay 2;255;3;0;11;Relay 0;0;3;0;9;read: 2-2-0 s=255,c=3,t=12,pt=0,l=3:1.0 2;255;3;0;12;1.0 0;0;3;0;9;read: 2-2-0 s=1,c=0,t=3,pt=0,l=5:1.4.1 2;1;0;0;3;1.4.1
This is the relay output:
repeater started, id 2 send: 2-2-0-0 s=255,c=0,t=18,pt=0,l=5,st=ok:1.4.1 send: 2-2-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0 send: 2-2-0-0 s=255,c=3,t=11,pt=0,l=5,st=ok:Relay send: 2-2-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0 send: 2-2-0-0 s=1,c=0,t=3,pt=0,l=5,st=ok:1.4.1
I just need to test it.
Since I'll be using a gsm to control the relay. Can you help me on what to send to the relay to turn it on/off? -
RE: Newbie Problem! Get Started with NRF24L01+
I'm using the DallasTemperatureSensor.ino on MySensors library. I just change the gw.begin(); to gw.begin(NULL, 1);
// Example sketch showing how to send in OneWire temperature readings #include <MySensor.h> #include <SPI.h> #include <DallasTemperature.h> #include <OneWire.h> #define ONE_WIRE_BUS 3 // 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); DallasTemperature sensors(&oneWire); MySensor gw; float lastTemperature[MAX_ATTACHED_DS18B20]; int numSensors=0; boolean receivedConfig = false; boolean metric = true; // Initialize temperature message MyMessage msg(0,V_TEMP); void setup() { // Startup OneWire sensors.begin(); // Startup and initialize MySensors library. Set callback for incoming messages. gw.begin(NULL,1); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Temperature Sensor", "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++) { gw.present(i, S_TEMP); } } void loop() { // Process incoming messages (like config from server) gw.process(); // Fetch temperatures from Dallas sensors sensors.requestTemperatures(); // 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>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.; // Only send data if temperature has changed and no error if (lastTemperature[i] != temperature && temperature != -127.00) { // Send in the new temperature gw.send(msg.setSensor(i).set(temperature,1)); lastTemperature[i]=temperature; } } gw.sleep(SLEEP_TIME); }
-
RE: Newbie Problem! Get Started with NRF24L01+
@rvendrame said:
@fakeJake , are the node far from gateway, or any obstacle (such as a wall) in between? Another source of interference is for example a microwave.
They are just 6 inches apart
-
RE: Newbie Problem! Get Started with NRF24L01+
@rvendrame said:
Maybe this may cover it http://www.mysensors.org/download/serial_api_14
It only explains the "0;0;3;0;14;" but not the "s=255,c=3,t=11,pt=0,l=18,st=fail:Temperature Sensor" that it sends or reads
-
RE: Newbie Problem! Get Started with NRF24L01+
Sorry for the late reply
Each modules are now supplied with 5V and 3.3V.
This is the serial gateway output:
0;0;3;0;14;Gateway startup complete. 0;0;3;0;9;read: 1-1-0 s=0,c=1,t=0,pt=7,l=5:30.2 1;0;1;0;0;30.2 0;0;3;0;9;Inclusion started by button. 0;0;3;0;5;1 0;0;3;0;5;0
This is the temp output:
sensor started, id 1 send: 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,st=fail:1.4.1 send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0 send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=18,st=fail:Temperature Sensor send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,st=fail:1.0 send: 1-1-0-0 s=0,c=0,t=6,pt=0,l=5,st=fail:1.4.1 send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:30.2
st keeps on failing. I checked the nrf supply and it ranges from 3.1v to 3.3 v. Is this bad? I'm using spx2815 since it's the only thing available to me. I placed 10uF capacitor in the 5v input and 3.3v output to ground
-
RE: Newbie Problem! Get Started with NRF24L01+
@hek said:
How are you powering your node? Your node's radio is constantly fail to transmit (st=fail).
It's actually the gateway having problems transmitting acks back to node.
I'm powering the nrf modules from same 3.3V supply since I haven't bought a regulator yet. I'll test it again later. I'll be going out to buy them now.
Just to give me a heads up. What should the serial gateway get after i press the inclusion button?
-
RE: Newbie Problem! Get Started with NRF24L01+
The inclusion button is used to detect the connecting modules, yes?
This is the output I get when I press the inclusion button on the serial gateway
0;0;3;0;14;Gateway startup complete. 0;0;3;0;9;Inclusion started by button. 0;0;3;0;5;1 0;0;3;0;5;0
I have another NRF module with ds18b20 connected. Can you help me on how I can get the temp sensor to connect to the serial gateway? I c
I used the code here and changed the gw.begin() to gw.begin(NULL, 1)
sensor started, id 1 send: 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,st=fail:1.4.1 send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0 send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=18,st=fail:Temperature Sensor send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,st=fail:1.0 send: 1-1-0-0 s=0,c=0,t=6,pt=0,l=5,st=fail:1.4.1 send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:29.6 send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:29.7 send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:29.6 send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:29.7 send: 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail: send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:29.6 send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:29.8 send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:29.7 send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:29.6 send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:29.7 send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:29.6 send: 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,st=fail:29.7 send: 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
-
RE: Newbie Problem! Get Started with NRF24L01+
Can I use the inclusion button on the serialGateway?
-
RE: Newbie Problem! Get Started with NRF24L01+
@korttoma : Ok. Thank you! Could you kindly explain what are the send, s, c, t, pt, l and st?
-
RE: Newbie Problem! Get Started with NRF24L01+
@Chester : After checking the wire and the supply I know my connection isn't the problem so I replaced my Arduino.
This is the output:
send: 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail: req node id send: 255-255-255-0 s=255,c=3,t=3,pt=0,l=0,st=fail: sensor started, id 255 req node id send: 255-255-255-0 s=255,c=3,t=3,pt=0,l=0,st=fail: req node id send: 255-255-255-0 s=255,c=3,t=3,pt=0,l=0,st=fail: req node id send: 255-255-255-0 s=255,c=3,t=3,pt=0,l=0,st=fail: req node id send: 255-255-255-0 s=255,c=3,t=3,pt=0,l=0,st=fail:
@hek : After using gw.begin(NULL, 0);
Thi is the output:
send: 0-0-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail: sensor started, id 0 send: 0-0-255-0 s=255,c=0,t=17,pt=0,l=5,st=fail:1.4.1 send: 0-0-255-0 s=255,c=3,t=6,pt=1,l=1,st=fail:255 send: 0-0-255-0 s=255,c=3,t=11,pt=0,l=18,st=fail:Temperature Sensor send: 0-0-255-0 s=255,c=3,t=12,pt=0,l=3,st=fail:1.0 send: 0-0-255-0 s=0,c=0,t=6,pt=0,l=5,st=fail:1.4.1 send: 0-0-255-0 s=0,c=1,t=0,pt=7,l=5,st=fail:29.9
What are the s,c,t,pt
-
RE: Newbie Problem! Get Started with NRF24L01+
@Striffster Hmm, so it can't be stand alone? If I press the inclusion button, will it not send the received ID for the NRF module?
-
RE: Newbie Problem! Get Started with NRF24L01+
@Striffster : No I haven't. Is it necessary? My plan was to send data using a gsm module after I get it from NRF modules
-
RE: Newbie Problem! Get Started with NRF24L01+
@Chester : Thank you!
I changed baud rate on the Serial Monitor, now it says "0;0;3;0;14;Gateway startup complete."
I used the one inside 'MySensors'. I also changed the baud rate and now it says "check wires"
Why is the inclusion button not working? Will a message show if I press the button?
-
Newbie Problem! Get Started with NRF24L01+
Good day!
I have a problem setting up my army.
I am planning to monitor my house using a lot of NRF24 modules but instead of connecting to a cloud I want the master NRF to send me a message.I am very new to this and any help will be truly appreciated.
I have 2x NRF24L01+ Modules and 2x Arduino UNO.
I already have an Arduino IDE so I just downloaded the library.
I uploaded SerialGateway.ino to one of the Arduino and DallasTemperatureSensor.ino to the other.
I followed the wire connection.
I placed capacitor between the 3.3V and GND
I placed inclusion button, leds and resistors.When I open the Serial Monitor for the SerialGateway, Nothing happens
The led for the inclusion button is not blinking on the SerialGateway
I can't see temp readings on the DallasTemperatureSensor even though I use Serial.print()am I missing anything?
Do I need to have a controller?
Is Serial.print() not applicable if I am using NRF24?