Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. punter9
    3. Topics
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Topics created by punter9

    • punter9

      Monitor if an outlet has power - send email
      General Discussion • • punter9  

      10
      0
      Votes
      10
      Posts
      3988
      Views

      ThomasDr

      Hello, Measure A socket directly is always a risk. just take a power adapter, power the Mysensors Note and send a Life Bit to your Application. Is the Outlet power down the Note send no Life Bit and your Application can send a E-Mail. regards Thomas
    • punter9

      "Error sending switch command, check device/hardware !"
      Troubleshooting • • punter9  

      3
      0
      Votes
      3
      Posts
      1180
      Views

      punter9

      Adding a capacitor to the radio is what I needed to do! Made all the difference in the world!
    • punter9

      This should be a simple one! Water level test (not on constantly)
      Troubleshooting • • punter9  

      5
      0
      Votes
      5
      Posts
      1336
      Views

      punter9

      @mfalkvidd said: thanks! That makes a ton of sense. These forums are awesome, I really appreciate everybody
    • punter9

      Question about code and electrolysis
      Troubleshooting • • punter9  

      7
      0
      Votes
      7
      Posts
      1844
      Views

      punter9

      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); } }
    • punter9

      relay with delay feature
      Troubleshooting • • punter9  

      5
      0
      Votes
      5
      Posts
      1292
      Views

      martinhjelmare

      @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.
    • punter9

      Multiple Binary Switch Help
      Troubleshooting • • punter9  

      3
      0
      Votes
      3
      Posts
      1730
      Views

      TheoL

      @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; } }
    • punter9

      Arduino Nano power related issue
      Hardware • • punter9  

      8
      0
      Votes
      8
      Posts
      2510
      Views

      Sparkman

      @punter9 Given it's a 5 volt module, powering it with 9V is not a good idea. The specs on the Songle relay indicate that it draws about 90mA. The official Nano has a 500mA 5V regulator so if you don't have too much else connected, that should be fine. If you are using a Nano clone, then take a look at the specs for the regulator it uses. Cheers Al
    • punter9

      Water level code
      Development • • punter9  

      6
      0
      Votes
      6
      Posts
      2651
      Views

      punter9

      I am using straight bolts. I am still working through issues however combining multiple binary switches (bolts), 2 moisture sensors, and a relay.
    • punter9

      Relay and Repeater - Just learning stuff
      General Discussion • • punter9  

      4
      0
      Votes
      4
      Posts
      4095
      Views

      jl277013

      Do I need to link/pair the repeater node to the gateway or does it just work when I power it up?
    • punter9

      Combining DHT and Relay issues
      Troubleshooting • • punter9  

      4
      0
      Votes
      4
      Posts
      1948
      Views

      BulldogLowell

      @punter9 Your problem looks a lot like this person's issue.
    • punter9

      Help with combination DHT and Relay
      Troubleshooting • • punter9  

      10
      0
      Votes
      10
      Posts
      4251
      Views

      BulldogLowell

      @punter9 said: hanks for checking in @TheoL . My intent for this sketch was to learn how to combine sketches and make a useful project. Got that done and working! It would be cool if there was an easy way to help newbies like myself out doing this. I can tell you without this awesome forum I would have not figured out some pretty basic stuff! Thanks for all the help, this is an awesome site what does the serial monitor show when you click the button in Domoticz?
    • punter9

      Serial Gateway to Node (gas sensor) communication
      Troubleshooting • • punter9  

      1
      0
      Votes
      1
      Posts
      745
      Views

      No one has replied