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
F

fred97

@fred97
About
Posts
9
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Soil Sensor analog values differ on Uno vs Pro Mini
    F fred97

    thanks you very much work great !

    Troubleshooting soil sensor uno pro mini

  • Soil Sensor analog values differ on Uno vs Pro Mini
    F fred97
    #include <SPI.h>
    #include <MySensor.h>
    
    #define ANALOG_INPUT_SOIL_SENSOR A0
    #define CHILD_ID 0 // Id of the sensor child
    
    MySensor gw;
    MyMessage msg(CHILD_ID, V_HUM);
    int lastSoilValue = -1;
    
    void setup()
    {
    gw.begin();
    
    // Send the sketch version information to the gateway and Controller
    gw.sendSketchInfo("Soil Moisture Sensor - analog", "1.0");
    // sets the soil sensor analog pin as input
    pinMode(ANALOG_INPUT_SOIL_SENSOR, INPUT);
    // Register all sensors to gw (they will be created as child devices)
    gw.present(CHILD_ID, S_HUM);
    }
    
    void loop()
    {
    // Read analog soil value
    int soilValue = analogRead(ANALOG_INPUT_SOIL_SENSOR);
    
    if (soilValue != lastSoilValue) {
    Serial.println(soilValue);
    gw.send(msg.set(map(soilValue, 100, 250, 0, 100)));
    lastSoilValue = soilValue;
    }
    // Power down the radio and arduino until analog input changes.
    gw.sleep(1000);
    }
    

    is the same sketch but i have changed only

    gw.send(msg.set(static_cast<int>(static_cast<float>(1023 - soilValue))/1023*100)); // Send the relative moisture. this will probably work only on nano or uno as I used 1023
    

    by this

    gw.send(msg.set(map(soilValue, 100, 250, 0, 100)));
    

    i don't understand why is alway inverted ??

    Troubleshooting soil sensor uno pro mini

  • Soil Sensor analog values differ on Uno vs Pro Mini
    F fred97
    gw.send(msg.set(map(soilValue, 100, 250, 0, 100)));```
    
    

    you have forget one ) at last .

    sensor started, id 2
    send: 2-2-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1
    send: 2-2-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
    read: 0-0-2 s=255,c=3,t=6,pt=0,l=1:M
    send: 2-2-0-0 s=255,c=3,t=11,pt=0,l=25,st=ok:Soil Moisture Sensor - an
    send: 2-2-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
    send: 2-2-0-0 s=0,c=0,t=7,pt=0,l=5,st=ok:1.4.1
    1023
    send: 2-2-0-0 s=0,c=1,t=1,pt=4,l=4,st=ok:615
    285
    send: 2-2-0-0 s=0,c=1,t=1,pt=4,l=4,st=ok:123
    

    250 is when is in water and 1023 is dry , it's alway inverted , i can test 2 other exemple because there is a problem in sketch maybe ;or ) when is try this

    gw.send((max(min(map(soilValue, 100,250,0,100), 100), 0)));
    

    and for other 2 exemple i can send to arduino compiling error

    sketch_may24a.ino: In function 'void loop()':
    sketch_may24a:31: error: no matching function for call to 'MySensor::send(long int)'
    C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h:142: note: candidates are: bool MySensor::send(MyMessage&, bool)
    
    Troubleshooting soil sensor uno pro mini

  • Soil Sensor analog values differ on Uno vs Pro Mini
    F fred97

    hello

    it's working but is not inverted :+1:

    314
    send: 2-2-0-0 s=0,c=1,t=1,pt=4,l=4,st=ok:30
    294
    send: 2-2-0-0 s=0,c=1,t=1,pt=4,l=4,st=ok:28
    287
    send: 2-2-0-0 s=0,c=1,t=1,pt=4,l=4,st=ok:28
    299
    send: 2-2-0-0 s=0,c=1,t=1,pt=4,l=4,st=ok:29
    313
    send: 2-2-0-0 s=0,c=1,t=1,pt=4,l=4,st=ok:30
    1023
    send: 2-2-0-0 s=0,c=1,t=1,pt=4,l=4,st=ok:100
    

    100 is when is dry and 220/250 is when the sensor is in water .
    i just need little more help for invert value , 100 = in water and 0 when is dry

    thx

    Troubleshooting soil sensor uno pro mini

  • Soil Sensor analog values differ on Uno vs Pro Mini
    F fred97

    thanks you ,

    i have try your sketch but don't work send only O

    send: 2-2-0-0 s=0,c=1,t=1,pt=2,l=2,st=ok:0
    444
    send: 2-2-0-0 s=0,c=1,t=1,pt=2,l=2,st=ok:0
    470
    send: 2-2-0-0 s=0,c=1,t=1,pt=2,l=2,st=ok:0
    1023
    send: 2-2-0-0 s=0,c=1,t=1,pt=2,l=2,st=ok:0
    

    i think the problem is inside converter in percentage ....

    240 when is in water and 1023 when completly dry .

    Troubleshooting soil sensor uno pro mini

  • Soil Sensor analog values differ on Uno vs Pro Mini
    F fred97

    @Moshe-Livne said:

    Managed to make it a humidity sensor, which is probably close enough. Here is my sketch:
    #include <SPI.h>
    #include <MySensor.h>

    #define ANALOG_INPUT_SOIL_SENSOR A0
    #define CHILD_ID 0 // Id of the sensor child

    MySensor gw;
    MyMessage msg(CHILD_ID, V_HUM);
    int lastSoilValue = -1;

    void setup()
    {
    gw.begin();

    // Send the sketch version information to the gateway and Controller
    gw.sendSketchInfo("Soil Moisture Sensor - analog", "1.0");
    // sets the soil sensor analog pin as input
    pinMode(ANALOG_INPUT_SOIL_SENSOR, INPUT);
    // Register all sensors to gw (they will be created as child devices)
    gw.present(CHILD_ID, S_HUM);
    }

    void loop()
    {
    // Read analog soil value
    int soilValue = analogRead(ANALOG_INPUT_SOIL_SENSOR);

    if (soilValue != lastSoilValue) {
    Serial.println(soilValue);
    gw.send(msg.set(static_cast<int>(static_cast<float>(1023 - soilValue))/1023*100)); // Send the relative moisture. this will probably work only on nano or uno as I used 1023
    lastSoilValue = soilValue;
    }
    // Power down the radio and arduino until analog input changes.
    gw.sleep(1000);
    }

    hello ,

    i want to do same , but can you explaind the calcul is made ?

    for now i use light sensor sketch with analog input , but i ant to modify by /10 for having a moisture meter reading value 0to100% or maybe there is a S_Percentage come in next version of mysensors ?

    i use domotiz with gateway and for now only Light sensor work for read analog value .

    thanks

    Troubleshooting soil sensor uno pro mini

  • multiple distance sensor ?
    F fred97

    thanks you for help , i will try and if is work i will share the code , is not very difficult but for me it is , is use a unix command since 2 week hahahah

    Hardware

  • multiple distance sensor ?
    F fred97

    hello everybody ,

    i wan to plug 4 sensor level , is for water level of rain water tank .

    i have found this code for distance sensor :+1:

    
    #include <SPI.h>
    #include <MySensor.h>
    #include <NewPing.h>
     
    #define CHILD_ID 1
    #define TRIGGER_PIN  6  // Arduino pin tied to trigger pin on the ultrasonic sensor.
    #define ECHO_PIN     5  // Arduino pin tied to echo pin on the ultrasonic sensor.
    #define MAX_DISTANCE 300 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
    unsigned long SLEEP_TIME = 5000; // Sleep time between reads (in milliseconds)
     
    MySensor gw;
    NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
    MyMessage msg(CHILD_ID, V_DISTANCE);
    int lastDist;
    boolean metric = true; 
     
    void setup()
    {
      gw.begin();
     
      gw.sendSketchInfo("Distance Sensor", "1.0");
     
      gw.present(CHILD_ID, S_DISTANCE);
      boolean metric = gw.getConfig().isMetric;
    }
     
    void loop()
    {
      int dist = metric?sonar.ping_cm():sonar.ping_in();
     
      if (dist != lastDist) {
          gw.send(msg.set(dist));
          lastDist = dist;
      }
     
      gw.sleep(SLEEP_TIME);
    
    

    So for 4 sensor i need to definite more like this

    #define CHILD_ID1 1
    #define TRIGGER_PIN1 6
    #define ECHO_PIN1 8
    #define MAX_DISTANCE1 300

    #define CHILD_ID2 2
    #define TRIGGER_PIN2 5
    #define ECHO_PIN2 9
    #define MAX_DISTANCE2 300

    and i need change this gw.present(CHILD_ID, S_DISTANCE); by gw.present(CHILD_ID, S_DISTANCE1, S_DISTANCE2, XXXX);

    so i need change other thing inside ?

    thanks you

    Hardware

  • Solid State Relay ?
    F fred97

    hello everybody ,

    i have domoticz interfaced with mysensors , i'm very happy but i need to use SSR like thiss : http://www.dx.com/fr/p/ssr-25da-25a-solid-state-relay-white-134494#.VTuG0iHtmko .

    but i have no signal , juste to power with 3,3v the side DC of m ssr ...

    thanks in advance .

    Hardware
  • Login

  • Don't have an account? Register

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