Navigation

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

    Dwalt

    @Dwalt

    42
    Reputation
    218
    Posts
    2531
    Profile views
    2
    Followers
    0
    Following
    Joined Last Online
    Location Cincinnati, Ohio USA

    Dwalt Follow

    Best posts made by Dwalt

    • Experimenting with cheap 433mhz gadgets

      I originally found MySensors while looking for a way to control 433mhz outlets with my Vera. Being frugal, I did not want to spend money on RFXtrx or similar device to control cheap outlets. My first sensor node was a nano with a 433mhz transmitter which controls several plugin outlets around my house. I later modified it to include the receiver which I used to intercept my neighbors weather station data. Unexpectedly, his weather station disappeared a few months ago and I stopped getting his data. I don't know if he took it down or it fell off his roof or was stolen. I waited a week and then sadly deleted the child devices on my Vera. Recently I decided to move on and find more uses for the 433mhz node, especially the reciever and stumbled upon some really cheap Chinese gadgets on Ebay/Ali and thought I would share some of what I found out.

      First of all, the cheap Rx/Tx pair listed in the MySensors store is really cheap ($0.69?) but are not very good. The transmitter operates fine but the receiver is terrible. Both have acceptable range but I found I could not use the receiver with most of the available libraries due to the very poor signal/noise ratio. I had to 'sniff' most signals down to their binary level and re-encode this mess into a sketch for retransmission. Reception was also hit or miss. I recently upgraded to the superheterodyne Tx/Rx modules and like magic, all the libraries suddenly work, range seems slightly better but most noticeably, missed transmissions are gone.

      I also recently bought this cheap rf LED strip controller for ~$1.80.
      IMG_20151029_171728.jpg

      Surprisingly it actually works but the included remote has a range of only a few meters. So I sniffed the codes with the RCSwitch Library and wrote a sketch to test it with MySensors. Primarily I wanted to explore the dimming functionality and ran into a few problems. The unit dims the LED strip in very noticeable steps which cause the light to blink slightly as it dims, not very elegant but not a deal breaker (19 steps from 5-100%). The device is not individually addressable so if you have multiples, they will all follow the same commands. The fatal flaw of this device is the power on/off command is toggled which means the same code turns it off as turns it back on. I ran this for about 2 days and it missed a power on command (or a power off, I don't know). Once it got out of phase, it had to be manually corrected with the remote or remain out of phase until another missed command.

      Another cheap chinese gadget I tested was this learning remote.
      IMG_20151029_171647.jpg

      It has four buttons which can each be programed with any 433mhz code you want and store the code in memory to retransmit. I made up some codes which were similar in structure and pulse length as my 433mhz outlets use, made a simple sketch to broadcast the codes so I could 'program' the keychain remote. With 4 unique codes in the keychain, I modified my 433mhz sensor node sketch to include a scene controller sketch which toggles 4 scenes on and off (I used AWI's toggle scene controller sketch for the pertinent code-fu.). Unlike the rf LED controller, the scene state is stored in the arduino which makes it more dependable. Perhaps not as reliable as nrf , z-wave or zigbee, but for a $2 portable scene controller....not bad.

      Attached is my sketch for toggling on an off four 433mhz outlets and a scene controller. The hardware is simple. I have a nano on mains power with the superheterodyne Rx on pin #2 and the Tx on pin #3. Both are power by 5V separately from the nano and have 17cm antenna soldered on.

      #include <MySensor.h>
      #include <SPI.h>
      #include <EEPROM.h>  
      #include <MyTransportNRF24.h>
      #include <MyHwATMega328.h>
      #include <RemoteReceiver.h>
      #include <RemoteTransmitter.h>
      #include <InterruptChain.h>
      
      
      #define NUMBER_OF_OUTLETS 4
      #define SN "433mhz Bridge"
      #define SV "1.3"
      
      const byte SC_CHILD_ID = 0 ;
      unsigned long receivedCode = 0 ;
      int key=0;
      
      // Setup arrays with the unique button codes sniffed using ShowReceivedCode.ino from the RemoteSwitch library 
      // These are outgoing codes, one array for 'switch on' and one for 'switch off'
      long rfCodeON [] = {492004, 492022, 491914, 491752};
      long rfCodeOFF [] = {492006, 492024, 491916, 491754};
      
      int pulse = 185;  //The average pulse length of the codes, needed for the RemoteTransmitter sendCode function
      
      // Setup an array of the expected incoming codes from the KeyFob transmitter
      unsigned long sceneCode [] = {491266, 491268, 491275, 491277}; 
      byte keyState[4]  ;
      
      MySensor gw;
      MyMessage scene_on(SC_CHILD_ID, V_SCENE_ON);
      MyMessage scene_off(SC_CHILD_ID, V_SCENE_OFF);
      
      
      void setup() { 
        
       Serial.begin(115200); 
         
       gw.begin(incomingMessage, 15, true);
       gw.sendSketchInfo(SN, SV);
      
       //  Create a child device for each outlet
       for (int sensor=1; sensor<=NUMBER_OF_OUTLETS; sensor++){
       gw.present(sensor, S_LIGHT);
       delay(2);
       }
       
       //  Create a child device for the scene controller and load last Scenestates from EEPROM
       gw.present(SC_CHILD_ID, S_SCENE_CONTROLLER);
       for (int i=0 ; i < sizeof(sceneCode); i++){
              keyState[i] = gw.loadState(i) ;         
              }
      
      // Initialize receiver on interrupt 0 (= digital pin 2), calls the function "incomingCode"
      RemoteReceiver::init(0, 2, incomingCode);
      InterruptChain::addInterruptCallback(0, RemoteReceiver::interruptHandler);
      }
      
      void loop() {
       gw.process();
       
      }
      
      // Function for when a code has been received from rF KeyFob transmitter
        void incomingCode(unsigned long receivedCode, unsigned int period) {
      //Disable the 433mhz Reciever to prevent additional interupts from incoming signals 
        RemoteReceiver::disable();
      //Enable interupts to allow gw.wait  
        interrupts();
      // Print the received code.
        Serial.print("Code: ");
        Serial.print(receivedCode);
        Serial.print(", period: ");
        Serial.print(period);
        Serial.println("us.");
      
      // check the recieved code against the array of expected codes
          for (byte i = 0 ; i < 4 ; i++){    
              if(receivedCode == (sceneCode[i])) key=i+1;// set key if a valid code is recieved
              }
      // Print the scene number        
        Serial.print("Scene #: ");
        Serial.println(key);   
          
          if (key > 0){                                   
              boolean keyVal = !gw.loadState(key-1);      // use lastState from EEPROM and toggle
              gw.saveState(key-1, keyVal);                // save new state to EEPROM
              if (keyVal) gw.send(scene_on.set(key-1));   // set the Scene On or Off
              else gw.send(scene_off.set(key-1));
             gw.wait(500);
              key = 0;                                    // reset key
              receivedCode = 0 ;                          // reset code
              RemoteReceiver::enable();                   // turn 433mhz receiver back on
         }
      }
      
      
      // Function for when a command has been received from gateway
        void incomingMessage(const MyMessage &message) 
      {
       {
        if (message.type==V_LIGHT) 
        {
          Serial.print("Outlet #: ");
          Serial.println(message.sensor);
          Serial.print("Command: ");
          Serial.println(message.getBool());
      // Turn off 433mhz receiver to prevent reception of outgoing 433mhz broadcast   
          RemoteReceiver::disable();
      //  Send out the code stored in the arrays based on which child id and command is recieved.  
      //  Syntax is (pin 3, code to be transmitted, pulse length, transmit repetitions ~2^3 or 8 times)
          RemoteTransmitter::sendCode(3,message.getBool()? rfCodeON[message.sensor - 1]: rfCodeOFF[message.sensor - 1], pulse, 3);
        }
        delay(50);
       }
      // Turn the 433mhz Receiver back on 
      RemoteReceiver::enable();
      }    
        
      
      posted in My Project
      Dwalt
      Dwalt
    • My generic room-senser (Sensebender with Motion and Light)

      I have been trying to make a generic sensor to deploy throughout my house to provide variables which my home automation can work from. The primary data streams I was looking for are temp, motion sensing and light level. From these three, a lot of automation can be created. The Sensebender is the perfect platform to build from - small and designed for battery power. I added a ambient light phototransistor and a low power panasonic PIR and used these cheap housings from ALIExpress. I drove the phototransistor from a digital pin (D7) so it could be powered on and off every time thru the loop and powered the whole thing from a CR123 battery.

      The sketch was based upon the Sensebender Micro sketch with minor additions for the PIR and light level sensor. The PIR is setup on the interrupt on D3 and the light sensor follows the same timer schedule as the Si7021.

      // Default sensor sketch for Sensebender Micro module
      // Act as a temperature / humidity sensor by default.
      //
      // If A0 is held low while powering on, it will enter testmode, which verifies all on-board peripherals
      // 
      // Battery voltage is repported as child sensorId 199, as well as battery percentage (Internal message)
      
      
      #include <MySensor.h>
      #include <Wire.h>
      #include <SI7021.h>
      #include <SPI.h>
      #include <SPIFlash.h>
      #include <EEPROM.h>  
      #include <sha204_lib_return_codes.h>
      #include <sha204_library.h>
      
      // Define a static node address, remove if you want auto address assignment
      //#define NODE_ADDRESS   3
      
      #define RELEASE "1.0"
      
      // Child sensor ID's
      #define CHILD_ID_TEMP  1
      #define CHILD_ID_HUM   2
      #define CHILD_ID_PIR   3
      #define CHILD_ID_LIGHT  4
      #define CHILD_ID_BATT  199
      
      // How many milli seconds between each measurement
      #define MEASURE_INTERVAL 60000
      
      // FORCE_TRANSMIT_INTERVAL, this number of times of wakeup, the sensor is forced to report all values to the controller
      #define FORCE_TRANSMIT_INTERVAL 30 
      
      // When MEASURE_INTERVAL is 60000 and FORCE_TRANSMIT_INTERVAL is 30, we force a transmission every 30 minutes.
      // Between the forced transmissions a tranmission will only occur if the measured value differs from the previous measurement
      
      //Pin definitions
      #define TEST_PIN       A0
      #define LED_PIN        A2
      #define PIR_SENSOR_DIGITAL 3
      #define LIGHT_PIN A1
      #define ATSHA204_PIN   17 // A3
      
      const int sha204Pin = ATSHA204_PIN;
      atsha204Class sha204(sha204Pin);
      
      SI7021 humiditySensor;
      SPIFlash flash(8, 0x1F65);
      
      MySensor gw;
      
      // Sensor messages
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgPir(CHILD_ID_PIR, V_TRIPPED);
      MyMessage msgLight(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
      MyMessage msgBattery(CHILD_ID_BATT, V_VOLTAGE);
      
      // Global settings
      int measureCount = 0;
      boolean isMetric = true;
      
      
      // Storage of old measurements
      float lastTemperature = -100;
      int lastHumidity = -100;
      int lastLightLevel = -1;
      long lastBattery = -100;
      boolean lastTrippedState;
      
      bool highfreq = true;
      
      void setup() {
      
        pinMode(LED_PIN, OUTPUT);
        digitalWrite(LED_PIN, LOW);
      
        pinMode(PIR_SENSOR_DIGITAL, INPUT);
        digitalWrite(PIR_SENSOR_DIGITAL, HIGH);
      
        pinMode(7, OUTPUT);  // “power pin” for Light Sensor
        digitalWrite(7, LOW);  // switch power off
      
        Serial.begin(115200);
        Serial.print(F("Sensebender Micro FW "));
        Serial.print(RELEASE);
        Serial.flush();
      
        // First check if we should boot into test mode
      
        pinMode(TEST_PIN,INPUT);
        digitalWrite(TEST_PIN, HIGH); // Enable pullup
        if (!digitalRead(TEST_PIN)) testMode();
      
        digitalWrite(TEST_PIN,LOW);
        digitalWrite(LED_PIN, HIGH); 
      
      #ifdef NODE_ADDRESS
        gw.begin(NULL, NODE_ADDRESS, false);
      #else
        gw.begin(NULL,AUTO,false);
      #endif
      
        digitalWrite(LED_PIN, LOW);
      
        humiditySensor.begin();
        Serial.flush();
        Serial.println(F(" - Online!"));
        gw.sendSketchInfo("Sensebender 4-Way", RELEASE);
        
        gw.present(CHILD_ID_TEMP,S_TEMP);
        gw.present(CHILD_ID_HUM,S_HUM);
        gw.present(CHILD_ID_PIR, S_MOTION);
        gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
        
        isMetric = gw.getConfig().isMetric;
        Serial.print("isMetric: "); Serial.println(isMetric);
      
      }
      
      
      // Main loop function
      void loop() {
        measureCount ++;
        bool forceTransmit = false;
      
        // When we wake up the 5th time after power on, switch to 1Mhz clock
        // This allows us to print debug messages on startup (as serial port is dependend on oscilator settings).
        if ((measureCount == 5) && highfreq) switchClock(1<<CLKPS2); // Switch to 1Mhz for the reminder of the sketch, save power.
        
        if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission
          forceTransmit = true; 
          measureCount = 0;
        }
      
        gw.process();
        sendBattLevel(forceTransmit);
        digitalWrite(7, HIGH); // switch power on to LDR
        sendTempHumidityMeasurements(forceTransmit);
        sendLight(forceTransmit);
        digitalWrite(7, LOW); // switch power off to LDR
        sendPir();
        
        gw.sleep(PIR_SENSOR_DIGITAL - 2, CHANGE, MEASURE_INTERVAL);  
      }
      
      /*
       * Sends temperature and humidity from Si7021 sensor
       *
       * Parameters
       * - force : Forces transmission of a value (even if it's the same as previous measurement)
       */
      void sendTempHumidityMeasurements(bool force)
      {
        if (force) {
          lastHumidity = -100;
          lastTemperature = -100;
        }
        
        si7021_env data = humiditySensor.getHumidityAndTemperature();
        
        float temperature = (isMetric ? data.celsiusHundredths : data.fahrenheitHundredths) / 100.0;
          
        int humidity = data.humidityPercent;
      
        if ((lastTemperature != temperature) | (lastHumidity != humidity)) {
          Serial.print("T: ");Serial.println(temperature);
          Serial.print("H: ");Serial.println(humidity);
          
          gw.send(msgTemp.set(temperature,1));
          gw.send(msgHum.set(humidity));
          lastTemperature = temperature;
          lastHumidity = humidity;
        }
      }
      
      /*   
       *  Sends Motion alert on interupt
       */
      
      void sendPir() // Get value of PIR
      {
        boolean tripped = digitalRead(PIR_SENSOR_DIGITAL) == HIGH; // Get value of PIR
        if (tripped != lastTrippedState)
        {  
          Serial.println(tripped? "tripped" : "not tripped");
          gw.send(msgPir.set(tripped?"1":"0"));  // Send tripped value to gw//
        }
        lastTrippedState = tripped;
        
        
          
        }
        
      
      /*
       * Sends Ambient Light Sensor information
       * 
       * Parameters
       * - force : Forces transmission of a value
       */
      
      void sendLight(bool force) // Get light level
      {
        if (force) lastLightLevel = -1;
        int lightLevel =  (analogRead(LIGHT_PIN)) / 10.23;
        if (lightLevel != lastLightLevel) {
         gw.send(msgLight.set(lightLevel));
          lastLightLevel = lightLevel;
        }
        Serial.print("Light: ");
        Serial.println(lightLevel);
      }
      
      /*
       * Sends battery information (both voltage, and battery percentage)
       *
       * Parameters
       * - force : Forces transmission of a value
       */
      void sendBattLevel(bool force)
      {
        if (force) lastBattery = -1;
        long vcc = readVcc();
        if (vcc != lastBattery) {
          lastBattery = vcc;
          // Calculate percentage
      
          vcc = vcc - 1900; // subtract 1.9V from vcc, as this is the lowest voltage we will operate at
          
          long percent = vcc / 14.0;
          gw.sendBatteryLevel(percent);
        }
      }
      
      long readVcc() {
        // Read 1.1V reference against AVcc
        // set the reference to Vcc and the measurement to the internal 1.1V reference
        #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
          ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
        #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
          ADMUX = _BV(MUX5) | _BV(MUX0);
        #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
          ADcdMUX = _BV(MUX3) | _BV(MUX2);
        #else
          ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
        #endif  
       
        delay(2); // Wait for Vref to settle
        ADCSRA |= _BV(ADSC); // Start conversion
        while (bit_is_set(ADCSRA,ADSC)); // measuring
       
        uint8_t low  = ADCL; // must read ADCL first - it then locks ADCH  
        uint8_t high = ADCH; // unlocks both
       
        long result = (high<<8) | low;
       
        result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
        return result; // Vcc in millivolts
      }
      
      void switchClock(unsigned char clk)
      {
        cli();
        
        CLKPR = 1<<CLKPCE; // Set CLKPCE to enable clk switching
        CLKPR = clk;  
        sei();
        highfreq = false;
      }
      
      
      // Verify all peripherals, and signal via the LED if any problems.
      void testMode()
      {
        uint8_t rx_buffer[SHA204_RSP_SIZE_MAX];
        uint8_t ret_code;
        byte tests = 0;
        
        digitalWrite(LED_PIN, HIGH); // Turn on LED.
        Serial.println(F(" - TestMode"));
        Serial.println(F("Testing peripherals!"));
        Serial.flush();
        Serial.print(F("-> SI7021 : ")); 
        Serial.flush();
        
        if (humiditySensor.begin()) 
        {
          Serial.println(F("ok!"));
          tests ++;
        }
        else
        {
          Serial.println(F("failed!"));
        }
        Serial.flush();
      
        Serial.print(F("-> Flash : "));
        Serial.flush();
        if (flash.initialize())
        {
          Serial.println(F("ok!"));
          tests ++;
        }
        else
        {
          Serial.println(F("failed!"));
        }
        Serial.flush();
      
        
        Serial.print(F("-> SHA204 : "));
        ret_code = sha204.sha204c_wakeup(rx_buffer);
        Serial.flush();
        if (ret_code != SHA204_SUCCESS)
        {
          Serial.print(F("Failed to wake device. Response: ")); Serial.println(ret_code, HEX);
        }
        Serial.flush();
        if (ret_code == SHA204_SUCCESS)
        {
          ret_code = sha204.getSerialNumber(rx_buffer);
          if (ret_code != SHA204_SUCCESS)
          {
            Serial.print(F("Failed to obtain device serial number. Response: ")); Serial.println(ret_code, HEX);
          }
          else
          {
            Serial.print(F("Ok (serial : "));
            for (int i=0; i<9; i++)
            {
              if (rx_buffer[i] < 0x10)
              {
                Serial.print('0'); // Because Serial.print does not 0-pad HEX
              }
              Serial.print(rx_buffer[i], HEX);
            }
            Serial.println(")");
            tests ++;
          }
      
        }
        Serial.flush();
      
        Serial.println(F("Test finished"));
        
        if (tests == 3) 
        {
          Serial.println(F("Selftest ok!"));
          while (1) // Blink OK pattern!
          {
            digitalWrite(LED_PIN, HIGH);
            delay(200);
            digitalWrite(LED_PIN, LOW);
            delay(200);
          }
        }
        else 
        {
          Serial.println(F("----> Selftest failed!"));
          while (1) // Blink FAILED pattern! Rappidly blinking..
          {
          }
        }  
      }
      
      
      

      Photos of the assembly -
      The parts:
      IMG_20150622_115335.jpg
      The board with radio, resistors and FTDI header:
      IMG_20150622_131215.jpg
      The board connected to the battery and sensors (the sensors were wire-wrapped utilizing the 'whiskers' from the resistors):
      IMG_20150622_151216.jpg
      The finished enclosures (I made a few):
      IMG_20150622_152033.jpg
      IMG_20150622_153431.jpg

      They work pretty well but after a few days I have noticed some peculiarities which I hope the forum could assist with:

      1. The Si7021 is VERY sensitive and as a result, the sensors update every minute or two and have not yet slept more than 2-3 minutes. Is there an easy way to fix this in the code so they only transmit every .3 or .5 degree temperature change?

      2. The Panasonic PIRs I am using do not have trim pots to adjust their 'standby-after-alert' time and return to detecting motion after 2.5 seconds which leads to a lot of radio traffic to the gateway when someone is in the room. I thought about 'detaching' the interrupt after alert and 'reattaching' on the next run thru the loop. The would give it up to 60 seconds of standby which would work for my needs but I do not know exactly how to go about this and if it would cause more problems than solve.

      3. I oriented the headers over the blank part of the board (over the stylish logo). They are on the opposite side of the board from the radio but are located directly in line with the antenna (see photo 2). Is this a bad idea? I have not observed any transmission problems or at least I do not think I have...

      posted in My Project
      Dwalt
      Dwalt
    • RE: Detecting if a persons is laying in his/her bed

      I made a few homemade pressure switches to solve a similar problem with presence detection while watching TV. Occasionally my living room PIR would not sense people if they were very still and lights would turn off when a scene would fire on my controller. I built several pressure switches out of cardboard, aluminum tape, thin foam (for spacers) and scrap phone cable and placed them under seat cushions. I use them as simple binary switches and incorporated this sketch within a multisensor I have under a end table.

      Sorry for the bad photos:
      couch1.jpg

      couch2.jpg

      couch3.jpg

      The wire runs to either side of the switch and is installed between layers of aluminum tape. This tape is made of aluminum and is conductive. I found it at a hardware store, it is used for installing air duct. When someone sits on the cushion, the switch compresses and both sides make contact and trip the arduino. I made a larger one for placing under a door mat to let me know when the dog wanted back in the house. Below is a picture during construction. Foam strips were placed between the rows of alum tape and the two side were stacked together and placed under the door mat. When the dog would sit on the mat, it triggered a 'door/window sensor' in Vera and I had a PLEG condition which flashed a Hue bulb in the living room. It did not last long after getting wet but the dog liked it while it worked.😄

      couch4.jpg

      posted in Hardware
      Dwalt
      Dwalt
    • RE: Sensor for Vallox DigitSE RS485 ventilation system with integration into FHEM.

      @Heinz said:

      BTW finding an appropriate housing for your sensors is not very easy. Housings should be nice and fit into their environment...

      Hiding sensors in plain sight:

      1-IMG_20150210_012436.jpg

      Book2.jpg
      One of my "Book-Sensors":
      1-IMG_20150210_012729.jpg

      posted in My Project
      Dwalt
      Dwalt
    • RE: Mysensors on ESP8266- ESP01?

      @Elfnoir There are a various tutorials for using the Arduino IDE for flashing sketches onto ESP8266 on the internet. I don't remember which I used originally. Firstly, you need to add the ESP8266 to the IDE through the board manager. Secondly, Unlike the Arduino, the ESP needs to be set into bootloader mode to load a sketch. Whereas the Arduino bootloader looks for an incoming upload when the chip is reset (For most boards, the IDE automatically resets the chip when you begin an upload). The ESP needs its GPIO-0 drawn to ground when it is reset to enter bootloader mode so it can be a little trickier to wire up

      I used the development branch of MySensors to create ESP nodes using the GatewayESP8266.ino sketch. I just remove the

      #define MY_RADIO_NRF24
      

      and any bits about inclusion buttons and then add my particular parts to the setup, presentation and loop parts of the sketch depending on my attached sensors. There are more tricky details to the process but it isn't much different than creating a Arduino/nRf sensor node. I agree a tutorial is in order but the process is still evolving that is why it is the "development " branch.

      I use some of the ESP-12, the Huzzah from adafruit and i have several commercial products with imbedded ESP8266 which i reflashed and MySensorized™. I will try this weekend to document a project in detail. Too busy today.

      posted in Hardware
      Dwalt
      Dwalt
    • RE: 💬 jModule

      Ahh, I see now. The side facing pins are mapped as follows:

      0_1457124334179_JMOD PINOUT.jpg

      posted in OpenHardware.io
      Dwalt
      Dwalt
    • RE: Where can I get more information on the project 'Mood Light' ??

      Small world! I made a similar light using a Phillips Hue bulb in the same IKEA lamp.

      I use it for notifications from tasker and Vera.

      posted in My Project
      Dwalt
      Dwalt
    • RE: What's the best PIR sensor?

      @NeverDie said:

      So, at least for an outdoor motion sensor, it might turn out to be a very easy modification requiring little effort.

      Finding a tear down on somebody's blog would certainly help inform the purchase....

      Here is a review of a similar solar light.

      (http://www.ebay.com/itm/12-LED-Solar-Powered-PIR-Motion-Sensor-Light-Outdoor-Garden-Security-Wall-Light-/251959451412?hash=item3aa9f41f14).

      A lot of space inside for arduino, radio and additional sensors. Plus it is made of plastic which is better for radio. So you have a weatherproof housing with solar panel, battery, charging circuit and PIR already built in.

      posted in Hardware
      Dwalt
      Dwalt
    • RE: Looooong range wireless...

      Here is an antenna mod which get 1km+ range from the nrf24.

      posted in General Discussion
      Dwalt
      Dwalt
    • RE: Remote Panel

      @pete1450 Something like this?. http://forum.mysensors.org/topic/2413/ir-record-and-playback-module

      posted in Vera
      Dwalt
      Dwalt

    Latest posts made by Dwalt

    • RE: HA not receiving data passed through non-registered repeaters

      @martinhjelmare

      Thank you for responding to this. I finally had time to look at the HA log and found a number of other issues. I think I had a conflict with HA Bridge (originally setup to work with Vera) so I shut down that device but I am still seeing errors in the HA log but cannot identify the source.

      Here is the current home-assistant.log output:

      17-02-17 15:56:56 homeassistant.core: Error doing job: Future exception was never retrieved
      Traceback (most recent call last):
        File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
          result = self.fn(*self.args, **self.kwargs)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/notify/__init__.py", line 149, in platform_discovered
          setup_notify_platform(platform, discovery_info=info)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/notify/__init__.py", line 89, in setup_notify_platform
          hass, p_config, discovery_info)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/notify/mysensors.py", line 25, in get_service
          pres.S_INFO: [set_req.V_TEXT],
        File "/usr/lib/python3.4/enum.py", line 255, in __getattr__
          raise AttributeError(name) from None
      AttributeError: V_TEXT
      17-02-17 15:57:25 homeassistant.core: Error doing job: Task exception was never retrieved
      Traceback (most recent call last):
        File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
          result = coro.throw(exc)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 387, in _update_entity_states
          yield from update_coro
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 216, in async_update_ha_state
          yield from self.hass.loop.run_in_executor(None, self.update)
        File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
          yield self  # This tells Task to wait for completion.
        File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
          value = future.result()
        File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
          raise self._exception
        File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
          result = self.fn(*self.args, **self.kwargs)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/hue.py", line 397, in update
          self.update_lights(no_throttle=True)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
          result = method(*args, **kwargs)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
          result = method(*args, **kwargs)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/hue.py", line 207, in update_lights
          lightgroups[lightgroup_id].schedule_update_ha_state()
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 290, in schedule_update_ha_state
          self.hass.add_job(self.async_update_ha_state(force_refresh))
      AttributeError: 'NoneType' object has no attribute 'add_job'
      17-02-17 15:57:56 homeassistant.core: Error doing job: Task exception was never retrieved
      Traceback (most recent call last):
        File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
          result = coro.throw(exc)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 387, in _update_entity_states
          yield from update_coro
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 216, in async_update_ha_state
          yield from self.hass.loop.run_in_executor(None, self.update)
        File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
          yield self  # This tells Task to wait for completion.
        File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
          value = future.result()
        File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
          raise self._exception
        File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
          result = self.fn(*self.args, **self.kwargs)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/hue.py", line 397, in update
          self.update_lights(no_throttle=True)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
          result = method(*args, **kwargs)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
          result = method(*args, **kwargs)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/hue.py", line 207, in update_lights
          lightgroups[lightgroup_id].schedule_update_ha_state()
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 290, in schedule_update_ha_state
          self.hass.add_job(self.async_update_ha_state(force_refresh))
      AttributeError: 'NoneType' object has no attribute 'add_job'
      17-02-17 15:58:27 homeassistant.core: Error doing job: Task exception was never retrieved
      Traceback (most recent call last):
        File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
          result = coro.throw(exc)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 387, in _update_entity_states
          yield from update_coro
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 216, in async_update_ha_state
          yield from self.hass.loop.run_in_executor(None, self.update)
        File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
          yield self  # This tells Task to wait for completion.
        File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
          value = future.result()
        File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
          raise self._exception
        File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
          result = self.fn(*self.args, **self.kwargs)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/hue.py", line 397, in update
          self.update_lights(no_throttle=True)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
          result = method(*args, **kwargs)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
          result = method(*args, **kwargs)
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/hue.py", line 207, in update_lights
          lightgroups[lightgroup_id].schedule_update_ha_state()
        File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 290, in schedule_update_ha_state
          self.hass.add_job(self.async_update_ha_state(force_refresh))
      AttributeError: 'NoneType' object has no attribute 'add_job'
      

      The second error repeats every 31 seconds. If you know of any solutions for these errors, I would appreciate any help.

      As for the issue with MySensors nodes, I was wrong about the repeaters in that they are not the source of my problems, I think my GW is causing HA to lock up the MySensors component of HA. Whenever a node is restarted, repeater or non-repeater, my GW restarts (see below) and for some reason this freezes the MyS component in HA. I never noticed it before with Vera because these restarts doesn't appear to affect the stability of Vera plugin.

      This is from MYSController logging GW traffic:

      [2017-02-17 16:04:39.953 Info] RX	4;1;1;0;0;74.6
       [2017-02-17 16:04:40.041 Info] RX	4;2;1;0;1;29
       [2017-02-17 16:05:21.964 Info] RX	2;1;1;0;0;74.9
       [2017-02-17 16:05:38.689 Info] RX	2;1;1;0;0;74.8
       [2017-02-17 16:05:43.434 Info] RX	4;1;1;0;0;74.6
       [2017-02-17 16:05:43.534 Info] RX	4;2;1;0;1;29
       [2017-02-17 16:06:23.535 Info] RX	2;2;1;0;16;1
       [2017-02-17 16:06:24.462 Info] RX	2;1;1;0;0;74.9
       [2017-02-17 16:06:27.717 Info] RX	7;3;1;0;16;1
       [2017-02-17 16:06:41.173 Info] RX	2;1;1;0;0;74.8
       [2017-02-17 16:06:46.863 Info] RX	4;255;3;0;0;69
       [2017-02-17 16:06:47.032 Info] RX	4;1;1;0;0;74.6
       [2017-02-17 16:06:47.147 Info] RX	4;2;1;0;1;29
       [2017-02-17 16:06:53.637 Info] RX	2;2;1;0;16;0
       [2017-02-17 16:06:55.238 Info] CHILD	New child discovered, node id=6, child id=internal
       [2017-02-17 16:06:55.269 Info] RX	6;255;3;0;0;96
       [2017-02-17 16:06:57.727 Info] RX	6;3;1;0;16;1
       [2017-02-17 16:06:58.478 Info] RX	7;4;1;0;23;4
       [2017-02-17 16:06:58.493 Info] RX	7;3;1;0;16;0
       [2017-02-17 16:07:01.595 Info] DEBUG	Update child id=255, type=ARDUINO_NODE
       [2017-02-17 16:07:01.632 Info] RX	5;255;0;0;17;1.4
       [2017-02-17 16:07:01.632 Info] TX	5;255;3;0;6;
       [2017-02-17 16:07:01.663 Info] RX	5;255;3;0;6;0
       [2017-02-17 16:07:01.670 Info] RX	0;0;3;0;14;Gateway startup complete.
       [2017-02-17 16:07:02.682 Info] RX	0;0;3;0;14;Gateway startup complete.
       [2017-02-17 16:07:03.617 Info] DEBUG	Update child id=0, type=DIMMER
       [2017-02-17 16:07:03.655 Info] RX	5;0;0;0;4;1.4
       [2017-02-17 16:07:03.655 Info] RX	5;255;3;0;11;DimmableLED
       [2017-02-17 16:07:03.671 Info] RX	5;255;3;0;12;1.1
       [2017-02-17 16:07:03.702 Info] RX	5;0;2;0;3;1.1
       [2017-02-17 16:07:13.318 Info] RX	2;2;1;0;16;1
       [2017-02-17 16:07:14.272 Info] RX	2;1;1;0;0;74.9
       [2017-02-17 16:07:17.043 Info] RX	7;3;1;0;16;1
       [2017-02-17 16:07:29.377 Info] RX	6;3;1;0;16;0
       [2017-02-17 16:07:43.381 Info] RX	2;2;1;0;16;0
       [2017-02-17 16:07:47.838 Info] RX	7;3;1;0;16;0
      

      At 16:06:55, node 6 sent battery info for the first time and this did not upset the MYS component. At 16:07:01, I powered up a repeater node (node 5), it starts to present itself (sketch info, etc) and then suddenly it throws "0;0;3;0;14;Gateway startup complete", which I interpret as the GW resetting or re-initializing?!? This is also when HA stops updating MYS data, regardless of whether I restart a repeater node or normal node.

      My GW is somewhat inaccessible for direct serial connection so I have been monitoring it with MYSController which shows message traffic but not verbose debug info. I will try this weekend to hook up serial directly. To reestablish MySensors updating in HA, I have to restart HA. The repeaters are all actuators and do not transmit an initial state value to HA and thus are not discovered and never show up in HA. I assume I need to update their sketches for them to work with HA.

      Any thoughts on this problem? My gateway is MYS 1.4 (or 1.4.1) and MYS 2.0 may be more stable so perhaps it is time to upgrade. The GW has been working undisturbed for over two years with zero issues before this.

      posted in Home Assistant
      Dwalt
      Dwalt
    • HA not receiving data passed through non-registered repeaters

      I am on the process of migrating from Vera to HA and have encountered problems with data sent from HA recognized (not sure of the proper term) sensors to the GW through repeaters. If the data is sent directly to my ethernet gateway, HA updates the sensors appropriately. If the data is routed through one of my repeating nodes (which are not yet recognized by HA, more on this below), HA does not update the sensor. I can verify that the data is arriving at the GW by MYSController (and Vera still updates the sensor). If I power down my repeaters, the sensors send the messages directly to the GW and HA resumes updating the sensors.

      Most of my nodes are still on MyS 1.4 and many of the repeaters are installed in hard to reach areas (e.g. inside of walls) so updating their sketches is difficult. To properly present these repeaters (which are all mains powered actuators) to HA, apparently an initial-state message needs to be sent at presentation for HA to recognize them and that would require updating their sketches (~Catch 22).

      Has anyone encountered anything similar with HA and MyS repeaters? I am trying to decide on path forward...

      posted in Home Assistant
      Dwalt
      Dwalt
    • RE: Dallas Temperature Sensor on MySensors 2.0 - Temperature Value not showed in Vera Controller

      @pndgt0

      Post your sketch using the </> tool.

      posted in Troubleshooting
      Dwalt
      Dwalt
    • RE: Sensebender micro as serial gateway: transmit data?

      @nsom67

      Yes, that is the serialGW sketch. In the development branch, the setup and loop are blank because everything is handled by the libraries in the background. To make a serialGW with sensors, you add the sensor specific code from the applicable sensor sketch to the defines, setup, presentation and loop sections of the GW sketch. In your case, you can even comment out the rf24 bits of the GW sketch and not attach the radio as you don't have anything for the gw to talk to.

      Upload the modified sketch and connect by serial adapter to your controller and test it out. Personally, I would wait and use a nano as a serial gateway and stick with the master branch until you get comfortable with MySensors.

      posted in Troubleshooting
      Dwalt
      Dwalt
    • RE: Sensebender micro as serial gateway: transmit data?

      @nsom67

      Are you interested in using a sensebender as a serial gateway or just interested in adding temp and humidity sensors to your gateway? The latter option is possible under the development branch by adding the coding bits regarding the temp/hum sensor to the Serial GW sketch. I would recommend against, however, as it could interfere with the gateway's primary function (e.g. missing messages) while processing sensor routines.

      The sensebender was designed for battery operation and it's use as a powered gateway would nullify the design innovations and would most likely require additional power regulation for stable operation. The only benefit, as I can see, would be the built-in ATSHA204 for security.

      posted in Troubleshooting
      Dwalt
      Dwalt
    • RE: Figaro TGS5042 Carbon Monoxide Sensor & Op Amp

      @Samuel235 said:

      ...does this count as the conductive mat

      Conductive foam is impregnated with carbon and is generally black in color and denser than styrofoam. The pink foam common in packaging is 'anti-static' but not conductive. Methinks that is simple packaging styrofoam. As a side note, conductive foam is very useful for making pressure sensors, never throw it away.

      posted in Hardware
      Dwalt
      Dwalt
    • RE: Node does not present sketch info?

      @Mark-Swift

      What version of MySensors are you using? You are using the development branch syntax:

      sendSketchInfo("MowerGarage", "1.8");

      instead of the traditional:

      gw.sendSketchInfo("MowerGarage", "1.8");

      but do not use the development ordering of:

      void setup()
      void presentation()
      void loop()

      posted in Troubleshooting
      Dwalt
      Dwalt
    • RE: Homini Complete Room Sensor Module?

      @Samuel235 Did you source a breakout version of the OPT3001? It is hard to find.

      posted in Hardware
      Dwalt
      Dwalt
    • RE: How do I connect/code to use a flex sensor?

      @Cliff-Karlsson

      No sure on the button force sensors, I have not used them.

      To test the force sensors under a mattress, I would wire them up to an Arduino with a sketch that simple reads the analog pin and serial prints the result. Place the sensor under the mattress and see what the serial monitor readings are when the bed is unoccupied and occupied. This would give you the unique range for you particular need. Might be tricky if your computer and bed are in different rooms. After you have the range, you could write a sketch with S_BINARY to trigger V_STATUS whenever the reading approached the high end of your tested range.

      If you cannot reach you bed while connected to serial, you could write a sample mySensors sketch to send the analog reading every few seconds to your controller as V_LEVEL. This video helps explain how to wire up the sensor and select the static resistor for the voltage divider. video

      posted in Troubleshooting
      Dwalt
      Dwalt
    • RE: How do I connect/code to use a flex sensor?

      @Cliff-Karlsson

      It might be easier if you explained your intended application.

      The code can be written to read the sensors continuously and only send when a significant change is detected, or it can read the sensors on a time interval and send the value as a percentage or custom value. If you want to continuously read the value at your controller, you will flood your wireless network with messages.

      I would suggest first hooking the sensor up to a Arduino and read the analog values of your sensor through the serial monitor to see what range and fluctuation your application generates.

      posted in Troubleshooting
      Dwalt
      Dwalt