Skip to content

Troubleshooting

2.7k Topics 21.5k Posts

Help! Everything just falls apart

  • Multiple DHT22 in one sensor for greenhouse (newbee question)

    multiple dht22
    11
    0 Votes
    11 Posts
    6k Views
    P
    Is there a way i could display the temp and hum for each sensor on an lcd screen? I know how to do this for data that is not using pointers. below is my sketch that flips between 2 sensors on the LCD /* test modified from a v1 basic mutliple multi dht22 sketch Gives correct temp and humidity readings for each dht22 in domoticz (ie not crossed between 1 and 2) Not displaying properly on the LCD yet Domoticz ver 4.11558 beta Gateway 3.2.1 node 3.2.1 09/12/2019 Arduino Mega 1.8 inch TFT LCD Display 128x160 8/16Bit ST7735S x2 DHT22 NRF24 */ #define MY_DEBUG #define MY_RADIO_NRF24 //Mega Pins 49 CE, 53 CSN/CS, 52 SCK, 51 MOSI, 50 MISO #define MY_RF24_CE_PIN 49 #define MY_RF24_CS_PIN 53 #define MY_RF24_PA_LEVEL (RF24_PA_MIN) #define MY_NODE_ID 103 #include <UTFT.h> //LCD 1.8 #include <SPI.h> #include <MySensors.h> #include <DHT.h> #define RELAY1 44 #define RELAY2 45 //static const uint8_t FORCE_UPDATE_N_READS = 10; extern uint8_t BigFont[]; extern uint8_t SmallFont[]; #define NUM_SENSORS 2 unsigned long SLEEP_TIME = 6000; // Sleep time between reads (in milliseconds) //MySensor gw; MyMessage tempMssg(0, V_TEMP); MyMessage humMssg(NUM_SENSORS, V_HUM); byte tempID[NUM_SENSORS] = {0, 1}; byte humID[NUM_SENSORS] = {2, 3}; DHT* dht[NUM_SENSORS]; byte sensorPin[NUM_SENSORS] = {40, 42}; float lastTemp[NUM_SENSORS] = {0.0, 0.0}; float lastHum[NUM_SENSORS] = {0.0, 0.0}; boolean metric = true; //LCD setup UTFT myGLCD(ITDB18SP, 11, 12, 8, 9, 10); // lcd pins 3,2,6,5,4 void setup() { myGLCD.InitLCD(LANDSCAPE);// or PORTRAIT myGLCD.clrScr(); myGLCD.setColor(200, 255, 255); myGLCD.setBackColor(0, 0, 0); myGLCD.setFont(SmallFont); myGLCD.print("Version & Sketch", LEFT, 3); myGLCD.print("V.2 TEST5", LEFT, 16); delay(1000); myGLCD.clrScr(); myGLCD.setFont(SmallFont); myGLCD.setColor(255, 255, 255); myGLCD.print("TH1 OUTSIDE", 2, 2); myGLCD.print("o", 67, 12); myGLCD.print("C", 74, 15); myGLCD.print("%", 150, 15); myGLCD.print("TH2 INSIDE", 2, 36); myGLCD.print("o", 67, 46); myGLCD.print("C", 74, 49); myGLCD.print("%", 150, 49); Serial.begin(9600); // begin(); for (int i = 0; i < NUM_SENSORS; i++) { dht[i] = new DHT; dht[i]->setup(sensorPin[i]); } sendSketchInfo("DHT22 Humidity test5", "2.0"); for (int i = 0; i < NUM_SENSORS; i++) { present(tempID[i], S_TEMP); present(humID[i], S_HUM); } metric = getControllerConfig().isMetric; Serial.println(F("Setup Complete.")); } void loop() { for (int i = 0; i < NUM_SENSORS; i++) { delay(dht[i]->getMinimumSamplingPeriod()); float temperature = dht[i]->getTemperature(); if (isnan(temperature)) { Serial.print(F("Failed reading temperature from DHT")); Serial.println(i); } else if (temperature != lastTemp[i]) { lastTemp[i] = temperature; if (!metric) { temperature = dht[i]->toFahrenheit(temperature); } send(tempMssg.setSensor(i).set(temperature, false)); // no ack Serial.print(F("T")); Serial.print(i); Serial.print(F("= ")); Serial.println(temperature); } myGLCD.setFont(BigFont); myGLCD.setColor(100, 255, 255); myGLCD.printNumF(temperature, 1, 1, 15); // this where something needs to be changed to get it to display each temp separately float humidity = dht[i]->getHumidity(); if (isnan(humidity)) { Serial.print("Failed reading humidity from DHT"); Serial.println(i); } else if (humidity != lastHum[i]) { lastHum[i] = humidity; send(humMssg.setSensor(i).set(humidity, false)); // no ack Serial.print(F("H")); Serial.print(i); Serial.print(F("= ")); Serial.println(humidity); // this where something needs to be changed to get it to display each hum separately myGLCD.setFont(BigFont); myGLCD.setColor(100, 255, 255); myGLCD.printNumF(humidity, 1, 85, 15); } } sleep(SLEEP_TIME); //sleep a bit }```
  • Disable restarting arduino after connect to serial gateway.

    7
    0 Votes
    7 Posts
    955 Views
    YveauxY
    @dawidi great to hear you solved it! Glad I could help.
  • 0 Votes
    1 Posts
    634 Views
    No one has replied
  • Switching gateway issues

    4
    0 Votes
    4 Posts
    646 Views
    electrikE
    Are you sure the node can reach the gateway? So is the connection okay?
  • Dallas sensors puzzle - sensors.begin()

    dallas ds18b20
    7
    0 Votes
    7 Posts
    1k Views
    zboblamontZ
    @scalz That may well help even if I'll struggle to understand it. At least your setup combines similar basic principles to my objective. Since the OP, have nailed "sensors.begin()" which causes problems as a Dallas library call, and as your sketch does not employ that library, perhaps a glimmer of a solution.... Many thanks for that. Cheers...
  • Compiling error gdb_hooks.h

    3
    0 Votes
    3 Posts
    654 Views
    B
    @mfalkvidd Thanks, that solution worked and sorry I should have found that posting myself of course. FYI, for loading the ESP8266 Board definitions the usual URL https://arduino.esp8266.com/stable/package_esp8266com_index.json did not work for me anymore. Instead I had to use https://github.com/esp8266/Arduino/releases/download/2.4.2/package_esp8266com_index.json
  • Arduino Pro Mini and Mini W5100 LAN Ethernet Shield

    8
    0 Votes
    8 Posts
    1k Views
    giangiredG
    @mfalkvidd Solved, it was my mistake on wiring. Thanks.
  • What does 1 and 0 in send(msg.set(value==HIGH ? 1 : 0)) really means?

    6
    0 Votes
    6 Posts
    1k Views
    skywatchS
    @pl_rekin It's great when the 'penny drops' - Learning is not so bad when you can admit not knowing something and move on with enhanced knowledge! :)
  • be aware of previous used arduino as serial gateway

    2
    5 Votes
    2 Posts
    719 Views
    alowhumA
    This is exactly why the Candle Manager always flashes the MySensors clear sketch before flashing the actual code.
  • Gateway/Relay Sensor not found through Jeedom

    1
    0 Votes
    1 Posts
    272 Views
    No one has replied
  • Anyone help with 4 relays please?

    34
    0 Votes
    34 Posts
    9k Views
    parachutesjP
    @petr-nosek sure with the 2nd power supply it looks different. However mine were all in-wall and there is just not enough space for this.
  • 0 Votes
    21 Posts
    6k Views
    badmannenB
    @rafael156 oh crap ... I put in that lowFuse as FF .. ( I read you had it for 8 MHz INTERNAL .. but nooo you wrote external ... ooops ... is there any way to force write it back without connecting an 8 MHz oscillator to the chip .. I only got 16 MHz oscillators .. or am I screwed for that chip until I go and get one?
  • Dynamic change of variable name

    14
    0 Votes
    14 Posts
    2k Views
    Sergio RiusS
    @badmannen @Yveaux You're absolutely right. I was lazy, only changed a symbol and gave a bad advice. My response should be changed to <=4. Still I don't understand what the original question was.
  • MySensors gateway and network reliability

    20
    1
    1 Votes
    20 Posts
    3k Views
    N
    If you really enjoy fiddling with connection problems and gateways freezing you should try using the gsm gateway. At first it froze up every day or two. I now run a second mcu just to check connectivity to mycontroller and resetting the gateway when it fails. This sometimes happen a couple of times a day.
  • only wake on interupt..

    17
    0 Votes
    17 Posts
    2k Views
    zboblamontZ
    @markjgabb "..cut back all unneccicary steps and really locked down what was going on.." was indeed the idea. What I went on to explain is than you are reporting the state of D3 which goes HIGH/LOW/HIGH via the button, not the light. The critical difference between @skywatch and your install is movement detection maintains a value, your button does not. If you create a variable before the loop, say boolean lightswitch=false; (presuming that the light is ON when you program it) this variable will be changed and reported to Domoticz in the loop. Top of the loop you toggle the "lightswitch" value, first time it will switch false to true, report in the "lightswitch" value then go to sleep. Bottom of the loop your " sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); should trigger on a LOW, as this is the momentary state of D3 ONLY when the button is pressed. Your next button press activates the loop, toggles "lightswitch", reports and goes back to sleep, at least two years on a pair of AA cells. Were it I doing this there would be a mains powered indicator on the switch plate which cuts out when the light is on, A- To find the switch in the dark, B-To provide an indicator which can be used to verify the actual state of the light to ensure it stays in sync (Murphy's Law). I don't see the point of using heartbeat as it is not a security device, and only fire the battery reading mosfet every X loops.
  • New installation on WIN10

    5
    0 Votes
    5 Posts
    793 Views
    skywatchS
    @kurtsejr Good to hear that ! :)
  • Signing fails due to NACKed messages

    11
    2
    1 Votes
    11 Posts
    2k Views
    tekkaT
    @encrypt said in Signing fails due to NACKed messages: I can't enable radio logging easily but I suspect it could be caused by the auto-adjusting RSSI feature... I'm afraid, but without additional debug information it's gonna stay a guessing game. If possible, enable #define MY_DEBUG_VERBOSE_SIGNING #define MY_DEBUG_VERBOSE_RFM69 for additional info. Also, please post the node sketch to interpret the log in the right context.
  • Question about RS485 and MY_DEBUG

    1
    0 Votes
    1 Posts
    288 Views
    No one has replied
  • Error compiling on new w10 and arduino edi 1.8.10

    2
    0 Votes
    2 Posts
    536 Views
    mfalkviddM
    @keldandorin You'll need to install the development version of MySensors, or downgrade the esp board definitions. See https://forum.mysensors.org/post/92176 for more details.
  • A water pulse meter using interrupts and the ATMEGA328P "power save" mode

    17
    0 Votes
    17 Posts
    3k Views
    EncryptE
    Thanks for the feedback @zboblamont! I was probably overthinking the whole thing :P

7

Online

12.5k

Users

11.2k

Topics

113.5k

Posts