Skip to content

Troubleshooting

Help! Everything just falls apart
2.7k Topics 21.5k Posts
  • RS485 Baud Rate Errors - Mixing HWSerial Devices Can Cause Problems

    2
    2 Votes
    2 Posts
    372 Views
    No one has replied
  • Newbie here. Raspberry pi serial gw and arduino sensor.

    5
    0 Votes
    5 Posts
    655 Views
    mfalkviddM
    Great work @nikosk, thanks for reporting back.
  • MQ135 with RS485

    5
    0 Votes
    5 Posts
    620 Views
    Q
    I found an root cause. In pin definition was #define AIQ_SENSOR_ANALOG_PIN 1 but should be #define AIQ_SENSOR_ANALOG_PIN A1 I do not know why with first definition it worked with nano but did not work with mini.
  • Sensebender Gateway and Node not talking !TSM:FPAR:NO REPLY

    4
    0 Votes
    4 Posts
    806 Views
    magpernM
    @therik No, I haven't solved it. But I haven't tried much either. The IKEA Molgan piggy-back-pcb is a openhardware device used by many people. One would think it either works as designed or does not work. If the radio is broken, that is one thing, but I have tried two radios. And the sensor can send data, the gateway responds, but the sensor does not recieve. I have also tried to changed the radio to a RFM69H... that works. I get no errors. The RFM69H is a Rasperry Pi gateway, the NRF24 is the Sensbender Gateway designed my the MySensors people. I will try on the NRF24 to add a capacitor, but again, if it is not there on original design and original design works for others, why would I need one?
  • Was läuft falsch?What's wrong?

    5
    1
    0 Votes
    5 Posts
    1k Views
    aDm1NA
    Danke schon mal für die Hilfe. Thank you in advance for the help. Ich bin jetzt so weit das alle Daten gesendet werden, bis auf die ds18b20. Ich habe die Verkabelung überprüft, kann jedoch keinen Fehler finden. Bin ich Blind? Sieht jemand eventuell einen Fehler in dem Sketch? I am now so far that all data is sent, except for the ds18b20. I have checked the cabling but can not find a fault. Am I blind? Does anyone see an error in the sketch? #include <MySensor.h> //ds18b20 & DHT #include <DHT.h> #include <DallasTemperature.h> #include <OneWire.h> // #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) #define CHILD_ID_MOISTURE1 0 #define CHILD_ID_MOISTURE2 1 #define CHILD_ID_MOISTURE3 2 #define CHILD_ID_MOISTURE4 3 //#define CHILD_ID_BATTERY 1 #define SENSOR_ANALOG_PIN 0 #define SENSOR_ANALOG_PIN1 1 #define SENSOR_ANALOG_PIN2 2 #define SENSOR_ANALOG_PIN3 3 #define SENSOR_POWER_PIN 8 //#define SLEEP_TIME 600000 // Sleep time between reads (in milliseconds) (=10 MINUTES) #define STABILIZATION_TIME 300 // Let the sensor stabilize before reading //#define BATTERY_FULL 3700 // 3,700 millivolts //#define BATTERY_ZERO 1700 // 1,700 millivolts //ds18b20 & DHT #define MAX_ATTACHED_DS18B20 6 #define ONE_WIRE_BUS 6 #define DHT1_DATA_PIN 7 #define CHILD_ID_DHT1HUM 6 #define CHILD_ID_DHT1TEMP 7 #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 = 3000; unsigned long SLEEP_TIME = 30000; boolean receivedConfig = false; boolean metric = true; int numSensors=0; 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. MyMessage msgDallas(0,V_TEMP); MyMessage msg6DHT1Temp(CHILD_ID_DHT1TEMP,V_TEMP); MyMessage msg7DHT1Hum(CHILD_ID_DHT1HUM,V_HUM); DHT dht; // MySensor gw; MyMessage msg1(CHILD_ID_MOISTURE1, V_HUM); MyMessage msg2(CHILD_ID_MOISTURE2, V_HUM); MyMessage msg3(CHILD_ID_MOISTURE3, V_HUM); MyMessage msg4(CHILD_ID_MOISTURE4, V_HUM); //MyMessage voltage_msg(CHILD_ID_BATTERY, V_VOLTAGE); int lastsoilValue1 = 0; int lastsoilValue2 = 0; int lastsoilValue3 = 0; int lastsoilValue4 = 0; //ds18b20 & DHT void before() { // Startup up the OneWire library sensors.begin(); } // void setup() { gw.begin(); gw.sendSketchInfo("Bodenfeuchte_Temperatur_Hum", "1.0"); //ds18b20 & DHT // requestTemperatures() will not block current thread sensors.setWaitForConversion(true); // 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); gw.present(CHILD_ID_DHT1TEMP,S_TEMP); gw.present(CHILD_ID_DHT1HUM,S_HUM); metric = gw.getConfig().isMetric; // pinMode(SENSOR_POWER_PIN, OUTPUT); gw.present(CHILD_ID_MOISTURE1, S_HUM); gw.present(CHILD_ID_MOISTURE2, S_HUM); gw.present(CHILD_ID_MOISTURE3, S_HUM); gw.present(CHILD_ID_MOISTURE4, S_HUM); delay(250); //gw.present(CHILD_ID_BATTERY, S_CUSTOM); } void loop() { //ds18b20 & DHT // 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) gw.sleep(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>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.; // Send in the new temperature gw.send(msgDallas.setSensor(i).set(temperature,1)); //#ifdef MY_DEBUG Serial.print("Dallas"); Serial.print(i); Serial.print(" :"); Serial.println(temperature); //#endif gw.wait(200); // sleep(SLEEP_TIME); } dht.setup(DHT1_DATA_PIN); // set data pin of DHT1 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) gw.sleep(dht.getMinimumSamplingPeriod()); // Force reading sensor, so it works also after sleep() // dht.readSensor(false); // Get temperature from DHT library float dht1temperature = dht.getTemperature(); if (isnan(dht1temperature)) { Serial.println("Failed reading temperature from DHT!"); } else if (!metric) { dht1temperature = dht.toFahrenheit(dht1temperature); } dht1temperature += SENSOR_TEMP_OFFSET; gw.send(msg6DHT1Temp.set(dht1temperature, 1)); //#ifdef MY_DEBUG Serial.print("DHT1TEMP: "); Serial.println(dht1temperature); //#endif gw.sleep(UPDATE_INTERVAL); // Get humidity from DHT library float dht1humidity = dht.getHumidity(); if (isnan(dht1humidity)) { Serial.println("Failed reading humidity from DHT"); } else { gw.send(msg7DHT1Hum.set(dht1humidity, 1)); //#ifdef MY_DEBUG Serial.print("DHT1HUM: "); Serial.println(dht1humidity); //#endif } // Sleep for a while to save energy gw.sleep(UPDATE_INTERVAL); //gw.wait(300); //DHT Ende digitalWrite(SENSOR_POWER_PIN, HIGH); // Power on the sensors //gw.wait(500); gw.sleep(STABILIZATION_TIME); //stabilization before mesuring int moistureLevel = (1023 - analogRead(SENSOR_ANALOG_PIN)) / 10.23; // read moisture of the first sensor if (moistureLevel != lastsoilValue1) { //test if moisture is different than before gw.send(msg1.set(moistureLevel)); //send to controller moisture level of sensor 1 lastsoilValue1 = moistureLevel; gw.wait(200); } int moistureLevel1 = (1023 - analogRead(SENSOR_ANALOG_PIN1)) / 10.23; // read moisture of the second sensor if (moistureLevel1 != lastsoilValue2) { //test if moisture is different than before gw.send(msg2.set(moistureLevel1)); //send to controller moisture level of sensor 2 lastsoilValue2 = moistureLevel1; gw.wait(200); } int moistureLevel2 = (1023 - analogRead(SENSOR_ANALOG_PIN2)) / 10.23; // read moisture of the third sensor if (moistureLevel2 != lastsoilValue3) { //test if moisture is different than before gw.send(msg3.set(moistureLevel2)); //send to controller moisture level of sensor 3 lastsoilValue3 = moistureLevel2; gw.wait(200); } int moistureLevel3 = (1023 - analogRead(SENSOR_ANALOG_PIN3)) / 10.23; // read moisture of fourth sensor if (moistureLevel3 != lastsoilValue4) { //test if moisture is different than before gw.send(msg4.set(moistureLevel3)); //send to controller moisture level of sensor 4 lastsoilValue3 = moistureLevel3; gw.wait(200); } //debugging comment it when dont use Serial.print("first plant :"); Serial.println(moistureLevel); Serial.print("second plant :"); Serial.println(moistureLevel1); Serial.print("third plant :"); Serial.println(moistureLevel2); Serial.print("fourth plant :"); Serial.println(moistureLevel3); digitalWrite(SENSOR_POWER_PIN, LOW); //spower off sensors //long voltage = readVcc(); //gw.send(voltage_msg.set(voltage / 1000.0, 3)); // redVcc returns millivolts and set wants volts and how many decimals (3 in our case) //gw.sendBatteryLevel(round((voltage - BATTERY_ZERO) * 100.0 / (BATTERY_FULL - BATTERY_ZERO))); gw.sleep(SLEEP_TIME); } /*long readVcc() { // From http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/ // Read 1.1V reference against AVcc // set the reference to Vcc and the measurement to the internal 1.1V reference #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) ADMUX = _BV(MUX5) | _BV(MUX0); #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) ADMUX = _BV(MUX3) | _BV(MUX2); #else ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); #endif delay(2); // Wait for Vref to settle ADCSRA |= _BV(ADSC); // Start conversion while (bit_is_set(ADCSRA, ADSC)); // measuring uint8_t low = ADCL; // must read ADCL first - it then locks ADCH uint8_t high = ADCH; // unlocks both long result = (high << 8) | low; result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000 return result; // Vcc in millivolts }*/``` send: 6-6-1-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0 send: 6-6-1-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.4 send: 6-6-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:1 read: 0-1-6 s=255,c=3,t=15,pt=6,l=2,sg=0:0100 read: 0-1-6 s=255,c=3,t=6,pt=0,l=1,sg=0:M sensor started, id=6, parent=1, distance=2 send: 6-6-1-0 s=255,c=3,t=11,pt=0,l=25,sg=0,st=ok:Bodenfeuchte_Temperatur_H send: 6-6-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0 send: 6-6-1-0 s=7,c=0,t=6,pt=0,l=0,sg=0,st=ok: send: 6-6-1-0 s=6,c=0,t=7,pt=0,l=0,sg=0,st=ok: send: 6-6-1-0 s=0,c=0,t=7,pt=0,l=0,sg=0,st=ok: send: 6-6-1-0 s=1,c=0,t=7,pt=0,l=0,sg=0,st=ok: send: 6-6-1-0 s=2,c=0,t=7,pt=0,l=0,sg=0,st=fail: send: 6-6-1-0 s=3,c=0,t=7,pt=0,l=0,sg=0,st=ok: send: 6-6-1-0 s=7,c=1,t=0,pt=7,l=5,sg=0,st=ok:18.3 DHT1TEMP: 18.30 send: 6-6-1-0 s=6,c=1,t=1,pt=7,l=5,sg=0,st=ok:25.0 DHT1HUM: 25.00 first plant :0 second plant :0 third plant :0 fourth plant :0
  • MKR1000 gateway problem

    8
    0 Votes
    8 Posts
    820 Views
    YveauxY
    @ziovic said in MKR1000 gateway problem: The dtostrf function included in MyHwSAMD.h is the AVR one ( avr/dtostrf.h) does not work with SAMD core. Well, this implementation is part of the official arduino Samd core: https://github.com/arduino/ArduinoCore-samd/blob/master/cores/arduino/avr/dtostrf.c You could file a bug report there if you like.
  • [lib 2.3.0, IDE 1.8.8] [UNO + 5100 shield] gateway hangs

    5
    1 Votes
    5 Posts
    622 Views
    macieiksM
    [UPDATE] I have tried in several way with no luck - even formatting Raspberry Pi card with fresh Domoticz. I did workaround and changed gateway to Raspberry Pi + NRF24 option. It is working perfectly and I have got ability to check and investigate MySensors debug logs remotely thanks to logging to pipe :) Regards, Maciek
  • OTA update mechanism with MYSbootloader

    1
    0 Votes
    1 Posts
    442 Views
    No one has replied
  • Leds Serial Gateway all flashing every second

    2
    0 Votes
    2 Posts
    338 Views
    mfalkviddM
    @petjepet the debug log will probably be the quickest way to find out
  • Raspberry Pi rf24 mqtt gateway not working

    2
    0 Votes
    2 Posts
    499 Views
    J
    Ok, this was super silly resolution. I had wrong CE pin selected, and confusion bit me again on the pin vs gpio thing of the header/brcm gpio mapping. On my rf24 module, I had (from previous implementations) wired up CE to GPIO 22 (pin 15), and IRQ to GPIO 25 (pin 22). So default CE line for rpi/rf24/mysgw is "22" (pin, NOT gpio ;) The frustration was that my module was being recognized, which gave false appearance of complete wiring correctness, but I think it never transitioned to TX. Not sure if it would be possible to sanity check RF24 driver to verify if CE line is working in module wiring or not. Anyhow, moral of the story is to check and double-check the wiring!!!
  • Unable to compile Raspberry Pi Gateway when signing enable

    3
    0 Votes
    3 Posts
    761 Views
    mfalkviddM
    For reference, https://github.com/mysensors/MySensors/issues/1246 is linked to the code fix
  • [SOLVED] arduino no longer compiles Gateway W5100MQTTClient

    5
    0 Votes
    5 Posts
    705 Views
    J
    That workaround did it, now the library example compiles. Thanks:clap: :clap: :clap:
  • Node is not going to sleep if can't send data

    2
    0 Votes
    2 Posts
    446 Views
    mfalkviddM
    @vidin use MY_TRANSPORT_WAIT_READY_MS You can search the forum for MY_TRANSPORT_WAIT_READY_MS to find earlier discussions on how to use it.
  • This topic is deleted!

    4
    0 Votes
    4 Posts
    187 Views
  • Arduino Uno with Ethernet Shield W5100 not working

    15
    0 Votes
    15 Posts
    3k Views
    YveauxY
    @spanners I told you it would make a big difference :-) Thanks for reporting back!
  • SX1276

    1
    2
    0 Votes
    1 Posts
    374 Views
    No one has replied
  • Upgrade 1.4 to 2.3.1 relay node

    3
    0 Votes
    3 Posts
    505 Views
    skywatchS
    @allysmith You can't take a 1.4 code as it is and use it with 2.3.1 - As @mfalkvidd says there are a lot of changes. Post your code and you might be able to get some pointers as to what needs to change.
  • [SOLVED] Puzzle over water meter .sensor

    9
    0 Votes
    9 Posts
    2k Views
    zboblamontZ
    @kimot Ironic then is it not that the same "random event" I was chasing occurred whether using the Whisper, a 3v8MHz or a 5v16MHz Pro-mini? I thought that rather narrowed causes to program or sensor, but hey, I'm no expert. As you might note above I had also excluded EMI effects through experiment
  • Arduino Mega 2560 Ethernet Gateway - Cant get it going.

    4
    0 Votes
    4 Posts
    1k Views
    pepsonP
    @dbagioni Any news in this thread ?
  • [SOLVED] Raspberry Pi serial gateway NRF24 - !TSM:INIT:TSP FAIL

    20
    0 Votes
    20 Posts
    3k Views
    gohanG
    dodgy cable/pin maybe?

20

Online

11.7k

Users

11.2k

Topics

113.1k

Posts