Navigation

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

    Peer van Hoek

    @peerkersezuuker

    Airgun enthousiast
    My Sensors / Domoticz.

    3
    Reputation
    18
    Posts
    607
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online
    Website www.kermisbuks.nl Location Mierlo (NL) Age 56

    peerkersezuuker Follow

    Best posts made by peerkersezuuker

    • RE: Solar Powered Mini-Weather Station

      Hello All,
      Long time reader, first time poster.
      I've been building my-sensors in combo with Domoticz for a while now , and this project is one of my favorites.
      I can confirm that the fritzing schema is correct, i checked it against the one i build. (whish i had the schema earlier, it would have been so much easier ;-))
      I used the followin library from Rob Tillaart for the DHT22 (http://playground.arduino.cc/Main/DHTLib / https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTlib) because the standard was not working...
      Change line 37 to dht DHT;
      comment out line 51
      From line 78 i changed the code to this :

      delay(2000);
            int chk = DHT.read22(HUMIDITY_SENSOR_DIGITAL_PIN);
            temp = DHT.temperature;
                   //Serial.print("Temperature DHT :");
                   //Serial.println(temp);
            if (isnan(temp)) {
                lastTemp = -1;
            } else if (temp != lastTemp) {
              lastTemp = temp;
              if (!metric) {
                temp = temp * 1.8 + 32.0;
              }
              gw.send(msgTemp.set(temp, 1));
              }
            hum = DHT.humidity;
            if (isnan(hum)) {
                lastHum = -1;
            } else if (hum != lastHum) {
                lastHum = hum;
                gw.send(msgHum.set(hum, 1));
            }
      

      And it is working like a charm.
      Now i ordered one of these : Wind Sensor
      I want to trie to get it working with this build.
      And indeed the lamp is stil available Solar Lamp

      Hope this helps,
      With Regard's
      Peer

      posted in My Project
      peerkersezuuker
      peerkersezuuker
    • RE: lost serial gateway after un plug power Rpi

      Thank's for the answers to this problem.
      They didn't work for me, but i think i solved mine.
      Stop monitoring the serial port for data from a terminal session.
      See my post at Domoticz forum.

      posted in Domoticz
      peerkersezuuker
      peerkersezuuker

    Latest posts made by peerkersezuuker

    • RE: FastLED / Neopixel (ws2811) Node, From Arduino code to Web page (with API)

      Hello,
      I know this is an old post.
      But i am trying the script getting to work in combination with Domoticz.
      A did a little rebuild to 2.1.0, and i am getting a RGD light which i can switch to dimmable in Domoticz.
      I can select color and dim the strip but i am struggeling with the Speed (V_VAR2) and Mode (V_VAR1).
      How can I adress these two in Domoticz so it is picked up by the node?
      So i want to set the mode and or the speed from Domoticz to.

      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      #define MY_RF24_PA_LEVEL RF24_PA_MAX
      // Enabled repeater feature for this node
      #define MY_REPEATER_FEATURE
      #define MY_NODE_ID 9
      
      #include <MySensors.h>
      #include <DHT.h>
      
      #include "FastLED.h"
      FASTLED_USING_NAMESPACE
      
      #if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000)
      #warning "Requires FastLED 3.1 or later; check github for latest code."
      #endif
      
      #define DATA_PIN    3
      //#define CLK_PIN   4
      #define LED_TYPE    WS2811
      #define COLOR_ORDER GRB
      #define NUM_LEDS    60
      CRGB leds[NUM_LEDS];
      uint8_t gHue = 0;
      
      
      unsigned int currentSpeed = 0 ;
      int brightness = 96;
      unsigned int requestedMode = 0 ;
      int messageType = 0 ;
      int previousMessageType = -1;
      
      String hexColor = "000000" ;
      
      unsigned long previousTime = 0 ;
      
      void setup() {
        delay(1000);
        Serial.begin(115200);
        FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
        FastLED.setBrightness(brightness);
        FastLED.show();
      }
      
      void presentation() {
        sendSketchInfo("FastLED Node", "1.0");
        present(0, S_RGB_LIGHT, "Makes strip said color", true);
      }
      
      void loop() {
        switch (messageType) {
      
          //************** CASE 1 **************
          case (1):
            Serial.print("Hex color override: "); Serial.println(hexColor);
            colorWipe();
            messageType = 0 ;
            break;
      
          //************** CASE 2 **************
          case (2):
            if ( (previousTime + (long) currentSpeed ) < millis() ) {
              if (requestedMode == 2) {rainbow(); FastLED.show(); }
              if (requestedMode == 3) {rainbowWithGlitter();FastLED.show(); }
              if (requestedMode == 4) {addGlitter(80);FastLED.show(); }
              if (requestedMode == 5) {confetti();FastLED.show(); }
              if (requestedMode == 6) {sinelon();FastLED.show(); }
              if (requestedMode == 7) {bpm();FastLED.show(); }
              if (requestedMode == 8) {juggle();FastLED.show(); }
              previousTime = millis();
            }
            break;
      
          //************** CASE 3 **************
          case (3):   // Adjust timing of case 2 using non-blocking code (no DELAYs)
            Serial.print("Case 3 received. Speed set to: "); Serial.print(currentSpeed); Serial.println(" ms.");
            messageType = 2; 
            break;
      
          //************** CASE 4 **************
          case (4):   // Adjust brightness of whole strip of case 2 using non-blocking code (no DELAYs)
            Serial.print("Case 4 received. Brightness set to: "); Serial.println(brightness);
            FastLED.setBrightness(brightness); FastLED.show();
            messageType = previousMessageType ; // We get off type 4 ASAP
            break;
      
      
      
        }
      }
      
      void receive(const MyMessage &message) {
        Serial.println("Message received: ");
      
        if (message.type == V_RGB) { 
          messageType = 1 ;
          hexColor = message.getString();
          Serial.print("RGB color: "); Serial.println(hexColor);
          }
          
        if (message.type == V_VAR1) { 
          requestedMode = message.getInt();
          Serial.println(requestedMode);
          messageType = 2 ;
          Serial.print("Neo mode: "); Serial.println(requestedMode);
        }
      
        if (message.type == V_VAR2) { // This line is for the speed of said mode
          currentSpeed = message.getInt() ;
          Serial.println(currentSpeed);
          messageType = 3 ;
          Serial.print("Neo speed: "); Serial.println(currentSpeed);
        }
      
        if (message.type == V_VAR3) { // This line is for the brightness of said mode
          brightness = message.getInt() ;
          //if(brightness > 255) {brightness = 255;}
          //if(brightness < 0) {brightness = 0;}
          Serial.println(brightness);
          previousMessageType = messageType;
          messageType = 4 ;
          Serial.print("Neo brightness: "); Serial.println(brightness);
        }
      }
      
      
      //********************** FastLED FUNCTIONS ***********************
      
      
      void colorWipe() {
        for (int i = 0; i < NUM_LEDS ; i++) {
          leds[i] = strtol( &hexColor[0], NULL, 16);
          FastLED.show();
        }
      }
      
      void rainbow()
      {
        // FastLED's built-in rainbow generator
        fill_rainbow( leds, NUM_LEDS, gHue++, 7);
      }
      
      void rainbowWithGlitter()
      {
        // built-in FastLED rainbow, plus some random sparkly glitter
        fill_rainbow( leds, NUM_LEDS, gHue++, 7);
        FastLED.show();
        addGlitter(80);
      }
      
      void addGlitter( fract8 chanceOfGlitter)
      {
        if ( random8() < chanceOfGlitter) {
          leds[ random16(NUM_LEDS) ] += CRGB::White;
        }
        
      }
      
      void confetti()
      {
        // random colored speckles that blink in and fade smoothly
        fadeToBlackBy( leds, NUM_LEDS, 10);
        int pos = random16(NUM_LEDS);
        leds[pos] += CHSV( gHue + random8(64), 200, 255);
      }
      
      void sinelon()
      {
        // a colored dot sweeping back and forth, with fading trails
        fadeToBlackBy( leds, NUM_LEDS, 20);
        int pos = beatsin16(13, 0, NUM_LEDS);
        leds[pos] += CHSV( gHue, 255, 192);
      }
      
      void bpm()
      {
        // colored stripes pulsing at a defined Beats-Per-Minute (BPM)
        uint8_t BeatsPerMinute = 62;
        CRGBPalette16 palette = PartyColors_p;
        uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
        for ( int i = 0; i < NUM_LEDS; i++) { //9948
          leds[i] = ColorFromPalette(palette, gHue + (i * 2), beat - gHue + (i * 10));
        }
      }
      
      void juggle() {
        // eight colored dots, weaving in and out of sync with each other
        fadeToBlackBy( leds, NUM_LEDS, 20);
        byte dothue = 0;
        for ( int i = 0; i < 8; i++) {
          leds[beatsin16(i + 7, 0, NUM_LEDS)] |= CHSV(dothue, 200, 255);
          dothue += 32;
        }
      }
      

      With Regards, and thanks in advance.
      Peter

      posted in Node-RED
      peerkersezuuker
      peerkersezuuker
    • 12V AC dimming

      Hello, i have looked arround but i cant seem to find any examples.
      I want to dim 3 x 12v AC ledbulbs in my kitchen seiling, and i was wondering how to build one with Mysensor controll.
      So input is 12v AC, wich should feed the mysensor node (converting ac-> dc) and dim my 12V AC led bulbs.
      Any suggestions on this ?

      With regard's
      Peer van Hoek

      posted in General Discussion
      peerkersezuuker
      peerkersezuuker
    • RE: lost serial gateway after un plug power Rpi

      Thank's for the answers to this problem.
      They didn't work for me, but i think i solved mine.
      Stop monitoring the serial port for data from a terminal session.
      See my post at Domoticz forum.

      posted in Domoticz
      peerkersezuuker
      peerkersezuuker
    • RE: 💬 OH MySensors RGBW Controller

      @Jan-Gatzke
      Sure, no problem.
      But it is not 100% clean, i am just a coppier and paste'r....
      If you can clean it up that would be nice.

      /**
      Based on the MySensors Project: http://www.mysensors.org
      
      This sketch controls a (analog)RGBW strip by listening to new color values from a (domoticz) controller and then fading to the new color.
      
      Version 1.0 - Changed pins and gw definition
      Version 0.9 - Oliver Hilsky
      
      TODO
      safe/request values after restart/loss of connection
      */
      #define MY_DEBUG 
      
      #define SN   "RGBW 01"
      #define SV   "1.0"
      #define MY_RADIO_NRF24
      // change the pins to free up the pwm pin for led control
      #define MY_RF24_CE_PIN 4 //<-- NOTE!!! changed, the default is 9
      #define MY_RF24_CS_PIN 10 // default is 10
      #define MY_RF24_PA_LEVEL RF24_PA_MAX
      #define MY_REPEATER_FEATURE
      #define MY_NODE_ID 6
      
      
      // Load mysensors library	
      #include <MySensors.h>	
      // Load Serial Peripheral Interface library  
      #include <SPI.h>
      
      // Arduino pin attached to driver pins
      #define RED_PIN 3 
      #define WHITE_PIN 9
      #define GREEN_PIN 5
      #define BLUE_PIN 6
      #define NUM_CHANNELS 4 // how many channels, RGBW=4 RGB=3...
      #define CHILD_ID 1
      
      // Smooth stepping between the values
      #define STEP 1
      #define INTERVAL 10
      const int pwmIntervals = 255;
      float R; // equation for dimming curve
      
      // Stores the current color settings
      byte channels[4] = {RED_PIN, GREEN_PIN, BLUE_PIN, WHITE_PIN};
      byte values[4] = {0, 0, 0, 255};
      byte target_values[4] = {0, 0, 0, 255}; 
      
      
      // stores dimming level
      byte dimming = 100;
      byte target_dimming = 100;
      
      // tracks if the strip should be on of off
      boolean isOn = true;
      
      // time tracking for updates
      unsigned long lastupdate = millis();
           
      void setup() 
      {
        // Initializes the sensor node (with callback function for incoming messages)
        //begin(incomingMessage);	// 123 = node id for testing	
             
        // Set all channels to output (pin number, type)
        for (int i = 0; i < NUM_CHANNELS; i++) {
          pinMode(channels[i], OUTPUT);
        }
      
        // set up dimming
        R = (pwmIntervals * log10(2))/(log10(255));
      
        // get old values if this is just a restart
        request(CHILD_ID, V_RGBW);
      
        // init lights
        updateLights();
        
        // debug
        if (isOn) {
          Serial.println("RGBW is running...");
        }
       
        Serial.println("Waiting for messages...");  
      }
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo(SN, SV);
      
        // Register this device as Waterflow sensor
        present(CHILD_ID, S_RGBW_LIGHT, SN, true);
      }
      
      void loop()
      {
        // Process incoming messages (like config and light state from controller) - basically keep the mysensors protocol running
      //  process();		
      
        // and set the new light colors
        if (millis() > lastupdate + INTERVAL) {
          updateLights();
          lastupdate = millis();
        } 
      }
      
      // callback function for incoming messages
      void receive(const MyMessage &message) {
      
        Serial.print("Got a message - ");
        Serial.print("Messagetype is: ");
        Serial.println(message.type);
      
        // acknoledgment
        if (message.isAck())
        {
         	Serial.println("Got ack from gateway");
        }
        
        // new dim level
        else if (message.type == V_DIMMER) {
            Serial.println("Dimming to ");
            Serial.println(message.getString());
            target_dimming = message.getByte();
      
            // a new dimmer value also means on, no seperate signal gets send (by domoticz)
          isOn = true;
        }
      
        // on / off message
        else if (message.type == V_STATUS) {
          Serial.print("Turning light ");
      
          isOn = message.getInt();
      
          if (isOn) {
            Serial.println("on");
          } else {
            Serial.println("off");
          }
        }
      
        // new color value
        else if (message.type == V_RGBW) {    
          const char * rgbvalues = message.getString();
          inputToRGBW(rgbvalues);  
      
          // a new color also means on, no seperate signal gets send (by domoticz); needed e.g. for groups
          isOn = true;  
        }  
      }
      
      // this gets called every INTERVAL milliseconds and updates the current pwm levels for all colors
      void updateLights() {  
      
        // update pin values -debug
        //Serial.println(greenval);
        //Serial.println(redval);
        //Serial.println(blueval);
        //Serial.println(whiteval);
      
        //Serial.println(target_greenval);
        //Serial.println(target_redval);
        //Serial.println(target_blueval);
        //Serial.println(target_whiteval);
        //Serial.println("+++++++++++++++");
      
        // for each color
        for (int v = 0; v < NUM_CHANNELS; v++) {
      
          if (values[v] < target_values[v]) {
            values[v] += STEP;
            if (values[v] > target_values[v]) {
              values[v] = target_values[v];
            }
          }
      
          if (values[v] > target_values[v]) {
            values[v] -= STEP;
            if (values[v] < target_values[v]) {
              values[v] = target_values[v];
            }
          }
        }
      
        // dimming
        if (dimming < target_dimming) {
          dimming += STEP;
          if (dimming > target_dimming) {
            dimming = target_dimming;
          }
        }
        if (dimming > target_dimming) {
          dimming -= STEP;
          if (dimming < target_dimming) {
            dimming = target_dimming;
          }
        }
      
        /*
        // debug - new values
        Serial.println(greenval);
        Serial.println(redval);
        Serial.println(blueval);
        Serial.println(whiteval);
      
        Serial.println(target_greenval);
        Serial.println(target_redval);
        Serial.println(target_blueval);
        Serial.println(target_whiteval);
        Serial.println("+++++++++++++++");
        */
      
        // set actual pin values
        for (int i = 0; i < NUM_CHANNELS; i++) {
          if (isOn) {
            // normal fading
            analogWrite(channels[i], dimming / 100.0 * values[i]);
      
            // non linear fading, idea from https://diarmuid.ie/blog/pwm-exponential-led-fading-on-arduino-or-other-platforms/
            //analogWrite(channels[i], pow (2, (dimming / R)) - 1);
          } else {
            analogWrite(channels[i], 0);
          }
        }
      }
      
      // converts incoming color string to actual (int) values
      // ATTENTION this currently does nearly no checks, so the format needs to be exactly like domoticz sends the strings
      void inputToRGBW(const char * input) {
        Serial.print("Got color value of length: "); 
        Serial.println(strlen(input));
        
        if (strlen(input) == 6) {
          Serial.println("new rgb value");
          target_values[0] = fromhex (& input [0]);
          target_values[1] = fromhex (& input [2]);
          target_values[2] = fromhex (& input [4]);
          target_values[3] = 0;
        } else if (strlen(input) == 9) {
          Serial.println("new rgbw value");
          target_values[0] = fromhex (& input [1]); // ignore # as first sign
          target_values[1] = fromhex (& input [3]);
          target_values[2] = fromhex (& input [5]);
          target_values[3] = fromhex (& input [7]);
        } else {
          Serial.println("Wrong length of input");
        }  
      
      
        Serial.print("New color values: ");
        Serial.println(input);
        
        for (int i = 0; i < NUM_CHANNELS; i++) {
          Serial.print(target_values[i]);
          Serial.print(", ");
        }
       
        Serial.println("");
        Serial.print("Dimming: ");
        Serial.println(dimming);
      }
      
      // converts hex char to byte
      byte fromhex (const char * str)
      {
        char c = str [0] - '0';
        if (c > 9)
          c -= 7;
        int result = c;
        c = str [1] - '0';
        if (c > 9)
          c -= 7;
        return (result << 4) | c;
      }```
      posted in OpenHardware.io
      peerkersezuuker
      peerkersezuuker
    • RE: 💬 OH MySensors RGBW Controller

      @Jan-Gatzke
      Thank you, i see it in the code now ...
      I tested it with setting the RGB levels one by one to 255, and this works, so the channels are responding to the initialisation code.
      And because it is rebuild to version 2.0, i forgot one void to adjust...
      void incomingMessage(
      should be
      void receive(

      Problem solved, thank you very much.
      With regards
      Peer van Hoek

      posted in OpenHardware.io
      peerkersezuuker
      peerkersezuuker
    • RE: 💬 OH MySensors RGBW Controller

      A little question, the v1.3 is this the one with the corrected mosfet placement ?
      I build and programmed one now, but i only get a bright white light, and no response when i switch the node. So now i am in doubt...

      With regards
      Peer

      posted in OpenHardware.io
      peerkersezuuker
      peerkersezuuker
    • RE: lost serial gateway after un plug power Rpi

      I have the same problem, i posted a question at the Domoticz Forum :
      Not reconnecting serial portt

      Greetz Peer

      posted in Domoticz
      peerkersezuuker
      peerkersezuuker
    • RE: 💬 OH MySensors RGBW Controller

      @Jan-Gatzke
      Thank you for your post.
      I hope the Mosfet's are comming in today, then i can build it up and play with it.

      posted in OpenHardware.io
      peerkersezuuker
      peerkersezuuker
    • RE: 💬 OH MySensors RGBW Controller

      @Jan-Gatzke
      Hi can you please post your adjusted sketch for further reference?

      posted in OpenHardware.io
      peerkersezuuker
      peerkersezuuker
    • RE: 💬 OH MySensors RGBW Controller

      Just got the v1.3 pcb's from OSH Park, just waiting for some components, and the we go. It will be an exciting christmas 😉

      posted in OpenHardware.io
      peerkersezuuker
      peerkersezuuker