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
epierreE

epierre

@epierre
Hero Member
About
Posts
589
Topics
29
Shares
0
Groups
1
Followers
9
Following
3

Posts

Recent Best Controversial

  • New sketches: UV, WaterMeter for Reed sensors, Air quality ...
    epierreE epierre

    Hello,

    Lost posts, but the sketches are still here:

    https://github.com/empierre/arduino

    • MQ135.ino : for CO2/COV ... validated
    • MQ2.ino : for ethanol... still ongoing...
    • PressureSensor.ino : validated, works well, too much temp reading given back
    • SoundSensor2.ino: not yet tested
    • UVsensor.ino : validated
    • WaterMeterPulseSensor2.ino : for use with water meter that have a reed switch, validated

    Next steps:

    • validate sound sensor
    • validate mq2 sensor (I dont smoke...hart to trigger...)
    • MQ6 sensor
    • MQ131 sensor
    • TGS2600 sensor
    Development

  • MySensors 1.5 Released
    epierreE epierre

    @hek I have them all already:

    Water leak,Moisture : my leaf wetness
    Sound: I have stopped by waiting to have a real decibel algorithm... but I need FFT for that...
    Vibration: done it too ;-) help yourself !

    https://github.com/empierre/arduino/blob/master/FloodSensor.ino
    https://github.com/empierre/arduino/blob/master/LeafWetnessSensor.ino
    https://github.com/empierre/arduino/blob/master/SoundSensor2.ino
    https://github.com/empierre/arduino/blob/master/VibrationSensor.ino

    Announcements

  • Water meter : grey scale sensor
    epierreE epierre

    Hello,

    A friend of mine has a Sensus Residia Jet water meter, which can work through Z-wave with a "Secure SWM301 Water Meter Sensor".

    Only one domotic box support it but not the other at this time, so I tried to make it work with mysensors..

    I have found a way based on "DFRobot Analog Grayscale Sensor V2" that works !

    The sensor: http://www.dfrobot.com/index.php?route=product/product&product_id=81

    Simply scotch the sensor on the counter so that it detects the wheel (no magnet or visual signal on this counter... the zwave sensors uses VLF induction with two tors).

    IMG_20150630_172731.jpg

    /*
     Use this sensor to measure volume and flow of your house watermeter.
     You need to set the correct pulsefactor of your meter (pulses per m3).
     The sensor starts by fetching current volume reading from gateway (VAR 1).
     Reports both volume and flow back to gateway.
    
     Sensor on pin analog 0
     
     DFRobot Analog Grayscale Sensor V2
     Watermeter sensus Residia Jet
     
     http://www.dfrobot.com/index.php?route=product/product&product_id=81
    
    Contribution: Hek, adapted by epierre to greyscale sensor water meter
      License: Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0)
    
    
    */
    
    #include <MySensor.h>  
    #include <SPI.h>
    
    #define ANALOG_INPUT_SENSOR 0                   // The analog input you attached your sensor. 
    #define PULSE_FACTOR 1000                       // Nummber of blinks per m3 of your meter (One rotation/liter)
    #define SLEEP_MODE false                        // flowvalue can only be reported when sleep mode is false.
    #define MAX_FLOW 40                             // Max flow (l/min) value to report. This filetrs outliers.
    #define INTERRUPT DIGITAL_INPUT_SENSOR-2        // Usually the interrupt = pin -2 (on uno/nano anyway)
    #define CHILD_ID 5                              // Id of the sensor child
    unsigned long SEND_FREQUENCY = 20000;           // Minimum time between send (in seconds). We don't want to spam the gateway.
    
    MySensor gw;
    MyMessage flowMsg(CHILD_ID,V_FLOW);
    MyMessage volumeMsg(CHILD_ID,V_VOLUME);
    MyMessage pcMsg(CHILD_ID,V_VAR1);
     
    double ppl = ((double)PULSE_FACTOR)/1000;        // Pulses per liter
    
    volatile unsigned long pulseCount = 0;   
    volatile unsigned long lastBlink = 0;
    volatile double flow = 0;   
    boolean pcReceived = false;
    unsigned long oldPulseCount = 0;
    unsigned long newBlink = 0;   
    double oldflow = 0;
    double volume;                     
    double oldvolume;
    unsigned long lastSend;
    unsigned long lastPulse;
    unsigned long currentTime;
    boolean metric;
    long lastDebounce = 0;
    long debounceDelay = 500;    // Ignore bounces under 1/2 second
    int oldval =0;
    int val=0;
    
    
    void setup()  
    {  
      gw.begin(incomingMessage); 
      
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Water Meter", "1.0 greyscale");
    
      // Register this device as Waterflow sensor
      gw.present(CHILD_ID, S_WATER);       
    
      // Fetch last known pulse count value from gw
       gw.request(CHILD_ID, V_VAR1);
    
      //Serial.print("Last pulse count from gw:");
      //Serial.println(pulseCount);
      //  attachInterrupt(INTERRUPT, onPulse, RISING);
      lastSend = millis();
      
      //led blinking
      pinMode(13, OUTPUT);
    }
    
    
    void loop()     
    { 
      gw.process();
      currentTime = millis();
    
      val=analogRead(0);
      //Serial.println(val);
      if ((oldval <100) and (val >100)) {
        pulseCount++;
        oldval=val;
      } else {
            oldval=val;
      }
      delay(100);	
        // Only send values at a maximum frequency or woken up from sleep
      bool sendTime = currentTime - lastSend > SEND_FREQUENCY;
      
        // Pulse count has changed
        if (pulseCount != oldPulseCount) {
          gw.send(pcMsg.set(pulseCount));                  // Send  volumevalue to gw VAR1
          double volume = ((double)pulseCount/((double)PULSE_FACTOR));     
          oldPulseCount = pulseCount;
          if (volume != oldvolume) {
            gw.send(volumeMsg.set(volume, 3));               // Send volume value to gw
            //Serial.print("V=");
            //Serial.println(volume);
            oldvolume = volume;
          } 
        }
        lastSend = currentTime;
        if (sendTime && !pcReceived) {
        // No count received. Try requesting it again
        gw.request(CHILD_ID, V_VAR1);
        lastSend=currentTime;
        }
      
      
    }
    
    
    void incomingMessage(const MyMessage &message) {
      if (message.type==V_VAR1) {  
        pulseCount = oldPulseCount = message.getLong();
        Serial.print("Received last pulse count from gw:");
        Serial.println(pulseCount);
        pcReceived = true;
      }
    }
    
    

    Here a picture of the emitter, a Nano with high range antennae in a box !
    IMG_20150701_143623.jpg

    Hardware

  • Viration sensor
    epierreE epierre

    A new sketch using a simpler vibration sensor than the one on the store, this one has only one output to go into digital pin 3 hich is PWM.

    VibrationSensor.ino

    The sketch uses the interrupt to count the value between too sending to gateway (sleep time).

    Globally the sensor is not that much sensitive, some people use the piezzo one for seismic activity monitoring, this one is more door knock measurement. As I write, it is on my keyboard and does not report anything, but if I knock on the keyboard a value is reported.

    @hek I would need a value too for this one...

    My Project

  • serial reading
    epierreE epierre

    Ok so today I've added a conf file reading, and started to work on the database model (hardware-device-sensor) in sqlite3 to keep track of last known value and last affected sensor id. This speeds up the whole thing at startup.

    Next step is to store all devices data in the table, and update them whenever they are received.

    Afterward, I'll try creating a new sensor automatically, and then try to extend it to other sensors type.

    If anyone is interrested in trying it (very beta yet...)...

    Troubleshooting

  • What did you build today (Pictures) ?
    epierreE epierre

    not with mysensors, but could have been: CNY70 water sensor meter (rotating wheel) with extended wifi range, the heart of it is a Particle Photon pushing to domoticz

    0_1563895501049_1e1f491c-38c1-413e-89db-0d248b38f86c-image.png

    General Discussion

  • Soil Humidity and temperature sensor - Watermark / Davis granular matrix sensor
    epierreE epierre

    Two ways of doing it:

    1 - With capacitors:
    http://forum.arduino.cc/index.php/topic,22250.0.html

    2- By alternating the voltage way:
    http://vanderleevineyard.com/1/category/vinduino/1.html

    4533105.jpg

    The resistance has to be moved to 4700ohms.

    The formula from the datasheet is known:
    http://www.kimberly.uidaho.edu/water/swm/Calibration_Watermark2.htm

    My Project

  • Ebyte nRF24L01P Wireless rf Transceiver E01-2G4M27D 27dBm SPI 2.4GHz Transmitter
    epierreE epierre

    Hy there, added an AMS1117 regulator board and a 4,7uF and this works agains ! thanks all for your help !

    Troubleshooting

  • Air Quality Sensor
    epierreE epierre

    I'm now testing the MICS-6814 (3 sensors in one) given for :
    Carbon monoxide CO 1 -1000ppm
    **Nitrogen dioxide NO2 0.05 –10ppm **
    Ethanol C2H5OH 10 –500ppm
    Hydrogen H2 1 –1000ppm
    Ammonia NH3 1 –500ppm
    Methane CH4 >1000ppm
    Propane C3H8 >1000ppm
    Iso-butane C4H10 >1000ppm

    Datasheet maionly speaks on CO, NO2 and NH3:
    http://www.seeedstudio.com/wiki/images/1/10/MiCS-6814_Datasheet.pdf

    Here is are scripts:
    http://www.seeedstudio.com/wiki/Grove_-_Multichannel_Gas_Sensor

    http://www.seeedstudio.com/wiki/images/1/10/MiCS-6814_Datasheet.pdf

    Some readings:

    The concentration of NH3 is 0.99 ppm
    The concentration of CO is 1.20 ppm
    The concentration of NO2 is 0.15 ppm
    The concentration of C3H8 is 1000.04 ppm
    The concentration of C4H10 is 999.98 ppm
    The concentration of CH4 is 2991.14 ppm
    The concentration of H2 is 1.09 ppm
    The concentration of C2H5OH is 1.40 ppm
    

    I guess I'll make a script soon...

    Hardware calibration aqi gas sensor hcho air quality

  • Air Quality: CO2 Sensor MH-Z14
    epierreE epierre

    Hello,

    I have started working on the MH-Z14 which is present in the store, that is accurate (uses infrared to mesure particles) and does not evolve in time.

    http://mysensors.org/store/#gas

    It gives back the concentration based on a pulse modulation (PWM). Here is my first sketch attempt:

    https://github.com/empierre/arduino/blob/master/CO2-MH-Z14.ino

    Current status: in investigation
    Discussion: The script uses the pulseIn function, but it appears that the output value is
    very much more the 1004ms cycle advised:

    pulseIn: 324657 ms
    calculated value: 649310
    324305 ms
    648606
    324136 ms
    648268
    323617 ms
    647230
    

    Anyway when I beathe on the sensor it reacts which is a good news.

    I will try to spy it with a DSO to see if there is an issue.

    Another way to do it would be through the UART access...

    My Project gas sensor air quality co2

  • 1.5.1 to 2.3.2 issues
    epierreE epierre

    intermediary result: I have started a second gateway and now the nodes do communicate... puzzled...

    I remove the extra gateway... same situation...

    so reprogram gateway with:
    #define MY_RF24_PA_LEVEL RF24_PA_LOW

    so it seems this was the responsible for this !

    thanks !

    Troubleshooting

  • Air Quality Sensor
    epierreE epierre

    I have had some questions about converting from mg/m3 to ppm gases, here are the weight values and a proposed method:
    NH3 17.03 g/mol
    CO2 44.01
    CO 28.01
    H2S 34.08
    NO2 46.01
    NO 30.01
    O3 48.00
    C6H6 78.11
    C7H8 92.14

    you have:
    NO2 50 μg/m3 gives 26,5868821 ppm
    O3 27 μg/m3 = 0.027 mg/m3 -> (8,31441298,15)/(48101,325)*27=13,7617025 ppm

    correct me if I'm wrong

    Hardware calibration aqi gas sensor hcho air quality

  • My Ugly ESP GW Prototype
    epierreE epierre

    I already have one, thanx !

    guy, I had the same idea, and the photon is a beast (when you make it work for I was an alpha alpha tester...)

    My Project

  • Dust Sensor (1.4)
    epierreE epierre

    The Shinyei PPD42 has now its sketch :
    https://github.com/empierre/arduino/blob/master/DustSensor_Shinyei_PPD42NS.ino
    @hek either the SamYoung or Shinyei can be proposed, the sharp is definetly out of the race ...

    Both those sensors give similar values whih is a very good point.

    Development

  • Air Quality Sensor
    epierreE epierre

    @tantt2810 said:

    Hello,
    I'm don't understand the recipe below. Why RL_Value(Load Resistance)(1023-raw_adc)/raw_adc)? Can you explain for me?
    Thank you so much !!!
    Input: raw_adc - raw value read from adc, which represents the voltage
    Output: the calculated sensor resistance
    Remarks: The sensor and the load resistor forms a voltage divider. Given the voltage
    across the load resistor and its resistance, the resistance of the sensor
    could be derived.
    float MQ2::MQResistanceCalculation(int raw_adc)
    RL_VALUE
    (1023-raw_adc)/raw_adc));

    in fact it is above described, you have a voltage, you want a resistance.
    https://learn.sparkfun.com/tutorials/voltage-dividers

    datasheet needs a value which is the Rs/Ro (called here RL) where
    Ro: sensor resistance at 100ppm of NH3 in the clean air.
    Rs:sensor resistance at various concentrations of gases

    here the formula is a simplification of this:

    float Vrl = val * ( 5.00 / 1024.0 ); // V
    float Rs = 20000 * ( 5.00 - Vrl) / Vrl ; // Ohm
    int ratio = Rs/Ro;
    ppm = 37143 * pow (ratio, -3.178);

    Hardware calibration aqi gas sensor hcho air quality

  • Irrigation Controller (up to 16 valves with Shift Registers)
    epierreE epierre

    @BulldogLowell said:

    @epierre
    Are you getting ready to build?

    I've ordered the 8 switch, I have soil moisture, leaf moisture, ground humidity, rain gauge and found some evapotranspiration algorithm so I have all inputs and now need to have outputs in parallel of my rainbird scheduler (too dumb...)

    So I'm ready to build as you say ;-)

    My Project

  • Frustration ??
    epierreE epierre

    that is a post that would be interresting to share enclosings...

    Enclosures / 3D Printing

  • gw.send for float
    epierreE epierre

    @mfalkvidd thanks a lot !

    Feature Requests

  • Air Quality Sensor
    epierreE epierre

    @tantt2810 said:

    @epierre
    Thank you. Your mean is Vcc->5V, GND->GND, Dout->Digital pin, Aout->Analog pin. Is it right?
    But I don't know the tcm pin connect with ? I have read datasheet but I don't find any info about tcm pin. Please help me. Thank you so much !!!

    do not use the digital pin !!! it only reacts with the potentiometer in on/off mode, so useless... you need to power the device with Vcc/Gnd, and read the output with Aout (A stands for analog). The last one forget it.

    Hardware calibration aqi gas sensor hcho air quality
  • Login

  • Don't have an account? Register

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