Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. The-Holgi
    • Continue chat with The-Holgi
    • Start new chat with The-Holgi
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups

    The-Holgi

    @The-Holgi

    3
    Reputation
    7
    Posts
    33
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online
    Location Germany, Gelsenkirchen

    The-Holgi Follow

    Posts made by The-Holgi

    • RE: 💬 In Wall AC/DC Pcb for MySensors

      Hello,
      i´have purchased the in wall pcb rev.3.1.
      0_1548178091789_IMG_2001.JPG
      Now i´m want to cut up the right part of the pcb and powering the pcb with 5V power adapter.
      Why is the VCC pin (lower arrow) with the arduino GND pin (upper arrow) connectet?
      The GND pin lower side is connectet to arduino VCC pin, is that a mistake?
      I´m think the print vcc and ground are reversed.

      posted in OpenHardware.io
      The-Holgi
    • RE: EasyPcb BH1750 Batterie sketch

      Hello,
      the extended code works with right value . Every second the node sends the Batterie value and voltage to Controller.
      Thanks vor the code.

      posted in Troubleshooting
      The-Holgi
    • RE: EasyPcb BH1750 Batterie sketch

      Hello,
      on A0 are 0,8V. Batterie voltage is 2,6V.

      posted in Troubleshooting
      The-Holgi
    • RE: EasyPcb BH1750 Batterie sketch

      Here the output in the console:

      3
      51789 TSF:MSG:SEND,101-101-0-0,s=0,c=1,t=23,pt=3,l=2,sg=0,ft=0,st=OK:3
      Battery percent: 68 %
      Battery Average (Send): 91 %
      52801 TSF:MSG:SEND,101-101-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:91
      52809 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
      52815 TSF:TDI:TSL
      52817 MCO:SLP:WUP=-1
      52819 TSF:TRI:TSB```
      posted in Troubleshooting
      The-Holgi
    • RE: EasyPcb BH1750 Batterie sketch

      Hello,
      there was a mistake in the code. The negative value in serial console now fixed, but the output is to high.
      Now i have change the value of #define VMAX 3.0 to #define VMAX 3.5, at 2,9V batt output
      in fhem is the output now 91%.
      But i´l think this is the wrong way.
      By the way, thanks for quick sending the PCB
      Here is the code:

      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <SPI.h>
      #include <MySensors.h>  
      #include <BH1750.h>
      #include <Wire.h>
      
      #define CHILD_ID_LIGHT 0
      unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
      
      BH1750 lightSensor;
      
      // V_LIGHT_LEVEL should only be used for uncalibrated light level 0-100%.
      // If your controller supports the new V_LEVEL variable, use this instead for
      // transmitting LUX light level.
      MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
      // MyMessage msg(CHILD_ID_LIGHT, V_LEVEL);  
      uint16_t lastlux;
      
      //=========================
      // BATTERY VOLTAGE DIVIDER SETUP
      // 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
      #define VBAT_PER_BITS 0.003363075  
      #define VMIN 1.9                                  //  Vmin (radio Min Volt)=1.9V (564v)
      #define VMAX 3.5                                  //  Vmax = (2xAA bat)=3.0V (892v)
      int batteryPcnt = 0;                              // Calc value for battery %
      int batLoop = 0;                                  // Loop to help calc average
      int batArray[3];                                  // Array to store value for average calc.
      int BATTERY_SENSE_PIN = A0;                       // select the input pin for the battery sense point
      //=========================
      
      void setup()  
      { 
        analogReference(INTERNAL);             // For battery sensing
      
        delay(500); // Allow time for radio if power used as reset
        
        lightSensor.begin();
      }
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Light Lux Sensor", "1.0");
      
        // Register all sensors to gateway (they will be created as child devices)
        present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
      }
      
      void loop()      
      {     
        uint16_t lux = lightSensor.readLightLevel();// Get Lux value
        Serial.println(lux);
        if (lux != lastlux) {
            send(msg.set(lux));
            lastlux = lux;
        }
         batM();
        sleep(SLEEP_TIME); //sleep a bit
      }
      
      void batM() //The battery calculations
      {
         delay(500);
         // Battery monitoring reading
         int sensorValue = analogRead(BATTERY_SENSE_PIN);    
         delay(500);
         
         // Calculate the battery in %
         float Vbat  = sensorValue * VBAT_PER_BITS;
         int batteryPcnt = static_cast<int>(((Vbat-VMIN)/(VMAX-VMIN))*100.);
         Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %");  
         
         // Add it to array so we get an average of 3 (3x20min)
         batArray[batLoop] = batteryPcnt;
        
         if (batLoop > 2) {  
           batteryPcnt = (batArray[0] + batArray[1] + batArray[2] + batArray[3]);
           batteryPcnt = batteryPcnt / 3;
       
         if (batteryPcnt > 100) {
           batteryPcnt=100;
       }
       
           Serial.print("Battery Average (Send): "); Serial.print(batteryPcnt); Serial.println(" %");
             sendBatteryLevel(batteryPcnt);
             batLoop = 0;
            }
           else 
           {
           batLoop++;
           }
      
      }
      
      posted in Troubleshooting
      The-Holgi
    • RE: EasyPcb BH1750 Batterie sketch

      Hello,
      thank you for quick reply.
      Here is the output of serial output:

      Battery percent: -81 %
      Battery Average (Send): -105 %
      794046 TSF:MSG:SEND,101-101-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:151
      794054 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
      794060 TSF:TDI:TSL```
      
      It sends 151 to fhem.
      Best regards Holger
      posted in Troubleshooting
      The-Holgi
    • EasyPcb BH1750 Batterie sketch

      Hello,
      i´m using the EasyPcb with 2AA Batteries and a BH1750 Sensor.
      In fhem the Batterie state is at 150 to 153%, here is my sketch, Maybe somebody can look at this:

      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <SPI.h>
      #include <MySensors.h>  
      #include <BH1750.h>
      #include <Wire.h>
      
      #define CHILD_ID_LIGHT 0
      unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
      
      BH1750 lightSensor;
      
      // V_LIGHT_LEVEL should only be used for uncalibrated light level 0-100%.
      // If your controller supports the new V_LEVEL variable, use this instead for
      // transmitting LUX light level.
      MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
      // MyMessage msg(CHILD_ID_LIGHT, V_LEVEL);  
      uint16_t lastlux;
      
      //=========================
      // BATTERY VOLTAGE DIVIDER SETUP
      // 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
      #define VBAT_PER_BITS 0.003363075  
      #define VMIN 1.9                                  //  Vmin (radio Min Volt)=1.9V (564v)
      #define VMAX 3.0                                  //  Vmax = (2xAA bat)=3.0V (892v)
      int batteryPcnt = 0;                              // Calc value for battery %
      int batLoop = 0;                                  // Loop to help calc average
      int batArray[3];                                  // Array to store value for average calc.
      int BATTERY_SENSE_PIN = A0;                       // select the input pin for the battery sense point
      //=========================
      
      void setup()  
      { 
        lightSensor.begin();
      }
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Light Lux Sensor", "1.0");
      
        // Register all sensors to gateway (they will be created as child devices)
        present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
      }
      
      void loop()      
      {     
        uint16_t lux = lightSensor.readLightLevel();// Get Lux value
        Serial.println(lux);
        if (lux != lastlux) {
            send(msg.set(lux));
            lastlux = lux;
        }
         batM();
        sleep(SLEEP_TIME); //sleep a bit
      }
      
      void batM() //The battery calculations
      {
         delay(500);
         // Battery monitoring reading
         int sensorValue = analogRead(BATTERY_SENSE_PIN);    
         delay(500);
         
         // Calculate the battery in %
         float Vbat  = sensorValue * VBAT_PER_BITS;
         int batteryPcnt = static_cast<int>(((Vbat-VMIN)/(VMAX-VMIN))*100.);
         Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %");  
         
         // Add it to array so we get an average of 3 (3x20min)
         batArray[batLoop] = batteryPcnt;
        
         if (batLoop > 2) {  
           batteryPcnt = (batArray[0] + batArray[1] + batArray[2] + batArray[3]);
           batteryPcnt = batteryPcnt / 3;
       
         if (batteryPcnt > 100) {
           batteryPcnt=100;
       }
       
           Serial.print("Battery Average (Send): "); Serial.print(batteryPcnt); Serial.println(" %");
             sendBatteryLevel(batteryPcnt);
             batLoop = 0;
            }
           else 
           {
           batLoop++;
           }
      
        sleep(SLEEP_TIME);
      }
      posted in Troubleshooting
      The-Holgi