Navigation

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

    Best posts made by warmaniac

    • RE: Low power battery Door/Window sketch nrf24l01

      @sundberg84

      I had barometer BMP180 powered on 2xAA 1,5V , in usage from 1.March 2017 , Start battery power was 85% (not new batteries, before used) and now after 14 days of usage is 84 % , Im very satisfied. Using only without LEDs ,with power regulator on arduino.

      1_1489491784079_baro_2.png 0_1489491784079_baro_1.png

      posted in Development
      warmaniac
      warmaniac
    • RE: SCT-013-030 current monitor sensor

      updated my sketch with new values for SCT-013-00 result is now

      #define MY_DEBUG
      #define MY_RADIO_NRF24
      // EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3  ***/
      #include <SPI.h>
      #include <MySensors.h>
      #include "EmonLib.h"             // Include Emon Library
      EnergyMonitor emon1;             // Create an instance
      
      #define CHILD_ID_CLAMP1 0
      #define PIN_ANALOG_I1 A1 //pince amperemetrique1
      
      unsigned long lastSend_power = millis();
      unsigned long lastSend_c = millis();
      unsigned long SEND_FREQUENCY = 120000; // Minimum time between send (in milliseconds). We don't wnat to spam the gateway.
      unsigned long SEND_FREQUENCY_C = SEND_FREQUENCY / 30;
      int index = 0;
      double Irms1 = 0;
      boolean pcReceived1 = false;
      float nrj1 = 0, old_nrj1;
      
      MyMessage IrmsMsg1(CHILD_ID_CLAMP1, V_WATT);
      MyMessage kWhMsg1(CHILD_ID_CLAMP1, V_KWH);
      MyMessage pcMsg1(CHILD_ID_CLAMP1, V_VAR1);
      
      void before() {
      
      }
      
      
      void presentation()
      {
        sendSketchInfo("Multisensors_Entree", "2.0");  // Send the sketch version information to the gateway and Controller
        present(CHILD_ID_CLAMP1, S_POWER);   // Register this device as power sensor
        request(CHILD_ID_CLAMP1, V_VAR1);
      }
      
      
      void receive(const MyMessage &message)
      {
        if (message.type == V_VAR1)
        {
          nrj1 = old_nrj1 = message.getFloat();
          Serial.print("Received last nrj count from gw:");
          Serial.println(nrj1);
          pcReceived1 = true;
        }
      }
      
      void setup()
      {
        emon1.current(PIN_ANALOG_I1, 111.1);       // Current: input pin, calibration.
        Serial.println("SETUP completed");
      }
      
      void envoi_donnees(double intrms, int id_clamp)
      {
        Serial.print("Envoi des donnees .... clamp="); Serial.println(id_clamp);
        double energie = (intrms * 240.0 * SEND_FREQUENCY / 1000) / 3.6E6;
        switch (id_clamp) //can be modified ...
        {
          case 1:
            {
              send(IrmsMsg1.set(intrms * 240.0, 1));
              nrj1 += energie;
              send(kWhMsg1.set(nrj1, 5));
              send(pcMsg1.set(nrj1, 5));
              old_nrj1 = nrj1;
            }
            break;
        }
      }
      
      void loop() {
        unsigned long now = millis();
        bool sendTime_c = now - lastSend_c > SEND_FREQUENCY_C;
        // Calcul de Irms1 et Irms2
        if (sendTime_c) //calcul Irms moy clamp1/clamp2
        {
          if (index == 0)
          {
            Irms1 = emon1.calcIrms(1480);
          }
          else  
          {
            Irms1 = (index * Irms1 + emon1.calcIrms(1480)) / (index + 1);
          }
          lastSend_c = now;
          index++;
        }
      
      bool sendTime_power = now - lastSend_power > SEND_FREQUENCY;
      
       if (sendTime_power)
      {
        // Envoi ou request Puissance1
        if (pcReceived1) envoi_donnees(Irms1, 1);
        else     {
          request(CHILD_ID_CLAMP1, V_VAR1);
          Serial.println("Request VAR1");
        }
        //on reinitialise les compteurs
        lastSend_power = now;
        index = 0;
        }
      }
      

      0_1490992284051_upload-583cafbf-bd94-4bad-8fd3-8c510f5cfbfc

      posted in Hardware
      warmaniac
      warmaniac