Navigation

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

    Best posts made by mrwomble

    • Mysensorised front door (doorbell, post-box)

      I thought I'd share a recent project to mysensorise my front door by adding a doorbell sensor and postbox sensor. At the moment it just sends me a notification (via Telegram) when someone rings the front door or puts something through the postbox but I plan on getting a camera in the near future so it'll tie into that. I'm also thinking about creating a little node that will play sounds from an SD card when the doorbell is rung, so I can load it up with appropriately seasonal things like Halloween sound effects, Christmas jingles, etc.

      So here's the doorbell as it originally was - a simple, old battery-based doorbell. You can see that the contacts had got corroded over the years so it was quite a pain to clean it out every now and then + replace batteries to make it work, so I've got the added benefit of it now being AC powered.

      0_1477998843523_IMG_20161029_140635 (Small).jpg

      Here's the work in progress in the 'lab' (I use that term extremely loosely).

      0_1477998861463_IMG_20161028_151013 (Small).jpg

      I used the door/window/switch sketch and extended it for the additional postbox sensor + made it a repeater node since it's AC powered.

      Here it is all packed in.

      0_1477998876025_IMG_20161031_204057 (Small).jpg

      Power is supplied via an old Nokia charger that was repurposed.

      What was the hardest part of this little project, I hear you ask? Glueing the wiring up the wall in a neat enough way that my wife would never notice. So far, she hasn't said a thing, so I reckon I'm in the clear - it's all about the WAF with these things.

      The code and circuit are nothing to write home about, but if anyone wants them, let me know.

      Thanks once more to Hek and all the mods, hardware heros and contributors for this awesome site.

      posted in My Project
      mrwomble
      mrwomble
    • RE: 💬 Temperature Sensor

      Ah, never mind! Managed to resolve it after all. For the benefit of others who may hit the same issue: the code depends on a very particular version of the DallasTemperature library, the versions downloaded via the Arduino IDE don't work and give the errors above. I had to download the library from the examples on github here: https://github.com/mysensors/MySensorsArduinoExamples

      posted in Announcements
      mrwomble
      mrwomble
    • RE: Solar Powered Soil Moisture Sensor

      I meant to mention that the wires coming out of the bottom are the wires that go to the soil moisture probes.

      Here's the code in case anyone else would like it:

      // Updated to v2.0 of Mysensors
      
      // Enable debug prints
      #define MY_DEBUG
      #define MY_RADIO_NRF24
      
      #include <MySensors.h>
      #include <SPI.h>
      
      #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
      #define N_ELEMENTS(array) (sizeof(array)/sizeof((array)[0]))
      
      #define CHILD_ID_MOISTURE 0
      #define CHILD_ID_BATTERY 1
      #define SLEEP_TIME 10000 // Sleep time between reads (in milliseconds), was 10000
      #define THRESHOLD 1.1 // Only make a new reading with reverse polarity if the change is larger than 10%.
      #define STABILIZATION_TIME 1000 // Let the sensor stabilize before reading default BOD settings
      const int SENSOR_ANALOG_PINS[] = {A4, A5}; // Sensor is connected to these two pins. Avoid A3 if using ATSHA204. A6 and A7 cannot be used because they don't have pullups.
      
      // MySensor gw;   //removed for v2.0
      MyMessage msg(CHILD_ID_MOISTURE, V_HUM);
      MyMessage voltage_msg(CHILD_ID_BATTERY, V_VOLTAGE);
      long oldvoltage = 0;
      byte direction = 0;
      int oldMoistureLevel = -1;
      float batteryPcnt;
      float batteryVolt;
      int LED = 5;
      
      void setup()
      {
        pinMode(LED, OUTPUT);
        digitalWrite(LED, HIGH);
        delay(200);
        digitalWrite(LED, LOW);
        delay(200);
        digitalWrite(LED, HIGH);
        delay(200);
        digitalWrite(LED, LOW);
        
        //  gw.begin(); //Removed for v2.0
        for (int i = 0; i < N_ELEMENTS(SENSOR_ANALOG_PINS); i++) {
          pinMode(SENSOR_ANALOG_PINS[i], OUTPUT);
          digitalWrite(SENSOR_ANALOG_PINS[i], LOW);
        }
      }
      
      void presentation(){  //created for v2.0
        sendSketchInfo("Plant moisture w solar", "1.0");
        present(CHILD_ID_MOISTURE, S_HUM);
        delay(250);
        present(CHILD_ID_BATTERY, S_MULTIMETER);
      }
      
      
      void loop()
      {
        int moistureLevel = readMoisture();
      
        // Send rolling average of 2 samples to get rid of the "ripple" produced by different resistance in the internal pull-up resistors
        // See http://forum.mysensors.org/topic/2147/office-plant-monitoring/55 for more information
        if (oldMoistureLevel == -1) { // First reading, save current value as old
          oldMoistureLevel = moistureLevel;
        }
        if (moistureLevel > (oldMoistureLevel * THRESHOLD) || moistureLevel < (oldMoistureLevel / THRESHOLD)) {
          // The change was large, so it was probably not caused by the difference in internal pull-ups.
          // Measure again, this time with reversed polarity.
          moistureLevel = readMoisture();
        }
        send(msg.set((moistureLevel + oldMoistureLevel) / 2.0 / 10.23, 1));
        oldMoistureLevel = moistureLevel;
       
        int sensorValue = analogRead(A0);
        Serial.print("--Sensor value:");Serial.println(sensorValue);
        float voltage=sensorValue*(3.3/1023);
        Serial.print("--Voltage:");Serial.println(voltage);
        batteryPcnt = (sensorValue - 248) * 0.72;
        Serial.print("--Battery %:");Serial.println(batteryPcnt);
        batteryVolt = voltage;
        sendBatteryLevel(batteryPcnt);
        resend((voltage_msg.set(batteryVolt, 3)), 10);
        //send(voltage_msg.set(batteryVolt), 3);
      
        //flash led to indicate send
        digitalWrite(LED, HIGH);
        delay(200);
        digitalWrite(LED, LOW);
        
        sleep(SLEEP_TIME);
      }
      
      void resend(MyMessage &msg, int repeats)
      {
        int repeat = 1;
        int repeatdelay = 0;
        boolean sendOK = false;
      
        send(msg);
      /*
        while ((sendOK == false) and (repeat < repeats)) {
          if (send(msg)) {
            sendOK = true;
          } else {
            sendOK = false;
            Serial.print("Error ");
            Serial.println(repeat);
            repeatdelay += 500;
          } repeat++; delay(repeatdelay);
        }*/
      }
      
      
      int readMoisture() {
        pinMode(SENSOR_ANALOG_PINS[direction], INPUT_PULLUP); // Power on the sensor
        analogRead(SENSOR_ANALOG_PINS[direction]);// Read once to let the ADC capacitor start charging
        sleep(STABILIZATION_TIME);
        int moistureLevel = (1023 - analogRead(SENSOR_ANALOG_PINS[direction]));
      
        // Turn off the sensor to conserve battery and minimize corrosion
        pinMode(SENSOR_ANALOG_PINS[direction], OUTPUT);
        digitalWrite(SENSOR_ANALOG_PINS[direction], LOW);
      
        direction = (direction + 1) % 2; // Make direction alternate between 0 and 1 to reverse polarity which reduces corrosion
        return moistureLevel;
      }
      
      

      My thanks to flopp for the cool idea and to everyone else on the thread for the contributions.

      posted in My Project
      mrwomble
      mrwomble
    • RE: 💬 Gas Sensor

      Just a note for any Domoticz users who may try this sketch - it presents in the log, but is not available under 'Devices' to be added UNTIL it gets a reading > 0. My solution to that was to go put the node over the gas hob and let the gas run (unlit) for a few seconds so that it generated a reading 😄

      Remember kids, gas is dangerous, stay safe.

      posted in Announcements
      mrwomble
      mrwomble
    • RE: Node's becoming unreachable

      I'm too new to all of this to be able to help, unfortunately, but your diagram got me really curious - what does the BBQ node do??

      posted in Troubleshooting
      mrwomble
      mrwomble
    • RE: Solar Powered Soil Moisture Sensor

      Hi all, I was so impressed by this thread that I decided to build my own. I must have spent maybe £6 or so - I really pushed the boat out. 😃

      It's been running successfully for a few weeks now, so I thought I'd share my code and a few pics. I upgraded the original code to v2.0. I've kept the update frequency high and it's running just fine, but we'll see how it goes in winter with less sun.

      Pics!
      0_1477923890152_IMG_20161016_151754 (Small).jpg
      Here you can see the boost converter and the Arduino pro mini.

      0_1477923898665_IMG_20161016_154217 (Small).jpg
      Here you can see the finished product in its natural environment. The RF radio sits in the plastic area, as I figured the metal collar at the top (where the arduino + battery sits) would have blocked/reduced the RF transmission.

      Code to follow.

      posted in My Project
      mrwomble
      mrwomble