Well, thanks a lot, it solved it. I saw the different wiring for mega2560, but not the star which added two lines to the sketch :
#define MY_RF24_CE_PIN 49
#define MY_RF24_CS_PIN 53
It works now! thanks also for your reactivity;
Nicolas
Well, thanks a lot, it solved it. I saw the different wiring for mega2560, but not the star which added two lines to the sketch :
#define MY_RF24_CE_PIN 49
#define MY_RF24_CS_PIN 53
It works now! thanks also for your reactivity;
Nicolas
Hello,
I have an arduino mega 2560 Geekcreit, that seems to work well on basic sketches.
uploaded the basic gateway sketch version 2.1.1 with nothing added.
Connected a radio that has been tested on a uno and that works on this arduino uno.
wiring double checked. capacitor added on 3.3V and GND.
Voltage measurement on the radio : 3.29V and seeming stable.
Below is my debug log.
What else can I try to make it work, or find the fault?
Thanks.
Nicolas
0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
0;255;3;0;9;TSM:INIT
0;255;3;0;9;TSF:WUR:MS=0
0;255;3;0;9;RF24:write register, reg=0, value=14
0;255;3;0;9;RF24:write register, reg=3, value=3
0;255;3;0;9;RF24:write register, reg=4, value=95
0;255;3;0;9;RF24:write register, reg=5, value=76
0;255;3;0;9;RF24:write register, reg=6, value=35
0;255;3;0;9;RF24:write register, reg=16, value=115
0;255;3;0;9;RF24:write register, reg=29, value=6
0;255;3;0;9;RF24:read register, reg=6, value=255
0;255;3;0;9;RF24:read register, reg=5, value=255
0;255;3;0;9;!RF24:INIT:SANCHK FAIL
0;255;3;0;9;!TSM:INIT:TSP FAIL
0;255;3;0;9;TSM:FAIL:CNT=1
0;255;3;0;9;TSM:FAIL:PDT
0;255;3;0;9;RF24:write register, reg=0, value=12
0;255;3;0;9;RF24:PD
Thanks, I found out already, but do you know how I can rename the title of the topic and put "(solved)" in it?
is the receive function supposed to work on the gateway or is it only for nodes? It doesn't work on my sketch.
I tried it on a gateway sketch and the function is never called when I receive incoming messages.
If it is not supposed to work on gateway, what would be the turn around to get the data and use it on the gateway, before it is sent to the controller?
Thanks
Nicolas
Hi,
working on my sensors v2, IDE arduino 1.6.7
The sketch is working OK, and connects to my jeedom controller no problem.
I want to use the data received from node directly on my gateway to process it (jeedom is just here to record the data over time).
on my serial gateway sketch, I added a void receive( const Mymessage &message) {} fonction, and it seems the sketch is never going there, even when messages are received, as I can see in my serial console.
Any idea someone? Any help much appreciated.
// Enable debug prints to serial monitor
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69
// Set LOW transmit power level as default, if you have an amplified NRF-module and
// power your radio separately with a good regulator you can turn up PA level.
#define MY_RF24_PA_LEVEL RF24_PA_LOW
// Enable serial gateway
#define MY_GATEWAY_SERIAL
// Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
#if F_CPU == 8000000L
#define MY_BAUD_RATE 38400
#endif
// Flash leds on rx/tx/err
#define MY_LEDS_BLINKING_FEATURE
// Set blinking period
#define MY_DEFAULT_LED_BLINK_PERIOD 300
// Inverses the behavior of leds
//#define MY_WITH_LEDS_BLINKING_INVERSE
// Enable inclusion mode
#define MY_INCLUSION_MODE_FEATURE
// Enable Inclusion mode button on gateway
#define MY_INCLUSION_BUTTON_FEATURE
// Inverses behavior of inclusion button (if using external pullup)
//#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
// Set inclusion mode duration (in seconds)
#define MY_INCLUSION_MODE_DURATION 60
// Digital pin used for inclusion mode button
#define MY_INCLUSION_MODE_BUTTON_PIN 3
// Uncomment to override default HW configurations
//#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin
//#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin
//#define MY_DEFAULT_TX_LED_PIN 5 // the PCB, on board LED
#include <SPI.h>
#include <MySensors.h>
#include <DHT.h>
#define CHILD_ID_HUM 10
#define CHILD_ID_TEMP 11
#define HUMIDITY_SENSOR_DIGITAL_PIN 4 //data pin pour DHT
#define BUREAU_NODE_ID 1
#define GW_NODE_ID 0
#define DS18B20 0
#define THERM 17
#define TEMP_DHT 11
#define HRD_HT 10
float bureauds = 0, bureautherm =0, tempdht = 0, hrdht =0;
unsigned long SLEEP_TIME = 10000; // Sleep time between reads (in milliseconds)
DHT dht;
//float lastTemp;
//float lastHum;
boolean metric = true;
MyMessage msgHum(CHILD_ID_HUM, V_HUM);
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
void setup() {
// Setup locally attached sensors
Serial.begin(115200);
Serial.println();
Serial.println("Status\tHumidity (%)\tTemperature (C)\t(F)");
dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
}
void presentation() {
sendSketchInfo("GW Humidity/Temp", "1.0");
// Present locally attached sensors
present(CHILD_ID_HUM, S_HUM);
present(CHILD_ID_TEMP, S_TEMP);
}
void loop() {
// Send locally attached sensor data here
wait(dht.getMinimumSamplingPeriod());
float temperature = dht.getTemperature();
if (isnan(temperature)) {
Serial.println("Failed reading temperature from DHT");
} else {
send(msgTemp.set(temperature, 1));
Serial.print("T: ");
Serial.println(temperature);
}
float humidity = dht.getHumidity();
if (isnan(humidity)) {
Serial.println("Failed reading humidity from DHT");
} else {
send(msgHum.set(humidity, 1));
Serial.print("H: ");
Serial.println(humidity);
}
Serial.print("Dallas: ");
Serial.println(bureauds);
Serial.print("Therm: ");
Serial.println(bureautherm);
Serial.print("tempDHT: ");
Serial.println(tempdht);
Serial.print("HRDHT: ");
Serial.println(hrdht);
// Sleep until interrupt comes in on motion sensor. Send update every two minute.
//sleep(SLEEP_TIME);
wait(SLEEP_TIME);
}
void receive(const MyMessage &message) {
Serial.print("received something: ");
Serial.println(message.sender, message.sensor);
switch (message.sender) {
case BUREAU_NODE_ID:
switch (message.sensor){
case DS18B20:
bureauds = message.getFloat();
break;
case THERM:
bureautherm = message.getFloat();
break;
}
break;
case GW_NODE_ID:
switch (message.sensor){
case TEMP_DHT:
tempdht = message.getFloat();
break;
case HRD_HT:
hrdht = message.getFloat();
break;
}
break;
}
Serial.print("Dallas: ");
Serial.println(bureauds);
Serial.print("Therm: ");
Serial.println(bureautherm);
Serial.print("tempDHT: ");
Serial.println(tempdht);
Serial.print("HRDHT: ");
Serial.println(hrdht);
}
abstract from serial output when a message is received from node 1, with sensors 0 and 17 :
0;255;3;0;9;TSP:SANCHK:OK
0;11;1;0;0;25.4
T: 25.40
0;10;1;0;1;50.3
H: 50.30
Dallas: 0.00
Therm: 0.00
tempDHT: 0.00
HRDHT: 0.00
0;255;3;0;9;TSP:MSG:READ 1-1-0 s=0,c=1,t=0,pt=7,l=5,sg=0:24.5
1;0;1;0;0;24.5
0;255;3;0;9;TSP:MSG:READ 1-1-0 s=17,c=1,t=0,pt=7,l=5,sg=0:24.6
1;17;1;0;0;24.6
0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=0,pt=1,l=1,sg=0:94
1;255;3;0;0;94
0;255;3;0;9;TSP:MSG:READ 1-1-0 s=20,c=1,t=38,pt=7,l=5,sg=0:3.8
1;20;1;0;38;3.8
0;11;1;0;0;25.3
T: 25.30
0;10;1;0;1;50.2
H: 50.20
Dallas: 0.00
Therm: 0.00
tempDHT: 0.00
HRDHT: 0.00
0;11;1;0;0;25.3
T: 25.30
0;10;1;0;1;50.2
H: 50.20
Dallas: 0.00
Therm: 0.00
tempDHT: 0.00
HRDHT: 0.00
Thanks, Nicolas