hmmm ok thanks. CASE CLOSED
afick
@afick
Best posts made by afick
Latest posts made by afick
-
RE: using interrupt - cant back to void loop
A little bit messy
/** The MySensors Arduino library handles the wireless radio link and protocol between your home built sensors/actuators and HA controller of choice. The sensors forms a self healing radio network with optional repeaters. Each repeater and gateway builds a routing tables in EEPROM which keeps track of the network topology allowing messages to be routed to nodes. Created by Henrik Ekblad <henrik.ekblad@mysensors.org> Copyright (C) 2013-2015 Sensnology AB Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors Documentation: http://www.mysensors.org Support Forum: http://forum.mysensors.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. ******************************* REVISION HISTORY Version 1.0 - Henrik Ekblad DESCRIPTION Motion Sensor example using HC-SR501 http://www.mysensors.org/build/motion */ // Enable debug prints #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include <SPI.h> #include <MySensors.h> //pir================================================================================================================ unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds) #define DIGITAL_INPUT_SENSOR 2 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!) #define CHILD_ID 40 // Id of the sensor child // Initialize motion message MyMessage msg(CHILD_ID, V_TRIPPED); bool lasttripped; //gas================================================================================================================ #define CHILD_ID_MQ 43 /************************Hardware Related Macros************************************/ #define MQ_SENSOR_ANALOG_PIN (4) //define which analog input channel you are going to use #define RL_VALUE (5) //define the load resistance on the board, in kilo ohms #define RO_CLEAN_AIR_FACTOR (9.83) //RO_CLEAR_AIR_FACTOR=(Sensor resistance in clean air)/RO, //which is derived from the chart in datasheet /***********************Software Related Macros************************************/ #define CALIBARAION_SAMPLE_TIMES (50) //define how many samples you are going to take in the calibration phase #define CALIBRATION_SAMPLE_INTERVAL (500) //define the time interal(in milisecond) between each samples in the //cablibration phase #define READ_SAMPLE_INTERVAL (50) //define how many samples you are going to take in normal operation #define READ_SAMPLE_TIMES (5) //define the time interal(in milisecond) between each samples in //normal operation /**********************Application Related Macros**********************************/ #define GAS_LPG (0) #define GAS_CO (1) #define GAS_SMOKE (2) /*****************************Globals***********************************************/ //VARIABLES float Ro = 10000.0; // this has to be tuned 10K Ohm int val = 0; // variable to store the value coming from the sensor float valMQ = 0.0; float lastMQ = 0.0; float LPGCurve[3] = {2.3, 0.21, -0.47}; //two points are taken from the curve. //with these two points, a line is formed which is "approximately equivalent" //to the original curve. //data format:{ x, y, slope}; point1: (lg200, 0.21), point2: (lg10000, -0.59) float COCurve[3] = {2.3, 0.72, -0.34}; //two points are taken from the curve. //with these two points, a line is formed which is "approximately equivalent" //to the original curve. //data format:{ x, y, slope}; point1: (lg200, 0.72), point2: (lg10000, 0.15) float SmokeCurve[3] = {2.3, 0.53, -0.44}; //two points are taken from the curve. //with these two points, a line is formed which is "approximately equivalent" //to the original curve. //data format:{ x, y, slope}; point1: (lg200, 0.53), point2:(lg10000,-0.22) MyMessage msg_gas(CHILD_ID_MQ, V_LEVEL); unsigned long interval_gas = 10000; // sprawdzanie czasu dla gazu //light #define CHILD_ID_LIGHT 44 #define LIGHT_SENSOR_ANALOG_PIN 2 MyMessage msgLight(CHILD_ID_LIGHT, V_LIGHT_LEVEL); int lastLightLevel; //dht================================================================================================================ #include <DHT.h> #define CHILD_ID_HUM 41 #define CHILD_ID_TEMP 42 #define HUMIDITY_SENSOR_DIGITAL_PIN 6 DHT dht; float lastTemp; float lastHum; boolean metric = true; MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); unsigned long previousMillis_temp = 0; const long interval = 10000; void setup() { pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); metric = getConfig().isMetric; //gas Ro = MQCalibration(MQ_SENSOR_ANALOG_PIN); //Calibrating the sensor. Please make sure the sensor is in clean air } void presentation() { //dht present(CHILD_ID_HUM, S_HUM); present(CHILD_ID_TEMP, S_TEMP); //pir // Send the sketch version information to the gateway and Controller sendSketchInfo("Piwnica przejscie", "0.3"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_MOTION); attachInterrupt(digitalPinToInterrupt(2), check_pir, CHANGE); //gas present(CHILD_ID_MQ, S_AIR_QUALITY); //light present(CHILD_ID_LIGHT, S_LIGHT_LEVEL); } void loop() { unsigned long currentMillis_gas = millis(); unsigned long currentMillis_temp = millis(); if (currentMillis_temp - previousMillis_temp >= interval) { check_temp(); check_gas(); check_light(); previousMillis_temp = currentMillis_temp; } } void check_light() { int lightLevel = (1023 - analogRead(LIGHT_SENSOR_ANALOG_PIN)) / 10.23; Serial.println(lightLevel); if (lightLevel != lastLightLevel) { send(msgLight.set(lightLevel)); lastLightLevel = lightLevel; } } void check_pir() { Serial.println("check PIR"); // Read digital motion value boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); send(msg.set(tripped ? "1" : "0")); // Send tripped value to gw } void check_temp() { delay(dht.getMinimumSamplingPeriod()); // Fetch temperatures from DHT sensor float temperature = dht.getTemperature(); if (isnan(temperature)) { Serial.println("Failed reading temperature from DHT"); } else if (temperature != lastTemp) { lastTemp = temperature; if (!metric) { temperature = dht.toFahrenheit(temperature); } send(msgTemp.set(temperature, 1)); #ifdef MY_DEBUG Serial.print("T: "); Serial.println(temperature); #endif } // Fetch humidity from DHT sensor float humidity = dht.getHumidity(); if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum) { lastHum = humidity; send(msgHum.set(humidity, 1)); #ifdef MY_DEBUG Serial.print("H: "); Serial.println(humidity); #endif } } void check_gas() { uint16_t valMQ = MQGetGasPercentage(MQRead(MQ_SENSOR_ANALOG_PIN) / Ro, GAS_CO); Serial.println(val); Serial.print("LPG:"); Serial.print(MQGetGasPercentage(MQRead(MQ_SENSOR_ANALOG_PIN) / Ro, GAS_LPG) ); Serial.print( "ppm" ); Serial.print(" "); Serial.print("CO:"); Serial.print(MQGetGasPercentage(MQRead(MQ_SENSOR_ANALOG_PIN) / Ro, GAS_CO) ); Serial.print( "ppm" ); Serial.print(" "); Serial.print("SMOKE:"); Serial.print(MQGetGasPercentage(MQRead(MQ_SENSOR_ANALOG_PIN) / Ro, GAS_SMOKE) ); Serial.print( "ppm" ); Serial.print("\n"); if (valMQ != lastMQ) { send(msg_gas.set((int)ceil(valMQ))); lastMQ = ceil(valMQ); } } float MQResistanceCalculation(int raw_adc) { return ( ((float)RL_VALUE * (1023 - raw_adc) / raw_adc)); } /***************************** MQCalibration **************************************** Input: mq_pin - analog channel Output: Ro of the sensor Remarks: This function assumes that the sensor is in clean air. It use MQResistanceCalculation to calculates the sensor resistance in clean air and then divides it with RO_CLEAN_AIR_FACTOR. RO_CLEAN_AIR_FACTOR is about 10, which differs slightly between different sensors. ************************************************************************************/ float MQCalibration(int mq_pin) { int i; float val = 0; for (i = 0; i < CALIBARAION_SAMPLE_TIMES; i++) { //take multiple samples val += MQResistanceCalculation(analogRead(mq_pin)); delay(CALIBRATION_SAMPLE_INTERVAL); } val = val / CALIBARAION_SAMPLE_TIMES; //calculate the average value val = val / RO_CLEAN_AIR_FACTOR; //divided by RO_CLEAN_AIR_FACTOR yields the Ro //according to the chart in the datasheet return val; } /***************************** MQRead ********************************************* Input: mq_pin - analog channel Output: Rs of the sensor Remarks: This function use MQResistanceCalculation to caculate the sensor resistenc (Rs). The Rs changes as the sensor is in the different consentration of the target gas. The sample times and the time interval between samples could be configured by changing the definition of the macros. ************************************************************************************/ float MQRead(int mq_pin) { int i; float rs = 0; for (i = 0; i < READ_SAMPLE_TIMES; i++) { rs += MQResistanceCalculation(analogRead(mq_pin)); delay(READ_SAMPLE_INTERVAL); } rs = rs / READ_SAMPLE_TIMES; return rs; } /***************************** MQGetGasPercentage ********************************** Input: rs_ro_ratio - Rs divided by Ro gas_id - target gas type Output: ppm of the target gas Remarks: This function passes different curves to the MQGetPercentage function which calculates the ppm (parts per million) of the target gas. ************************************************************************************/ int MQGetGasPercentage(float rs_ro_ratio, int gas_id) { if ( gas_id == GAS_LPG ) { return MQGetPercentage(rs_ro_ratio, LPGCurve); } else if ( gas_id == GAS_CO ) { return MQGetPercentage(rs_ro_ratio, COCurve); } else if ( gas_id == GAS_SMOKE ) { return MQGetPercentage(rs_ro_ratio, SmokeCurve); } return 0; } /***************************** MQGetPercentage ********************************** Input: rs_ro_ratio - Rs divided by Ro pcurve - pointer to the curve of the target gas Output: ppm of the target gas Remarks: By using the slope and a point of the line. The x(logarithmic value of ppm) of the line could be derived if y(rs_ro_ratio) is provided. As it is a logarithmic coordinate, power of 10 is used to convert the result to non-logarithmic value. ************************************************************************************/ int MQGetPercentage(float rs_ro_ratio, float *pcurve) { return (pow(10, ( ((log(rs_ro_ratio) - pcurve[1]) / pcurve[2]) + pcurve[0]))); }
-
RE: using interrupt - cant back to void loop
check_pir is standard function created from mysensors example (motion)
void check_pir() { Serial.println("check PIR"); // Read digital motion value boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); send(msg.set(tripped?"1":"0")); // Send tripped value to gw }```
-
using interrupt - cant back to void loop
Hello,
I'm checking some sensors in some time period:
void loop() { unsigned long currentMillis_gas = millis(); unsigned long currentMillis_temp = millis(); if (currentMillis_temp - previousMillis_temp >= interval) { check_temp(); check_gas(); check_light(); previousMillis_temp = currentMillis_temp; } }
All working fine.
But i have also PIR sensor.
To catch PIR status I'm using interrupt
attachInterrupt(digitalPinToInterrupt(2), check_pir, CHANGE);
All works fine - except one think.
When I call function check_pir() using interrupt, program is not able to back (after finishing function check_pir()) to running void loop.Its like program jump to check_pir() and stay there for ever....
Any idea what im doing wrong ?
-
[SOLVED] Using interupt - partial
Hello,
UPDATE: now i realized that when node will go sleep i will lose ability to on/off realy - is there any solution for that ?
I have problem with my code.
I build sensor from:
- Arduino nano v3 (clone)
- DHT11
- Relay
- Window/door switch
I put all 3 examples into 1 piece ,create some function.
What i want to get is -
-send msg when debounce status will change (open/close door)- this is workin fine
-remote on/off relay - this is workin fine- get temp and hum - this is working finr
- sleep for 10000ms but wake when debounce status will change - THIS IS NOT WORKING.
My sensor is working all the time and sending msg all time instead go to sleep ...
Can anyone look at this code and say what is wrong ?
/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 1.0 - Henrik Ekblad * * DESCRIPTION * Example sketch showing how to control physical relays. * This example will remember relay state after power failure. * http://www.mysensors.org/build/relay */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Enable repeater functionality for this node #define MY_REPEATER_FEATURE #include <SPI.h> #include <MySensors.h> //dht #include <DHT.h> #define DHT_DATA_PIN 3 #define SENSOR_TEMP_OFFSET 0 // Sleep time between sensor updates (in milliseconds) // Must be >1000ms for DHT22 and >2000ms for DHT11 static const uint64_t UPDATE_INTERVAL = 60000; // Force sending an update of the temperature after n sensor reads, so a controller showing the // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that // the value didn't change since; // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms] static const uint8_t FORCE_UPDATE_N_READS = 10; #define CHILD_ID_HUM 39 #define CHILD_ID_TEMP 40 float lastTemp; float lastHum; uint8_t nNoUpdatesTemp; uint8_t nNoUpdatesHum; bool metric = true; MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); DHT dht; //kontakt #include <Bounce2.h> #define CHILD_ID 33 #define BUTTON_PIN 2 // Arduino Digital I/O pin for button/reed switch #define INTERRUPT BUTTON_PIN-2 unsigned long SLEEP_TIME = 120000; Bounce debouncer = Bounce(); int oldValue=-1; // Change to V_LIGHT if you use S_LIGHT in presentation below MyMessage msg(CHILD_ID,V_TRIPPED); //relay #define RELAY_1 6 // 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 void before() { for (int sensor=1, pin=RELAY_1; 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); } } void setup() { //kontaktron // Setup the button pinMode(BUTTON_PIN,INPUT); // Activate internal pull-up digitalWrite(BUTTON_PIN,HIGH); // After setting up the button, setup debouncer debouncer.attach(BUTTON_PIN); debouncer.interval(5); //dht dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) { Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!"); } // Sleep for the time of the minimum sampling period to give the sensor time to power up // (otherwise, timeout errors might occure for the first reading) sleep(dht.getMinimumSamplingPeriod()); } void loop () { check_debounce(); check_temp(); sleep(BUTTON_PIN-2, CHANGE, SLEEP_TIME); } void check_debounce() { //kontaktron debouncer.update(); // Get the update value int value = debouncer.read(); Serial.println(value); if (value != oldValue) { // Send in the new value send(msg.set(value==HIGH ? 1 : 0)); oldValue = value; } } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Kurczakowo", "0.1"); 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) present(sensor, S_LIGHT); } present(CHILD_ID_HUM, S_HUM); present(CHILD_ID_TEMP, S_TEMP); metric = getConfig().isMetric; //kontaktron present(CHILD_ID, S_DOOR); } void check_temp() { // Force reading sensor, so it works also after sleep() //dht.readSensor(true); // Get temperature from DHT library float temperature = dht.getTemperature(); if (isnan(temperature)) { Serial.println("Failed reading temperature from DHT!"); } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) { // Only send temperature if it changed since the last measurement or if we didn't send an update for n times lastTemp = temperature; if (!metric) { temperature = dht.toFahrenheit(temperature); } // Reset no updates counter nNoUpdatesTemp = 0; temperature += SENSOR_TEMP_OFFSET; send(msgTemp.set(temperature, 1)); #ifdef MY_DEBUG Serial.print("T: "); Serial.println(temperature); #endif } else { // Increase no update counter if the temperature stayed the same nNoUpdatesTemp++; } // Get humidity from DHT library float humidity = dht.getHumidity(); if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) { // Only send humidity if it changed since the last measurement or if we didn't send an update for n times lastHum = humidity; // Reset no updates counter nNoUpdatesHum = 0; send(msgHum.set(humidity, 1)); #ifdef MY_DEBUG Serial.print("H: "); Serial.println(humidity); #endif } else { // Increase no update counter if the humidity stayed the same nNoUpdatesHum++; } } void receive(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 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: [Branch][beta 2.0] GW with dallas temp not sending data to domoticz
HELLO,
serial debug is poor....
in dallas loop dallas data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas gn data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas 0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0-beta) 0;255;3;0;9;Radio init successful. IP: 192.168.0.11 0;255;3;0;9;Init complete, id=0, parent=0, distance=0 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.00 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 25.50 reading from dallas in dallas loop dallas sendign data from dallas 26.00 reading from dallas in dallas loop dallas sendign data from dallas 26.00 reading from dallas in dallas loop dallas sendign data from dallas 26.00 reading from dallas in dallas loop dallas sendign data from dallas 26.00 reading from dallas in dallas loop dallas sendign data from dallas 26.50 reading from dallas in dallas loop dallas sendign data from dallas 26.50 reading from dallas in dallas loop dallas sendign data from dallas 26.50 reading from dallas in dallas loop dallas sendign data from dallas 26.50 reading from dallas in dallas loop dallas sendign data from dallas 27.00 reading from dallas in dallas loop dallas sendign data from dallas 27.00 reading from dallas in dallas loop dallas sendign data from dallas 27.00 reading from dallas in dallas loop dallas sendign data from dallas 27.00 reading from dallas in dallas loop dallas sendign data from dallas 27.50 reading from dallas in dallas loop dallas sendign data from dallas 27.50 reading from dallas in dallas loop dallas sendign data from dallas 27.50 reading from dallas in dallas loop dallas sendign data from dallas 27.50 reading from dallas in dallas loop dallas sendign data from dallas 27.50 reading from dallas in dallas loop dallas sendign data from dallas 27.50 reading from dallas in dallas loop dallas sendign data from dallas 28.00 reading from dallas in dallas loop dallas sendign data from dallas 28.00 reading from dallas in dallas loop dallas sendign data from dallas 28.00 reading from dallas in dallas loop dallas sendign data from dallas 28.00 reading from dallas in dallas loop dallas sendign data from dallas 28.00 reading from dallas in dallas loop dallas sendign data from dallas 28.50 reading from dallas in dallas loop dallas sendign data from dallas 28.50 reading from dallas in dallas loop dallas sendign data from dallas 28.50 reading from dallas in dallas loop dallas sendign data from dallas 28.50 reading from dallas in dallas loop dallas sendign data from dallas 28.50 reading from dallas in dallas loop dallas sendign data from dallas 28.50 reading from dallas in dallas loop dallas sendign data from dallas 28.50 reading from dallas in dallas loop dallas sendign data from dallas 28.50 reading from dallas in dallas loop dallas sendign data from dallas 29.00 reading from dallas in dallas loop dallas sendign data from dallas 29.00 reading from dallas in dallas loop dallas sendign data from dallas 29.00 reading from dallas in dallas loop dallas sendign data from dallas 29.00 reading from dallas in dallas loop dallas sendign data from dallas 29.00 reading from dallas in dallas loop dallas sendign data from dallas 29.00 reading from dallas in dallas loop dallas sendign data from dallas 29.00 reading from dallas in dallas loop dallas sendign data from dallas 29.00 reading from dallas in dallas loop dallas sendign data from dallas 29.50 reading from dallas in dallas loop dallas sendign data from dallas 29.50 reading from dallas in dallas loop dallas sendign data from dallas 29.50 reading from dallas in dallas loop dallas sendign data from dallas 29.50 reading from dallas in dallas loop dallas sendign data from dallas 29.50 reading from dallas in dallas loop dallas sendign data from dallas 29.50 reading from dallas in dallas loop dallas sendign data from dallas 29.50 reading from dallas in dallas loop dallas sendign data from dallas 29.50 reading from dallas in dallas loop dallas sendign data from dallas 29.50 reading from dallas in dallas loop dallas sendign data from dallas 29.50 reading from dallas in dallas loop dallas sendign data from dallas 30.00 reading from dallas in dallas loop dallas sendign data from dallas 30.00 reading from dallas in dallas loop dallas sendign data from dallas 30.00 reading from dallas in dallas loop dallas sendign data from dallas 30.00 reading from dallas in dallas loop dallas sendign data from dallas 30.00 reading from dallas in dallas loop dallas sendign data from dallas 30.00 reading from dallas in dallas loop dallas sendign data from dallas 30.00 reading from dallas in dallas loop dallas sendign data from dallas 30.00 reading from dallas in dallas loop dallas sendign data from dallas 30.00 reading from dallas in dallas loop dallas sendign data from dallas 30.00 reading from dallas in dallas loop dallas sendign data from dallas 30.00 reading from dallas in dallas loop dallas sendign data from dallas 30.50 reading from dallas in dallas loop dallas sendign data from dallas 30.50 reading from dallas in dallas loop dallas sendign data from dallas 30.50 reading from dallas in dallas loop dallas sendign data from dallas 30.50 reading from dallas in dallas loop dallas sendign data from dallas 30.50 reading from dallas in dallas loop dallas sendign data from dallas 30.50 reading from dallas in dallas loop dallas sendign data from dallas 30.50 reading from dallas 0;255;3;0;9;Eth: connect 0;255;3;0;9;Eth: 0;0;3;0;2; in dallas loop dallas sendign data from dallas 30.50 reading from dallas in dallas loop dallas sendign data from dallas 30.50 reading from dallas in dallas loop dallas sendign data from dallas 30.50 reading from dallas in dallas loop dallas sendign data from dallas 30.50 reading from dallas in dallas loop dallas sendign data from dallas 30.50 reading from dallas 0;255;3;0;9;Eth: 0;0;3;0;2;Get Version in dallas loop dallas sendign data from dallas 30.50 reading from dallas in dallas loop dallas sendign data from dallas 30.50 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas 0;255;3;0;9;Eth: 0;0;3;0;18;PING in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.00 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 31.50 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas 0;255;3;0;9;Eth: 0;0;3;0;18;PING in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.00 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas 0;255;3;0;9;Eth: 0;0;3;0;18;PING in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas 0;255;3;0;9;Eth: 0;0;3;0;18;PING in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 33.00 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas 0;255;3;0;9;read: 2-2-0 s=10,c=1,t=13,pt=2,l=2,sg=0:98 in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas 0;255;3;0;9;Eth: 0;0;3;0;18;PING in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50 reading from dallas in dallas loop dallas sendign data from dallas 32.50
All what i get is all what i send to serial...
-
RE: [Branch][beta 2.0] GW with dallas temp not sending data to domoticz
Hello,
Thanks for help, but after change to
send(msgDallas.setSensor(i).set(temperature,1));
Still not working ... ;(
-
[Branch][beta 2.0] GW with dallas temp not sending data to domoticz
Hello i have problem with dallas temp sensor on my GW with LAN.
GW read data from dallas but is not sended to domoticz
/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 1.0 - Henrik EKblad * Contribution by a-lurker and Anticimex, * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de> * Contribution by Tomas Hozza <thozza@gmail.com> * * * DESCRIPTION * The EthernetGateway sends data received from sensors to the ethernet link. * The gateway also accepts input on ethernet interface, which is then sent out to the radio network. * * The GW code is designed for Arduino 328p / 16MHz. ATmega168 does not have enough memory to run this program. * * LED purposes: * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly * - ERR (red) - fast blink on error during transmission error or recieve crc error * * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions. * */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 //SET POWER #define MY_RF24_PA_LEVEL RF24_PA_MAX // Enable gateway ethernet module type #define MY_GATEWAY_W5100 // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal) //#define MY_W5100_SPI_EN 4 // Enable Soft SPI for NRF radio (note different radio wiring is required) // The W5100 ethernet module seems to have a hard time co-operate with // radio on the same spi bus. #if !defined(MY_W5100_SPI_EN) #define MY_SOFTSPI #define MY_SOFT_SPI_SCK_PIN 15 #define MY_SOFT_SPI_MISO_PIN 17 #define MY_SOFT_SPI_MOSI_PIN 16 #endif // When W5100 is connected we have to move CE/CSN pins for NRF radio #define MY_RF24_CE_PIN 5 #define MY_RF24_CS_PIN 6 //#define MY_RF24_PA_LEVEL RF24_PA_MIN // Enable to UDP //#define MY_USE_UDP #define MY_IP_ADDRESS 192,168,0,11 // If this is disabled, DHCP is used to retrieve address // Renewal period if using DHCP //#define MY_IP_RENEWAL_INTERVAL 60000 // The port to keep open on node server mode / or port to contact in client mode #define MY_PORT 5003 // Controller ip address. Enables client mode (default is "server" mode). // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254 // The MAC address can be anything you want but should be unique on your network. // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use. // Note that most of the Ardunio examples use "DEAD BEEF FEED" for the MAC address. #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED // Flash leds on rx/tx/err #define MY_LEDS_BLINKING_FEATURE // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway #define MY_INCLUSION_BUTTON_FEATURE // 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 #define MY_DEFAULT_ERR_LED_PIN 7 // Error led pin #define MY_DEFAULT_RX_LED_PIN 8 // Receive led pin #define MY_DEFAULT_TX_LED_PIN 9 // the PCB, on board LED #include <SPI.h> #if defined(MY_USE_UDP) #include <EthernetUdp.h> #endif #include <Ethernet.h> #include <MySensor.h> //================================================================== //======================================================================================================== //DALLAS #include <MySensor.h> #include <SPI.h> #include <DallasTemperature.h> #include <OneWire.h> #define ONE_WIRE_BUS 22 // Pin where dallase sensor is connected #define MAX_ATTACHED_DS18B20 2 //unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensorsDallas(&oneWire); float lastTemperature[MAX_ATTACHED_DS18B20]; int numSensors = 1; boolean receivedConfig = false; #define CHILD_ID_DALLAS 9 // Initialize temperature message MyMessage msgDallas(CHILD_ID_DALLAS, V_TEMP); int temperatureDallas = -300; void setup() { } void presentation() { //======================================================================================================== //DALLLAS sensorsDallas.begin(); numSensors = sensorsDallas.getDeviceCount(); present(CHILD_ID_DALLAS, S_TEMP); } void loop() { //======================================================================================================== //DALLAS sensorsDallas.requestTemperatures(); Serial.println("reading from dallas"); // query conversion time and sleep until conversion completed int16_t conversionTime = sensorsDallas.millisToWaitForConversion(sensorsDallas.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) sleep(conversionTime); // Read temperatures and send them to controller for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) { Serial.println("in dallas loop dallas"); // Fetch and round temperature to one decimal float temperature = static_cast<float>(static_cast<int>((getConfig().isMetric?sensorsDallas.getTempCByIndex(i):sensorsDallas.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 Serial.println("sendign data from dallas"); // Send in the new temperature Serial.println(send(msgDallas.set(temperature,1))); // Save new temperatures for next compare lastTemperature[i]=temperature; } Serial.println(temperature); }}
any idea why ?
-
RE: [n00b]]Ethernet GW - without NF24
Even if i change CHILD_ID_RELAY (to 5 or 6 ) sill the same.
-
RE: [n00b]]Ethernet GW - without NF24
Nothing special
0;0;3;0;9;Starting... IP: 192.168.0.250 0;0;3;0;9;gateway started, id=0, parent=0, distance=0
Domoticz log
2015-11-09 23:09:50.588 (GW) Temp + Humidity (TempHum) 2015-11-09 23:09:53.599 (GW) Temp + Humidity (TempHum) 2015-11-09 23:09:56.614 (GW) Temp + Humidity (TempHum) 2015-11-09 23:09:56.620 (GW) Temp + Humidity (TempHum) 2015-11-09 23:10:00.632 (GW) Temp + Humidity (TempHum) 2015-11-09 23:10:00.680 (GW) Lighting 2 (Security Sensor) 2015-11-09 23:10:03.706 (GW) Temp + Humidity (TempHum) 2015-11-09 23:10:07.718 (GW) Temp + Humidity (TempHum) 2015-11-09 23:10:12.730 (GW) Temp + Humidity (TempHum) 2015-11-09 23:10:17.745 (GW) Temp + Humidity (TempHum) 2015-11-09 23:10:21.762 (GW) Temp + Humidity (TempHum) 2015-11-09 23:10:22.770 (GW) Lighting 2 (Security Sensor) 2015-11-09 23:10:27.791 (GW) Temp + Humidity (TempHum) 2015-11-09 23:10:31.805 (GW) Temp + Humidity (TempHum) 2015-11-09 23:10:32.812 (GW) Temp + Humidity (TempHum)
I'm receiving only this kind of information.
How can i send "0" from domoticz to GW ?