Skip to content

Troubleshooting

Help! Everything just falls apart
2.7k Topics 21.5k Posts
  • Not able to get radio working on mega2560

    3
    0 Votes
    3 Posts
    1k Views
    bpairB
    thanks. it is working now.
  • Question about code and electrolysis

    7
    0 Votes
    7 Posts
    2k Views
    P
    Ok, I decided for my needs all I really need to do is be able to turn power on and off so I have written code to utilize the digital pins as a power source, and continue with the analog read. This should extend the life of my sensors since I only need to get a reading about 4 times a day. Would anyone mind looking over this code and make sure it is actually limiting electrolysis as I intend? I am still learning here. Thanks for all the help so far! The way I have it set up at the moment is to have the power(vcc) come from the digital pin and then tie the ground to the common ground so as to not tie up more digital pins. Will this work as intended or do I need to also have a dedicated digital pin written low for each sensor? #include <SPI.h> #include <MySensor.h> #define ANALOG_INPUT_SOIL_SENSOR1 A0 #define CHILD_ID1 0 // Id of the sensor child #define ANALOG_INPUT_SOIL_SENSOR2 A1 #define CHILD_ID2 1 // Id of the sensor child long previousMillis = 0; long interval = (10000); //delay betweein readings - 1000 is 1 second MySensor gw; MyMessage msg1(CHILD_ID1, V_HUM),msg2(CHILD_ID2, V_HUM); int soilPower1 = 1; //digital pin to get power from int soilPower2 = 2; //digital pin to get power from void setup() { gw.begin(); gw.sendSketchInfo("Soil Moisture Sensor - analog", "1.0"); // Send the sketch version information to the gateway and Controller pinMode(ANALOG_INPUT_SOIL_SENSOR1, INPUT);// sets the soil sensor analog pin as input pinMode(ANALOG_INPUT_SOIL_SENSOR2, INPUT); gw.present(CHILD_ID1, S_HUM);// Register all sensors to gw (they will be created as child devices) gw.present(CHILD_ID2, S_HUM); pinMode(soilPower1,OUTPUT); pinMode(soilPower2,OUTPUT); } void loop() { unsigned long currentMillis = millis(); digitalWrite(soilPower1,LOW); digitalWrite(soilPower2,LOW); if (currentMillis - previousMillis + 500 > interval) { digitalWrite(soilPower1,HIGH); digitalWrite(soilPower2,HIGH); } if (currentMillis - previousMillis > interval) { int soilValue1 = analogRead(ANALOG_INPUT_SOIL_SENSOR1);// Read analog soil value int soilValue2 = analogRead(ANALOG_INPUT_SOIL_SENSOR2); previousMillis = currentMillis; Serial.println(soilValue1); Serial.println(soilValue2); gw.send(msg1.set(constrain(map(soilValue1, 1023, 250, 0, 100), 0, 100))); gw.send(msg2.set(constrain(map(soilValue2, 1023, 250, 0, 100), 0, 100))); digitalWrite(soilPower1,LOW); digitalWrite(soilPower2,LOW); } }
  • I have some questions , thank you for help me <3

    7
    0 Votes
    7 Posts
    2k Views
    R
    @AWI said: Sorry I don't know what you built.... ok thank you my friend <3
  • problem in my motion sensor

    6
    0 Votes
    6 Posts
    2k Views
    hekH
    Need to see the debug output to be able to say what is wrong.
  • First project, eth gw with codebender

    2
    0 Votes
    2 Posts
    811 Views
    B
    It was a library version problem, now fixed. Anyway I'm stuck with the gateway, for power issue, I think. Mooving to another thread ... Luca
  • Humidity, temperature, motion and bunch of relays...

    12
    0 Votes
    12 Posts
    5k Views
    petoulachiP
    I found where was the problem, I'm really a newbee... The motion sensor was plugged to the 3.3VCC, not 5V, doing this strange behaviour !
  • RFID 2 person readout

    mfrc522
    3
    0 Votes
    3 Posts
    2k Views
    DannyMD
    @BartE I think I have enough code for what I want, it is in the void storeEprom() void recallEeprom() functions. So I am gonna try to implement this into my code. Thanks so far..
  • Pulse power meter flooding gateway

    9
    0 Votes
    9 Posts
    2k Views
    YveauxY
    @Cliff-Karlsson said: I am using the same sensor as in the build example, the biggest sensor. And by 'biggest sensor' you mean the 'LM393 Light Sensor' ? I use a comparable sensor (same pcb) with a LDR and had to debounce its readings or multiple pulses were detected on each blink. Anyway, from the sketch I see sensor values should only be sent every 30 seconds, so that can't cause you gateway-spamming issue. The sketch will try to receive the old absolute counter value on startup, so it can continue counting where it left off: // Fetch last known pulse count value from gw gw.request(CHILD_ID, V_VAR1); IKf it doesn't get an answer, it will retry forever: } else if (sendTime && !pcReceived) { // No count received. Try requesting it again gw.request(CHILD_ID, V_VAR1); lastSend=now; } Could it be that that mechanism is bugging you? You could also connect to the sensor's serial port an see what it has to tell you.
  • Sensebender Micro not work

    2
    0 Votes
    2 Posts
    862 Views
    M
    things to check / do verify radio is good verify radio is connected correctly if header soldered in, verify nothing is touching / solder work is clean/good upgrade to arduino 1.6.5 verify mysensors is library v1.5 if you set up a gateway recently, verify you turned softspi back off and didn't leave it on. your issue likely lies in one of those areas.
  • relay with delay feature

    5
    0 Votes
    5 Posts
    1k Views
    martinhjelmareM
    @punter9 I would implement some way of knowing time passed. Either by sleeping or waiting for a set time. Then each time the loop runs after wake-up, or similar, increment a counter. Define a variable setting the number the counter should have reached when you want to read the sensors. Then implement a function per sensor or sensor type. Call the functions in a conditional statement, checking the counter, in the main loop. Check the sensebender micro sketch for example of a counter. That sketch sleeps the sensebender for 1 min in the end of each loop, default settting, so that way you know that at least 1 min has passed for each loop run. Each loop run it increments the counter, so +1 for the counter means +1 min, more or less. edit @TheoL beat me to it, with code example, even. =)
  • Transmit problem

    4
    0 Votes
    4 Posts
    1k Views
    F
    Works fine with channel 120. No more lost packets.
  • Multiple Binary Switch Help

    3
    0 Votes
    3 Posts
    2k Views
    TheoLT
    @punter9 You have to create a Debouncer for each switch. A debouncer will only debounce the assigned switch. Besides you have to check each switch separately. I adjusted your Sketch. It compiles but I haven't tested it. All of my breadboards are full with test circuits at the moment. Give this a try #include <MySensor.h> #include <SPI.h> #include <Bounce2.h> #define CHILD_ID1 3 #define BUTTON_PIN1 3 // Arduino Digital I/O pin for button/reed switch #define CHILD_ID2 4 #define BUTTON_PIN2 4 // Arduino Digital I/O pin for button/reed switch #define CHILD_ID3 5 #define BUTTON_PIN3 5 // Arduino Digital I/O pin for button/reed switch MySensor gw; Bounce debouncer1 = Bounce(); Bounce debouncer2 = Bounce(); // debouncer for the second switch Bounce debouncer3 = Bounce(); // debouncer for the third switch int oldValue1=-1; int oldValue2=-1; // second switch needs to have it's own old state int oldValue3=-1; // second switch needs to have it's own old state // Change to V_LIGHT if you use S_LIGHT in presentation below MyMessage msg1(CHILD_ID1,V_TRIPPED), msg2(CHILD_ID2,V_TRIPPED),msg3(CHILD_ID3,V_TRIPPED); void setup() { gw.begin(); // Setup the button pinMode(BUTTON_PIN1,INPUT_PULLUP ); // You can assign pinmode and use pullup in one statement. pinMode(BUTTON_PIN2,INPUT_PULLUP); pinMode(BUTTON_PIN3,INPUT_PULLUP); // Activate internal pull-up // digitalWrite(BUTTON_PIN1,HIGH); // digitalWrite(BUTTON_PIN2,HIGH); // digitalWrite(BUTTON_PIN3,HIGH); // After setting up the button, setup debouncer1 debouncer1.attach(BUTTON_PIN1); debouncer1.interval(5); debouncer2.attach(BUTTON_PIN2); debouncer2.interval(5); debouncer3.attach(BUTTON_PIN3); debouncer3.interval(5); // Register binary input sensor to gw (they will be created as child devices) // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. // If S_LIGHT is used, remember to update variable type you send in. See "msg" above. gw.present(CHILD_ID1, S_DOOR); gw.present(CHILD_ID2, S_DOOR); gw.present(CHILD_ID3, S_DOOR); } // Check if digital input has changed and send in new value void loop() { // Check if the first switch state has changed debouncer1.update(); // Get the update value int value = debouncer1.read(); if (value != oldValue1) { // Send in the new value gw.send(msg1.set(value==HIGH ? 1 : 0)); // gw.send(msg2.set(value==HIGH ? 1 : 0)); // this is where you turn the second switch in your controller // gw.send(msg3.set(value==HIGH ? 1 : 0)); // this is where you turn the third switch in your controller oldValue1 = value; } // Check if the 2nd switch state has changed debouncer2.update(); // Get the update value value = debouncer2.read(); // no need to redeclare it (I removed int) if (value != oldValue2) { // Send in the new value // gw.send(msg1.set(value==HIGH ? 1 : 0)); gw.send(msg2.set(value==HIGH ? 1 : 0)); // this is where you turn the second switch in your controller // gw.send(msg3.set(value==HIGH ? 1 : 0)); // this is where you turn the third switch in your controller oldValue2 = value; } // Check if the third switch state has changed debouncer3.update(); // Get the update value value = debouncer3.read(); // no need to redeclare it (I removed int) if (value != oldValue3) { // Send in the new value // gw.send(msg1.set(value==HIGH ? 1 : 0)); // gw.send(msg2.set(value==HIGH ? 1 : 0)); // this is where you turn the second switch in your controller gw.send(msg3.set(value==HIGH ? 1 : 0)); // this is where you turn the third switch in your controller oldValue3 = value; } }
  • 0 Votes
    5 Posts
    3k Views
    TheoLT
    Not sure if it helps. I had it once, when I had a bad cable connection between one of the pins of the radio and the gateway, MOSI or MISO I forgot. That way Domoticz tried to communicate, but the messages couldn't be delivered to the nodes. Might be helpful to connect a serial monitor to one of your nodes?
  • Push V_VAR from Vera controller to sensor?

    2
    0 Votes
    2 Posts
    1k Views
    hekH
    You can push data using a scene or via lua... luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="1;2", variableId="VAR_1", value="Hello"}, 372) 1 - node id 2 - sensor id 372 is your arduino device id
  • Sleep() doesn't "power down" the controller

    3
    0 Votes
    3 Posts
    2k Views
    AWIA
    @RoBra81 When (one of) your contacts is closed there will be a current flowing through the (internal) pull-up's of the Arduino. This is around 0.25 mA per active switch! depending on the type of Arduino and supply voltage. AVR has 20k-50k pull-up resistors.
  • 0 Votes
    4 Posts
    2k Views
    klimK
    Hi, i've the same problem with a toggling Inclusion signal in my SerialGateway and mySensors version 1.4.2. I understand that a missing pullup resistor on Pin3 and a none activated internal Pullup is the root cause of this problem. I solved it by modifing the MyGateway.cpp like this: // Setup digital in that triggers inclusion mode if (pinInclusion >= 0) { pinMode(pinInclusion, INPUT_PULLUP); // Add interrupt for inclusion button to pin PCintPort::attachInterrupt(pinInclusion, startInclusionInterrupt, FALLING); } Does this mean this there is an error in 1.4.2?
  • AttachInterrupt and receiving messages problem

    7
    0 Votes
    7 Posts
    4k Views
    BobCB
    Hello again I've attached a version which show/demonstrates the problem I have when using Timer1.attachInterrupt(dim_check, freqStep);. I'm using a Veralite and simple pro mini arduino to controll 2x SSR and 2x Triac dimmers. I use a structured array to hole the various valus for the lamps. When I upload a version of this attached code with Timer1.attachInterrupt(dim_check, freqStep);commented out - the SSR's work fine. When I uncomment the one line in the code the is no response to the Vera's command to switch on a SSR lamp. As you can see the interrupt routine is extremely short - nothing but the call. I wonder if someone else might have any idea or have run into this problem before.. The interrupt is to occur every 75uS so as to allow 128 steps of dimming.Timer1Testing.ino
  • Read log from serial Gateway on raspberry Pi.

    9
    0 Votes
    9 Posts
    8k Views
    P
    TheoL: the screenshot you posted. Is that screen updating every time you receive something?
  • Connecting a sensor to pc with usb

    3
    0 Votes
    3 Posts
    1k Views
    B
    I'll try it, thx! luca
  • Openhab - How to respond to Arduino request?

    14
    0 Votes
    14 Posts
    6k Views
    Daniel LindbergD
    I did, but after a simulated "power outage" item.state would simply return 0, so my sensor would reset and start accumulating KWH from 0 again. I updated use rrd4j rather than my.openhab and used pulseCountItem.previousState(false, "rrd4j").state // get the most recent update, even if it is the same as the current state It's now working :-)

10

Online

11.7k

Users

11.2k

Topics

113.1k

Posts