Navigation

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

    BastienVH

    @BastienVH

    3
    Reputation
    38
    Posts
    955
    Profile views
    1
    Followers
    0
    Following
    Joined Last Online

    BastienVH Follow

    Best posts made by BastienVH

    • RE: Error using Home Assistant with a serial gateway

      Hi Martin,

      @martinhjelmare
      I've been trying the last couple of days to get it working, but to no avail...

      I stell get errors like

      ValueError: need more than 1 value to unpack
      

      The number can change though.
      I've tried your suggestions, updated and rebooted the pi but still no luck.
      Uninstalled and reinstalled home assistant but that also didn't help.

      Any other things I could try?

      posted in Home Assistant
      BastienVH
      BastienVH
    • RE: ๐Ÿ’ฌ Easy/Newbie PCB for MySensors

      I just received my order from Dirtypcbs. The protopack I ordered had 11 boards, so that's nice.
      They took 10 days to arrive in Belgium.
      From first glance, it looks like they's work, but I'll have to test it this weekend to be sure.
      Here's a picture.
      0_1453379527295_DSC06500.jpg

      posted in OpenHardware.io
      BastienVH
      BastienVH
    • RE: Can't get motion interrupt to work in my (combined temp, battery and motion) sketch

      @martinhjelmare
      Great, thanks.

      The sketch now works as it should.
      Below is the finished sketch.
      I also added a counter so that after 10 consecutive interrupts from the motion sensor, the temp and hum get read and transmited. (motion-on generates an interrupt and motion-off generates an interrupt, so it's actually 5 motion triggers)
      Otherwise if there is a lot of movement during a certain timeframe (mornings), hum and temp won't be measured.

      Later I will edit the sketch to have all transmits together to save more battery power.

      Here's the sketch:

      /**
       * 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
       * This sketch provides an example how to implement a humidity/temperature
       * sensor using DHT11/DHT-22
       * http://www.mysensors.org/build/humidity
       */
      
      #include <SPI.h>
      #include <MySensor.h>
      #include <DHT.h>
      
      #define DIGITAL_INPUT_MOTION 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define INTERRUPT DIGITAL_INPUT_MOTION-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_MOT 2
      #define HUMIDITY_SENSOR_DIGITAL_PIN 4
      unsigned long SLEEP_TIME = 150000; // Sleep time between reads (in milliseconds)
      
      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);
      int node_id = 20;
      boolean lastTripped = false ;
      int wake = 0;
      int motionCount = 0;
      
      void setup()
      {
        gw.begin();
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
      
        // Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo("Humidity and motion", "1.1");
      
        pinMode(DIGITAL_INPUT_MOTION, 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()
      {
        Serial.println(wake);
        if (wake == 1 && motionCount <= 10) {
          Serial.println("wake by motion");
          Serial.println("reading motion");
          motion();
          motionCount = motionCount + 1;
          Serial.println(motionCount);
        }
        else {
          Serial.println("wake by timer");
          Serial.println("reading motion");
          motion();
          Serial.println("reading temp/hum");
          humTemp();
          motionCount = 0;
          Serial.println("motionCount is reset");
        }
        Serial.println("going to sleep now.");
        wake = gw.sleep(INTERRUPT, CHANGE, SLEEP_TIME);
      }
      
      void motion() {
        // Read digital motion value
        boolean tripped = digitalRead(DIGITAL_INPUT_MOTION);
        Serial.println(tripped);
        if (lastTripped != tripped) {
          gw.send(msgMot.set(tripped ? "1" : "0")); // Send tripped value to gw
          lastTripped = tripped;
        }
      }
      
      void humTemp() {
        gw.wait(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);
        }
      }
      
      posted in Troubleshooting
      BastienVH
      BastienVH

    Latest posts made by BastienVH

    • RE: Easy/Newbie PCB for MySensors

      @sundberg84
      About D2: you mean I shouldn't solder the IRQ of the radio to the board?
      I will try that next time.

      I've been testing the PIR with a nano and the 3.3V it supplies and that works fine.
      If I take VCC or ground (or both) from the board with booster, the PIR starts acting up.
      I guess I'll have to try some more if I want to get to the bottom of things.

      posted in Hardware
      BastienVH
      BastienVH
    • RE: Easy/Newbie PCB for MySensors

      @sundberg84
      Hey, I've been having a bit of trouble lately.
      I've been trying to setup a node with your board which supports a PIR and a temp sensor (ds18b20).
      Since there is a spot for a resistor on D3 on your board, I attached the temp sensor to that pin.
      The PIR needs a pin that supports interrupts, so I connected that to D2.
      Here is where the confusion starts.
      If I read this page correctly, D2 is already in use for the radio.
      I only checked it after I soldered everything together and found out my PIR doesn't work (it always sends a 1-signal).

      Any thoughts on this?
      Is D2 really free for use on the board?

      Thanks!

      posted in Hardware
      BastienVH
      BastienVH
    • RE: ๐Ÿ’ฌ Easy/Newbie PCB for MySensors

      @sundberg84 said:

      If you use the FTDI connector, make sure its the 3.3v and connect it to Gnd/Pwr on the PCB and not Arduino FDTI connector.
      You could just exclude those pins and connect a battery directly and use that as power and the FDTI as programmer/serial debug only

      Bat or Reg is nessecary!
      See this picture for battery use: https://www.openhardware.io/view/4/EasyNewbie-PCB-for-MySensors
      https://www.openhardware.io/uploads/568ed84b60aa3f8965fbf095/image/3.jpg
      All components in the image is needed (except battery measurment).
      If you dont want to use booster you need to bypass that one with a wire/jumper (or set the jumper on REG instead of BAT but that kills the logic).

      The battery doesnt "need" the 0,1uF but see here:https://www.mysensors.org/build/battery
      "The tap point could be bypassed with a 0.1 uF capacitor to keep the noise level low, at this otherwise high impedance point. "

      posted in OpenHardware.io
      BastienVH
      BastienVH
    • RE: openHAB binding

      After reinstalling OpenHAB, the binding works fine, thank you!
      Just a question, don't know if you can help.

      I mapped my serial gateway to /dev/MSgw because ttyUSBx tends to change when unplugging / replugging multiple USB devices into the computer (raspberry pi in my case).
      I've also got a 433MHz gateway attached and when debugging have to unplug it sometimes.
      When trying to start OpenHAB with /dev/MSgw as gateway address I get this:

      2016-02-14 10:58:33.418 [DEBUG] [.b.m.internal.MySensorsBinding] - activate
      RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyUSB1
      2016-02-14 10:58:34.048 [ERROR] [.o.b.m.internal.gateway.Serial] - Unable to find Serial port '/dev/MSgw'
      

      Do you know how/if I can still you my own custom paths to the gateway?
      Now I changed it to ttyUSB1, but that port might change after rebooting.

      posted in OpenHAB
      BastienVH
      BastienVH
    • RE: openHAB binding

      @bkl
      Thanks for your response.
      After adding the line of code to the logback, my debug output remains the same.
      No message that new items have been added based on the configuration, nor parse-errors.

      It's just the same as before: the messages are received, but not interpreted correctly, just the raw data like below:
      2016-02-13 15:05:55.551 [INFO ] [.b.m.internal.MySensorsBinding] - Unknown: MySensors message: node-id=20, child-sensor-id=0, message-type=set, ack=false, sub-type=V_HUM, payload=48.0

      I will start over again from scratch tomorrow, reinstall openhab and your binding to see if it helped.

      posted in OpenHAB
      BastienVH
      BastienVH
    • RE: openHAB binding

      Hi,

      I've tried out you binding on OpenHAB 1.8.1.
      It appears OpenHAB can connect to my serial gateway and receives the messages from my node, but doesn't know what to do with it.

      This is en excerpt of my log:

      2016-02-13 15:05:52.548 [INFO ] [.b.m.internal.MySensorsBinding] - New MySensor node found: node-id=20
       * Example item: 20;255;I_BATTERY_LEVEL      - Use this to report the battery level 0-100 (%)
       * Example item: 20;255;I_SKETCH_NAME        - Sketch name that can be used to identify sensor
       * Example item: 20;255;I_SKETCH_VERSION     - Sketch version that can be reported to keep track of the version of sensor
      2016-02-13 15:05:54.479 [INFO ] [.b.m.internal.MySensorsBinding] - Unknown: MySensors message: node-id=20, child-sensor-id=255, message-type=internal, ack=false, sub-type=I_SKETCH_NAME, payload=Temp/Hum/Motion
      2016-02-13 15:05:54.486 [INFO ] [.b.m.internal.MySensorsBinding] - Unknown: MySensors message: node-id=20, child-sensor-id=255, message-type=internal, ack=false, sub-type=I_SKETCH_VERSION, payload=1.0
      2016-02-13 15:05:54.498 [INFO ] [.b.m.internal.MySensorsBinding] - New MySensor sensor found (Humidity sensor): node-id=20, sensor-id=0 with type S_HUM
       * Example item: 20;0;V_HUM                - Humidity
      2016-02-13 15:05:54.521 [INFO ] [.b.m.internal.MySensorsBinding] - New MySensor sensor found (Temperature sensor): node-id=20, sensor-id=1 with type S_TEMP
       * Example item: 20;1;V_TEMP               - Temperature
       * Example item: 20;1;V_ID                 - Optional unique sensor id (e.g. OneWire DS1820b ids)
      2016-02-13 15:05:54.545 [INFO ] [.b.m.internal.MySensorsBinding] - New MySensor sensor found (Motion sensor): node-id=20, sensor-id=2 with type S_MOTION
       * Example item: 20;2;V_TRIPPED            - Tripped status of a security sensor. (Tripped/Untripped)
       * Example item: 20;2;V_ARMED              - Armed status of a security sensor. (Armed/Bypassed)
      2016-02-13 15:05:54.567 [INFO ] [.b.m.internal.MySensorsBinding] - Unknown: MySensors message: node-id=20, child-sensor-id=2, message-type=set, ack=false, sub-type=V_TRIPPED, payload=1
      2016-02-13 15:05:55.537 [INFO ] [.b.m.internal.MySensorsBinding] - Unknown: MySensors message: node-id=20, child-sensor-id=1, message-type=set, ack=false, sub-type=V_TEMP, payload=19.0
      2016-02-13 15:05:55.551 [INFO ] [.b.m.internal.MySensorsBinding] - Unknown: MySensors message: node-id=20, child-sensor-id=0, message-type=set, ack=false, sub-type=V_HUM, payload=48.0
      

      All the sensors get declared and recognized as their type, but the messages are not being interpreted correctly.

      This is my .items-file:

      Number Humidity "Livingsensor [%s %%Rh]" <water> (GF_Living) {mysensors="20;0;V_HUM"}
      Number Temperature "Livingsensor [%s ยฐC]" <temperature> (GF_Living) {mysensors="20;1;V_TEMP"}
      Switch Motion "Livingsensor [%s]" <motion> (GF_Living) {mysensors="20;2;V_TRIPPED"}
      

      And the sitemap (which of course doesn't update anything yet):

      sitemap default label="Main Menu"
      {
      	Frame label="Systeem"{
      	Group item=System	label="Systeeminfo"	icon="computer" {
      				Text	item=uptime	icon="computer"
      				Text	item=Raspi_CPU	icon="computer"
      				Switch	item=wakingup
      	}
      	}
      	Frame label="MySensors" {
      	Switch item=Motion
      	Text item=Humidity
      	Text item=Temperature
      }
      }
      

      It's been a while since I used OpenHAB and went looking for something more lightweight that had better integration for MySensors, but with your binding, I could revert to include everything I've built for OpenHAB in the past.

      Thanks for your initial work and I hope you can help me out.

      posted in OpenHAB
      BastienVH
      BastienVH
    • RE: ๐Ÿ’ฌ Easy/Newbie PCB for MySensors

      @sundberg84
      When I get the caps, I'll place them on the board.
      I did notice alot of noise when I was reading battery state on a breadboard in an earlier build, so I will get that sorted.
      Only problem is I can't find them locally, so have to get them from China.
      Will take a while...

      posted in OpenHardware.io
      BastienVH
      BastienVH
    • RE: ๐Ÿ’ฌ Easy/Newbie PCB for MySensors

      @BastienVH
      Replying to myself to follow up on my assembly-issues.
      I have been able to get the board to work.
      I don't have my 0.1ยตF caps yet, so I just put a little blob of solder in the holes so the current could run through.
      Now I've got myself 2 working board. I just have to find a good way to attach my PIR, dallas temp, ... to them.

      Thanks for the work and help!

      posted in OpenHardware.io
      BastienVH
      BastienVH
    • RE: Buttons that send different signals to the same sensor

      @mwild95
      Could you share your sketch?
      I'm planning to mysensor-ize my 433 wall plugs and it might be a good starting point ๐Ÿ™‚

      posted in MyController.org
      BastienVH
      BastienVH