Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
Flor SandersF

Flor Sanders

@Flor Sanders
About
Posts
10
Topics
1
Shares
0
Groups
0
Followers
1
Following
0

Posts

Recent Best Controversial

  • 💬 Building a Raspberry Pi Gateway
    Flor SandersF Flor Sanders

    @marceloaqno
    How so?
    I've tried running the command you've supplied, but it doesn't work... Do I have to install mosquitto?
    I didn't see it anywhere in the guide.
    Everything is working at the moment, you think it can pose a problem later?

    Announcements

  • 💬 Building a Raspberry Pi Gateway
    Flor SandersF Flor Sanders

    @Tigroenot
    That fixed it indeed XD
    Thanks for helping me out

    Announcements

  • 💬 Building a Raspberry Pi Gateway
    Flor SandersF Flor Sanders

    I got the previous problem out of the way for now...
    Now onto the next one.

    I started a node and now I can clearly see data being sent and received on my serial log and ssh. (See picture)
    0_1482941358792_upload-08fe5f75-3536-4fb5-a0f4-2ee7d0edbc6a

    So I tried adding the gateway to domoticz using following settings:
    0_1482941417649_upload-ce92a80a-a5aa-4713-bfe8-227c71b8ce72

    Yet if I check hardware setup I can see no nodes being presented.
    0_1482941455435_upload-e36e2fbf-ac80-4381-895d-293e6e638ead

    Are there settings or steps I missed?
    Greetings
    Flor

    Announcements

  • 💬 Building a Raspberry Pi Gateway
    Flor SandersF Flor Sanders

    Hello
    The past two days I've been trying to setup the gateway on my RPi 2 with domoticz.
    Here's what I did.
    I installed domoticz onto my raspi, then I tried the install the gateway.

    git clone https://github.com/mysensors/MySensors.git
    cd MySensors
    

    Afterwards I did the following

    ./configure --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1
    
    make
    
    sudo ./bin/mysgw -d
    

    Then it seems to start normally onto the point where it refuses to connect to anything.
    Does anyone have a clue what's going wrong?
    I can't seem to figure it out. I've tried it several times over, and always go similar results.
    I was using GertSanders's connector for the RPi Hub and I've tried it with normal wiring too.
    As far as I can see it shouldn't be a wiring problem...

    0_1482936624899_upload-edfa86af-fd0c-4e63-be7b-5393e20f27eb

    EDIT:
    !UPDATE!
    I think I just fixed it. I reconfigured it to include the IRQ Pin and now it's just listening for throughput

    pi@raspberrypi:~/MySensors $  sudo ./bin/mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.1.0-beta
    mysgw: MCO:BGN:INIT GW,CP=RNNG--Q,VER=2.1.0-beta
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: TSM:INIT:TSP OK
    mysgw: TSM:INIT:GW MODE
    mysgw: TSM:READY:ID=0,PAR=0,DIS=0
    mysgw: MCO:REG:NOT NEEDED
    mysgw: Listening for connections on 0.0.0.0:5003
    mysgw: MCO:BGN:STP
    mysgw: MCO:BGN:INIT OK,TSP=1
    
    Announcements

  • LDR as light sensor
    Flor SandersF Flor Sanders

    @GertSanders
    Then I'll temporaraly switch over to a serial gateway.
    Thanks again for the info!

    Troubleshooting build ldr no data light senors

  • LDR as light sensor
    Flor SandersF Flor Sanders

    @GertSanders
    So I just succesfully updated the code to library 2.0.0
    Yet, now nothing shows up in domoticz. Do I also need to update something to the raspberry pi 2 (which is acting as the gateway).
    Since the serial gateway is stating to be succesfully sending information.

    New code:

    /**
     * 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
     * Example sketch showing how to measue light level using a LM393 photo-resistor 
     * http://www.mysensors.org/build/light
     */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    //Including nescessary libraries
    #include <SPI.h>
    #include <MySensors.h> 
    #include <DHT.h>  
    
    
    //Defining child ID's and sensor pins
    #define LIGHTLEVEL 0
    #define HUMIDITY 1
    #define TEMPERATURE 2
    #define HUMIDITY_SENSOR_DIGITAL_PIN 3
    #define LIGHT_SENSOR_ANALOG_PIN A0
    DHT dht;
    
    //Defining values to store sensor information
    int LightLevel = 0;
    float lastTemp;
    float lastHum;
    boolean metric = true; 
    int lastLightLevel;
    
    //Defining sleep and wait times
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)(30 seconds)
    #define MESSAGEWAIT 500
    
    MyMessage LightMsg(LIGHTLEVEL, V_LIGHT_LEVEL);
    MyMessage msgHum(HUMIDITY, V_HUM);
    MyMessage msgTemp(TEMPERATURE, V_TEMP);
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Room Flor 1", "2.0");
      wait(MESSAGEWAIT);
    
      // Register all sensors to gateway (they will be created as child devices)
      present(LIGHTLEVEL, S_LIGHT_LEVEL);
      wait(MESSAGEWAIT);
      present(HUMIDITY, S_HUM);
      wait(MESSAGEWAIT);
      present(TEMPERATURE, S_TEMP);
    }
    
    void setup() {
       dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
    }
    
    void loop() {
      delay(dht.getMinimumSamplingPeriod());
      
      float temperature = dht.getTemperature();
      if (isnan(temperature)) {
          Serial.println("Failed reading temperature from DHT");
      } else if (temperature != lastTemp) {
        lastTemp = temperature;
        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;
          send(msgHum.set(humidity, 1));
          Serial.print("H: ");
          Serial.println(humidity);
      }
    
      
      int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; 
      Serial.println(lightLevel);
      if (lightLevel != lastLightLevel) {
          send(LightMsg.set(lightLevel));
          lastLightLevel = lightLevel;
      }
      sleep(SLEEP_TIME);
    }
    
    
    
    Troubleshooting build ldr no data light senors

  • LDR as light sensor
    Flor SandersF Flor Sanders

    @GertSanders
    Oh right! Guessed I missed that while copying and pasting everything.
    I just remarked there was a v2.0 while writing the sketch... Might rewrite it while I'm busy :-)

    Troubleshooting build ldr no data light senors

  • LDR as light sensor
    Flor SandersF Flor Sanders

    @GertSanders
    Okay
    So after editing your code to work on the slightly older mysensors library I still have installed, all seems to work!
    Thanks a lot for your help!

    Screenshots:

    New code:

    /**
     * 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
     */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    
    #include <SPI.h>
    #include <MySensor.h>  
    #include <DHT.h>  
    
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define CHILD_ID_LIGHT 2
    
    #define LIGHTLEVEL 1
    #define ledpin 13
    #define LIGHT_SENSOR_ANALOG_PIN A0
    #define HUMIDITY_SENSOR_DIGITAL_PIN 4
    #define MESSAGEWAIT 500
    #define SENDRETRIES 5
    
    int LightLevel = 0;
    int PreviousLightLevel = 0;
    boolean BatOK = false;
    boolean LightOK = false;
    
    unsigned long SLEEP_TIME = 10000; // 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 LightMsg(LIGHTLEVEL, V_LIGHT_LEVEL);
    
    
    
    void setup()  
    { 
      gw.begin();
      dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
    
      
    
      // Send the Sketch Version Information to the Gateway
      gw.sendSketchInfo("Room Flor 1", "1.0");
      // 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(LIGHTLEVEL, S_LIGHT_LEVEL);
    
      pinMode(ledpin, OUTPUT);
      pinMode(LIGHT_SENSOR_ANALOG_PIN, INPUT_PULLUP);
    
      LightLevel = (1023 - analogRead(LIGHT_SENSOR_ANALOG_PIN)) / 10.23;
      LightOK = false;
      PreviousLightLevel = 0;
      
      metric = gw.getConfig().isMetric;
    }
    
    void loop()      
    {  
      delay(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);
      }
    
    
      if (!LightOK)
      {
        if (LightLevel != PreviousLightLevel)
        {
          LightOK = gw.send(LightMsg.set(LightLevel));
          if (LightOK)
          {
            PreviousLightLevel = LightLevel;
          }
        }
        else
        {
          LightOK = true;
        }
      }
    
      
      gw.sleep(SLEEP_TIME); //sleep a bit
    }
    
    
    void blipled()
    {
      gw.sleep(100);              // wait for a second
      digitalWrite(ledpin, HIGH);   // turn the LED on (HIGH is the voltage level)
      gw.sleep(50);              // wait for a second
      digitalWrite(ledpin, LOW);    // turn the LED off by making the voltage HIGH
    }
    
    Troubleshooting build ldr no data light senors

  • LDR as light sensor
    Flor SandersF Flor Sanders

    @GertSanders Thank you!

    So, you are basically sending a light intensity value between 0 and 100 to domoticz.
    I'm going to leave the battery part out because my sensor is installed near a power outlet, and I can just use power from an adapter.
    I'm testing it now, and reporting back with my results!

    Troubleshooting build ldr no data light senors

  • LDR as light sensor
    Flor SandersF Flor Sanders

    Hello

    Since I'm a student and the holidays have begun, I finally have time to convert my purchases online into a domotic system.
    I succesfully set up my raspi 2 with domoticz and started working on my very first sensor.
    Now in the "build section" at light, there are true light sensors used, but I only needed an estimated value on which I can base actions.
    So my idea was to use an LDR and some calculations to convert the analog input to a luxish value.
    Now... I've edited the "light" sketch from the build section to send the value I calculated, but when I look in domoticz, at "Hardware setup", it seems like this child is sending no values. (screenshot below).
    And when I go to "setup devices", this sensor doesn't even show up. (screenshot below)

    Can anyone check my code and say what I've done wrong. I'll also add a picture of my breadboard in a moment. Don't know whether that'll be clear though.

    Screenshots:
    Setup Hardware
    Setup devices

    Breadboard:
    Setup

    My code:

    #include <SPI.h>
    #include <MySensor.h>  
    #include <DHT.h>  
    
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define CHILD_ID_LIGHT 2
    
    #define LIGHT_SENSOR_ANALOG_PIN 0
    #define HUMIDITY_SENSOR_DIGITAL_PIN 4
    unsigned long SLEEP_TIME = 10000; // Sleep time between reads (in milliseconds)
    MySensor gw;
    
    DHT dht;
    float lastTemp;
    float lastHum;
    int lastLightLevel;
    boolean metric = true; 
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    MyMessage msgLux(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
    
    
    
    void setup()  
    { 
      gw.begin();
      dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
    
      
    
      // Send the Sketch Version Information to the Gateway
      gw.sendSketchInfo("Room Flor 1", "1.0");
    
      // 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_LIGHT, S_LIGHT_LEVEL);
    
      metric = gw.getConfig().isMetric;
    }
    
    void loop()      
    {  
      delay(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);
      }
    
      int lightLevel = (2500/((analogRead(LIGHT_SENSOR_ANALOG_PIN)*0.0048828125)-500))/10; 
      Serial.println(lightLevel);
      if (lightLevel != lastLightLevel) {
          gw.send(msgLux.set(lightLevel));
          lastLightLevel = lightLevel;
      }
    
    
      
      gw.sleep(SLEEP_TIME); //sleep a bit
    }```
    Troubleshooting build ldr no data light senors
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular