Navigation

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

    the cosmic gate

    @the cosmic gate

    4
    Reputation
    54
    Posts
    878
    Profile views
    0
    Followers
    2
    Following
    Joined Last Online
    Website www.firma-listenbedrog.nl Location Etten-Leur Age 24

    the cosmic gate Follow

    Best posts made by the cosmic gate

    • RE: 110v-230v AC to Mysensors PCB board

      @aproxx said:

      For those who wanted to see some pictures of the board:
      IMG_20150921_194059 (Small).jpg IMG_20150921_194039 (Small).jpg IMG_20150921_194035 (Small).jpg IMG_20150921_194023 (Small).jpg IMG_20150921_192748 (Small).jpg IMG_20150921_192737 (Small).jpg IMG_20150921_192728 (Small).jpg

      Small notice: These pictures are of a slightly older design. The newer design has a few minor changes like better component placement and a permanent fuse instead of this resettable fuse. But these pictures should at least give you an idea on how everything looks like, and shows how really small it actually is.
      Also, I reinforced the traces of the 230v lines, which I absolutely recommend to do! (Although I do recommend to do it slightly more professional than I did on this prototype :))

      I really like this design, but it would be even nicer when this fits a ESP8266 🙂 Maybe the PCB could be even smaller . And it works together with link text .
      So is there maybe one of the PCB designer guys who can build /draw / design this 230v to ESP8266 PCB ?

      posted in Hardware
      the cosmic gate
      the cosmic gate
    • 3 in 1 incl battery monitor

      I'am trying to build some 3 in 1 ( motion / temp / hum ) incl. battery monitor .
      At the moment i try to combine these sketches , as result

      #include <SPI.h>
      #include <MySensor.h>  
      #include <DHT.h>  
      
      int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_MOT 2   // Id of the sensor child
      #define HUMIDITY_SENSOR_DIGITAL_PIN 4
      
      #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
      
      
      unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
      int oldBatteryPcnt = 0;
      
      MySensor gw;
      DHT dht;
      float lastTemp;
      float lastHum;
      boolean metric = true; 
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgMot(CHILD_ID_MOT, V_TRIPPED);
      
      void setup()  
      { 
         // use the 1.1 V internal reference
      #if defined(__AVR_ATmega2560__)
         analogReference(INTERNAL1V1);
      #else
         analogReference(INTERNAL);
      #endif
        gw.begin();
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
      
        // Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo("Humidity/Motion", "1.0");
      
      
       pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
       
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID_HUM, S_HUM);
        gw.present(CHILD_ID_TEMP, S_TEMP);
        gw.present(CHILD_ID_MOT, S_MOTION);
         
        metric = gw.getConfig().isMetric;
      }
      
      void loop()      
      
      {  
        // get the battery Voltage
         int sensorValue = analogRead(BATTERY_SENSE_PIN);
         #ifdef DEBUG
         Serial.println(sensorValue);
         #endif
         
         // 1M, 470K divider across battery and using internal ADC ref of 1.1V
         // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
         // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
         // 3.44/1023 = Volts per bit = 0.003363075
         float batteryV  = sensorValue * 0.003363075;
         int batteryPcnt = sensorValue / 10;
      
         #ifdef DEBUG
         Serial.print("Battery Voltage: ");
         Serial.print(batteryV);
         Serial.println(" V");
      
         Serial.print("Battery percent: ");
         Serial.print(batteryPcnt);
         Serial.println(" %");
         #endif
      
         if (oldBatteryPcnt != batteryPcnt) {
           // Power up radio after sleep
           gw.sendBatteryLevel(batteryPcnt);
           oldBatteryPcnt = batteryPcnt;
         }
           
           
        // Read digital motion value
        boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
              
        Serial.println(tripped);
        gw.send(msgMot.set(tripped?"1":"0"));  // Send tripped value to gw 
        
        delay(dht.getMinimumSamplingPeriod());
      
        float temperature = dht.getTemperature();
        if (isnan(temperature)) {
            Serial.println("Failed reading temperature from DHT");
        } else if (temperature != lastTemp) {
          lastTemp = temperature;
          if (!metric) {
            temperature = dht.toFahrenheit(temperature);
          }
          gw.send(msgTemp.set(temperature, 1));
          Serial.print("T: ");
          Serial.println(temperature);
        }
        
        float humidity = dht.getHumidity();
        if (isnan(humidity)) {
            Serial.println("Failed reading humidity from DHT");
        } else if (humidity != lastHum) {
            lastHum = humidity;
            gw.send(msgHum.set(humidity, 1));
            Serial.print("H: ");
            Serial.println(humidity);
        }
      
        
       
        // Sleep until interrupt comes in on motion sensor. Send update every two minute. 
        gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
      }
      
      

      Would this work ? ( sketch verification is okay 🙂 )

      posted in My Project
      the cosmic gate
      the cosmic gate
    • Watermeter Elster V200 PR6P:1

      Busy using / building a sensor like :
      alt text

      The sensor ( inductive) i use :LJ12A3-4-Z/BY as seen on the picture.

      I use the standaard water sensor sketch as found mysensors water sensor

      When i tested everything it seems to work together with domoticz ( after i changed this bij "hand" to: water).

      But how to find out about the pulses , or how to calculate this ?
      By default in the sketch it says:

      double ppl = ((double)PULSE_FACTOR)/1000;        // Pulses per liter
      

      But i want to know if this i right (or not)

      And the next thing to think about because this sensors is 10cm from the mysensors gateway : is it possible to connect this to the gateway so i dont have to build/use the extra arduino and radio as used now .
      Short: is it possible to combine this watersensor sketch with the gateway sketch and aruindo + RF radio

      posted in My Project
      the cosmic gate
      the cosmic gate

    Latest posts made by the cosmic gate

    • RE: Free MySensors 2.0 workshop, Friday 9 September in Amersfoort (The Netherlands)

      @rborer said:

      Why not broadcast ? 🙂

      Indeed something like a livestream would be great ! Also for the people somewhere else in the world ( or even closer the Dutch people with transporting / time problems like mine 🙂 )

      posted in General Discussion
      the cosmic gate
      the cosmic gate
    • RE: Meetup in the Netherlands - Saturday July 30th, in Breda!

      I planned to come over, but my son is sick so I'll had to take care of him ;(

      posted in General Discussion
      the cosmic gate
      the cosmic gate
    • RE: Watermeter Elster V200 PR6P:1

      @Yveaux said:

      @the-cosmic-gate I don't know the sketch, so I don't know.
      Why not just try it?

      The sketch would be then:

      /**
       * 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.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik Ekblad
       * 
       * DESCRIPTION
       * 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.
       *
       * Unfortunately millis() won't increment when the Arduino is in 
       * sleepmode. So we cannot make this sensor sleep if we also want  
       * to calculate/report flow.
       * http://www.mysensors.org/build/pulse_water
       */
      
      #include <SPI.h>
      #include <MySensor.h>  
      
      #define DIGITAL_INPUT_SENSOR 3                  // The digital input you attached your sensor.  (Only 2 and 3 generates interrupt!)
      #define SENSOR_INTERRUPT DIGITAL_INPUT_SENSOR-2        // Usually the interrupt = pin -2 (on uno/nano anyway)
      
      #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 filters outliers.
      
      #define CHILD_ID 1                              // Id of the sensor child
      
      unsigned long SEND_FREQUENCY = 20000;           // Minimum time between send (in milliseconds). We don't want to spam the gateway.
      
      MySensor gw;
      MyMessage flowMsg(CHILD_ID,V_FLOW);
      MyMessage volumeMsg(CHILD_ID,V_VOLUME);
      MyMessage lastCounterMsg(CHILD_ID,V_VAR1);
      
      double ppl = ((double)PULSE_FACTOR)/1        // 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 =0;                     
      double oldvolume =0;
      unsigned long lastSend =0;
      unsigned long lastPulse =0;
      
      void setup()  
      {  
        gw.begin(incomingMessage); 
      
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Water Meter", "1.2");
      
        // Register this device as Waterflow sensor
        gw.present(CHILD_ID, S_WATER);       
      
        pulseCount = oldPulseCount = 0;
      
        // Fetch last known pulse count value from gw
        gw.request(CHILD_ID, V_VAR1);
      
        lastSend = lastPulse = millis();
      
        attachInterrupt(SENSOR_INTERRUPT, onPulse, RISING);
      }
      
      
      void loop()     
      { 
        gw.process();
        unsigned long currentTime = millis();
      	
          // Only send values at a maximum frequency or woken up from sleep
        if (SLEEP_MODE || (currentTime - lastSend > SEND_FREQUENCY))
        {
          lastSend=currentTime;
          
          if (!pcReceived) {
            //Last Pulsecount not yet received from controller, request it again
            gw.request(CHILD_ID, V_VAR1);
            return;
          }
      
          if (!SLEEP_MODE && flow != oldflow) {
            oldflow = flow;
      
            Serial.print("l/min:");
            Serial.println(flow);
      
            // Check that we dont get unresonable large flow value. 
            // could hapen when long wraps or false interrupt triggered
            if (flow<((unsigned long)MAX_FLOW)) {
              gw.send(flowMsg.set(flow, 2));                   // Send flow value to gw
            }  
          }
        
          // No Pulse count received in 2min 
          if(currentTime - lastPulse > 120000){
            flow = 0;
          } 
      
          // Pulse count has changed
          if (pulseCount != oldPulseCount) {
            oldPulseCount = pulseCount;
      
            Serial.print("pulsecount:");
            Serial.println(pulseCount);
      
            gw.send(lastCounterMsg.set(pulseCount));                  // Send  pulsecount value to gw in VAR1
      
            double volume = ((double)pulseCount/((double)PULSE_FACTOR));     
            if (volume != oldvolume) {
              oldvolume = volume;
      
              Serial.print("volume:");
              Serial.println(volume, 3);
              
              gw.send(volumeMsg.set(volume, 3));               // Send volume value to gw
            } 
          }
        }
        if (SLEEP_MODE) {
          gw.sleep(SEND_FREQUENCY);
        }
      }
      
      void incomingMessage(const MyMessage &message) {
        if (message.type==V_VAR1) {
          unsigned long gwPulseCount=message.getULong();
          pulseCount += gwPulseCount;
          Serial.print("Received last pulse count from gw:");
          Serial.println(pulseCount);
          pcReceived = true;
        }
      }
      
      void onPulse()     
      {
        if (!SLEEP_MODE)
        {
          unsigned long newBlink = micros();   
          unsigned long interval = newBlink-lastBlink;
          
          if (interval!=0)
          {
            lastPulse = millis();
            if (interval<500000L) {
              // Sometimes we get interrupt on RISING,  500000 = 0.5sek debounce ( max 120 l/min)
              return;   
            }
            flow = (60000000.0 /interval) / ppl;
          }
          lastBlink = newBlink;
        }
        pulseCount++; 
      }
      
      posted in My Project
      the cosmic gate
      the cosmic gate
    • RE: Watermeter Elster V200 PR6P:1

      @the-cosmic-gate said:

      So the pulse rule must be

      double ppl = ((double)PULSE_FACTOR)/1
      

      ?

      Is this correct when I change this rule as above?

      posted in My Project
      the cosmic gate
      the cosmic gate
    • RE: Watermeter Elster V200 PR6P:1

      So the pulse rule must be

      double ppl = ((double)PULSE_FACTOR)/1
      

      ?

      posted in My Project
      the cosmic gate
      the cosmic gate
    • RE: Watermeter Elster V200 PR6P:1

      @Yveaux
      Seems to be easy 1 pulse every L

      YouTube video

      posted in My Project
      the cosmic gate
      the cosmic gate
    • RE: Watermeter Elster V200 PR6P:1

      @Yveaux said:

      @the-cosmic-gate ok, don't worry, I'll believe you 😏
      Probably the meter itself generates more pulse during rotation then.

      I think so , but with this movie "we" can think about the pulse per L

      posted in My Project
      the cosmic gate
      the cosmic gate
    • RE: Watermeter Elster V200 PR6P:1

      @Yveaux

      I will make a movie to show you the meter / pulse detection (led blinks) etc.
      So you can see that there are luckily more pulses to measure

      posted in My Project
      the cosmic gate
      the cosmic gate
    • RE: Watermeter Elster V200 PR6P:1

      @mfalkvidd

      Some close up picture :
      alt text

      posted in My Project
      the cosmic gate
      the cosmic gate
    • RE: Meetup in the Netherlands - Saturday July 30th, in Breda!

      @sincze said:

      @the-cosmic-gate great stuff 🙂 on more from the 'local' area. 10 minutes away.. Mmm Teteringen???

      hahah almost : Etten-Leur / Hoeven 😛 ( i drive a bit faster then normal 😛 )

      posted in General Discussion
      the cosmic gate
      the cosmic gate