Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
Dennis van der WolfD

Dennis van der Wolf

@Dennis van der Wolf
About
Posts
5
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Office plant monitoring
    Dennis van der WolfD Dennis van der Wolf

    @Jan-Gatzke I have connected the fork to A0 and A1 of mine arduino nano. Now i have this result:

    10.02.2017 12:17:35	Multi Sensor (multi2)	SoilMoistPercentageSensor	-182 %
    10.02.2017 12:12:04	Multi Sensor (multi2)	SoilMoistPercentageSensor	-455 %
    10.02.2017 12:06:33	Multi Sensor (multi2)	SoilMoistPercentageSensor	-317 %
    10.02.2017 12:01:02	Multi Sensor (multi2)	SoilMoistPercentageSensor	255 %
    10.02.2017 11:55:31	Multi Sensor (multi2)	SoilMoistPercentageSensor	-547 %
    10.02.2017 11:49:26	Multi Sensor (multi2)	SoilMoistPercentageSensor	1169 %
    10.02.2017 11:43:55	Multi Sensor (multi2)	SoilMoistPercentageSensor	40 %
    10.02.2017 11:38:24	Multi Sensor (multi2)	SoilMoistPercentageSensor	-250 %
    

    This is the sketch i use:

    /*
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * DESCRIPTION
     *
     * Arduino soil moisture based on gypsum sensor/resistive sensor to avoid electric catalyse in soil
     *  Required to interface the sensor: 2 * 4.7kOhm + 2 * 1N4148
     *
     * Gypsum sensor and calibration:
     *    DIY: See http://vanderleevineyard.com/1/category/vinduino/1.html
     *    Built: Davis / Watermark 200SS
     *        http://www.cooking-hacks.com/watermark-soil-moisture-sensor?_bksrc=item2item&_bkloc=product
     *        http://www.irrometer.com/pdf/supportmaterial/sensors/voltage-WM-chart.pdf
     *        cb (centibar) http://www.irrometer.com/basics.html
     *            0-10 Saturated Soil. Occurs for a day or two after irrigation
     *            10-20 Soil is adequately wet (except coarse sands which are drying out at this range)
     *            30-60 Usual range to irrigate or water (except heavy clay soils).
     *            60-100 Usual range to irrigate heavy clay soils
     *            100-200 Soil is becoming dangerously dry for maximum production. Proceed with caution.
     *
     * Connection:
     *  D6, D7: alternative powering to avoid sensor degradation
     * A0, A1: alternative resistance mesuring
     *
     *  Based on:
     *  "Vinduino" portable soil moisture sensor code V3.00
     *   Date December 31, 2012
     *   Reinier van der Lee and Theodore Kaskalis
     *   www.vanderleevineyard.com
     * Contributor: epierre
     */
    
    // Copyright (C) 2015, Reinier van der Lee
    // www.vanderleevineyard.com
    
    // This program is free software: you can redistribute it and/or modify
    // it under the terms of the GNU General Public License as published by
    // the Free Software Foundation, either version 3 of the License, or
    // any later version.
    
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    #include <math.h>       // Conversion equation from resistance to %
    #include <MySensors.h>
    
    // Setting up format for reading 3 soil sensors
    #define NUM_READS 10    // Number of sensor reads for filtering
    #define CHILD_ID 0
    
    MyMessage msg(CHILD_ID, V_LEVEL);
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    
    long buffer[NUM_READS];
    int index;
    
    /// @brief Structure to be used in percentage and resistance values matrix to be filtered (have to be in pairs)
    typedef struct {
        int moisture; //!< Moisture
        long resistance; //!< Resistance
    } values;
    
    const long knownResistor = 4700;  // Constant value of known resistor in Ohms
    
    int supplyVoltage;                // Measured supply voltage
    int sensorVoltage;                // Measured sensor voltage
    
    values valueOf[NUM_READS];        // Calculated moisture percentages and resistances to be sorted and filtered
    
    int i;                            // Simple index variable
    
    void setup()
    {
        // initialize the digital pins as an output.
        // Pin 6,7 is for sensor 1
        // initialize the digital pin as an output.
        // Pin 6 is sense resistor voltage supply 1
        pinMode(6, OUTPUT);
    
        // initialize the digital pin as an output.
        // Pin 7 is sense resistor voltage supply 2
        pinMode(7, OUTPUT);
    }
    
    void presentation()
    {
        sendSketchInfo("Soil Moisture Sensor Reverse Polarity", "1.0");
        present(CHILD_ID, S_MOISTURE);
    }
    
    void loop()
    {
    
        measure(6,7,1);
        Serial.print ("\t");
        Serial.println (average());
        long read1 = average();
    
        measure(7,6,0);
        Serial.print ("\t");
        Serial.println (average());
        long read2= average();
    
        long sensor1 = (read1 + read2)/2;
    
        Serial.print ("resistance bias =" );
        Serial.println (read1-read2);
        Serial.print ("sensor bias compensated value = ");
        Serial.println (sensor1);
        Serial.println ();
    
        //send back the values
        send(msg.set((long int)ceil(sensor1)));
        // delay until next measurement (msec)
        sleep(SLEEP_TIME);
    }
    
    void measure (int phase_b, int phase_a, int analog_input)
    {
        // read sensor, filter, and calculate resistance value
        // Noise filter: median filter
    
        for (i=0; i<NUM_READS; i++) {
    
            // Read 1 pair of voltage values
            digitalWrite(phase_a, HIGH);                 // set the voltage supply on
            delayMicroseconds(25);
            supplyVoltage = analogRead(analog_input);   // read the supply voltage
            delayMicroseconds(25);
            digitalWrite(phase_a, LOW);                  // set the voltage supply off
            delay(1);
    
            digitalWrite(phase_b, HIGH);                 // set the voltage supply on
            delayMicroseconds(25);
            sensorVoltage = analogRead(analog_input);   // read the sensor voltage
            delayMicroseconds(25);
            digitalWrite(phase_b, LOW);                  // set the voltage supply off
    
            // Calculate resistance
            // the 0.5 add-term is used to round to the nearest integer
            // Tip: no need to transform 0-1023 voltage value to 0-5 range, due to following fraction
            long resistance = (knownResistor * (supplyVoltage - sensorVoltage ) / sensorVoltage) ;
    
            delay(1);
            addReading(resistance);
            Serial.print (resistance);
            Serial.print ("\t");
        }
    }
    
    
    
    // Averaging algorithm
    void addReading(long resistance)
    {
        buffer[index] = resistance;
        index++;
        if (index >= NUM_READS) {
            index = 0;
        }
    }
    
    long average()
    {
        long sum = 0;
        for (int i = 0; i < NUM_READS; i++) {
            sum += buffer[i];
        }
        return (long)(sum / NUM_READS);
    }
    
    My Project

  • Office plant monitoring
    Dennis van der WolfD Dennis van der Wolf

    Re: Office plant monitoring
    Hello, i have build the sensor from the building page. I directly connect the fork to pin D6,D7. When i show the measurement i see strange values. anyone an idea what i did wrong?

    09.02.2017 19:22:23	Multi Sensor (multi2)	SoilMoistPercentageSensor	3 %
    09.02.2017 19:16:51	Multi Sensor (multi2)	SoilMoistPercentageSensor	0 %
    09.02.2017 19:11:20	Multi Sensor (multi2)	SoilMoistPercentageSensor	3 %
    09.02.2017 19:05:48	Multi Sensor (multi2)	SoilMoistPercentageSensor	5 %
    09.02.2017 19:00:17	Multi Sensor (multi2)	SoilMoistPercentageSensor	-1 %
    09.02.2017 18:54:46	Multi Sensor (multi2)	SoilMoistPercentageSensor	8 %
    09.02.2017 18:48:41	Multi Sensor (multi2)	SoilMoistPercentageSensor	5 %
    09.02.2017 18:43:10	Multi Sensor (multi2)	SoilMoistPercentageSensor	6 %
    09.02.2017 18:37:38	Multi Sensor (multi2)	SoilMoistPercentageSensor	1 %
    09.02.2017 18:32:07	Multi Sensor (multi2)	SoilMoistPercentageSensor	-1 %
    09.02.2017 18:26:36	Multi Sensor (multi2)	SoilMoistPercentageSensor	-1 %
    09.02.2017 18:21:04	Multi Sensor (multi2)	SoilMoistPercentageSensor	4 %
    09.02.2017 18:15:33	Multi Sensor (multi2)	SoilMoistPercentageSensor	4 %
    09.02.2017 18:10:02	Multi Sensor (multi2)	SoilMoistPercentageSensor	6 %
    09.02.2017 18:03:57	Multi Sensor (multi2)	SoilMoistPercentageSensor	6 %
    09.02.2017 17:58:26	Multi Sensor (multi2)	SoilMoistPercentageSensor	0 %
    09.02.2017 17:52:54	Multi Sensor (multi2)	SoilMoistPercentageSensor	6 %
    09.02.2017 17:46:50	Multi Sensor (multi2)	SoilMoistPercentageSensor	5 %
    09.02.2017 17:41:19	Multi Sensor (multi2)	SoilMoistPercentageSensor	-1 %
    09.02.2017 17:34:41	Multi Sensor (multi2)	SoilMoistPercentageSensor	6 %
    09.02.2017 17:29:10	Multi Sensor (multi2)	SoilMoistPercentageSensor	-3 %
    09.02.2017 17:23:39	Multi Sensor (multi2)	SoilMoistPercentageSensor	-11 %
    
    My Project

  • 💬 Light Level Sensor - BH1750
    Dennis van der WolfD Dennis van der Wolf

    @checkup Hi, i have done that a few times now. Unfortunately, with the same result.

    Announcements

  • 💬 Light Level Sensor - BH1750
    Dennis van der WolfD Dennis van der Wolf

    Hi,

    I have connected my BH1750 to an Arduino nano as indicated above. After that i uploaded the sketch. I defined a node id 16 and child id 1. Nothing is happend. When i read the log it's says child id 255
    debug [pimatic-mysensors]: <- I_LOG_MESSAGE 0;255;3;0;9;TSP:MSG:BC
    19:55:26debug [pimatic-mysensors]: <- I_LOG_MESSAGE 0;255;3;0;9;TSP:MSG:READ 16-16-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    19:55:25debug [pimatic-mysensors]: <- I_LOG_MESSAGE 0;255;3;0;9;!TSP:MSG:SEND 0-0-16-16 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
    19:55:24debug [pimatic-mysensors]: <- I_LOG_MESSAGE 0;255;3;0;9;TSP:MSG:GWL OK
    19:55:24debug [pimatic-mysensors]: <- I_LOG_MESSAGE 0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
    19:55:24debug [pimatic-mysensors]: <- I_LOG_MESSAGE 0;255;3;0;9;TSP:MSG:FPAR REQ (sender=16)

    I don't know what i did wrong. Anyone an idea?

    Announcements
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular