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
parachutesjP

parachutesj

@parachutesj
About
Posts
155
Topics
16
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Mysensorized Roomba
    parachutesjP parachutesj

    Hi,
    just wanted to share my POC:
    We're having a cleaning robot since years. It has built in scheduler and cleans based on that no matter if anyone is home or not.
    I wanted to change that; I do have the status of precence in OpenHAB.
    I have just created a simple mySensor node (based on a light switch) which sends 3 different commands to roomba:
    clean
    dock
    stop

    In openHAB it is just defined as a light switch and I can build up a schedule and if someone is home, it delays the start of cleaning until all are gone.

    ToDo:
    See if I can fit the parts inside of the cleaning robot but for POC I am happy

    alt text

    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    // Enable repeater functionality for this node
    #define MY_REPEATER_FEATURE
    
    #include <MySensors.h>
    #include <SoftwareSerial.h>
    
    #define RELAY_1  5  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
    #define NUMBER_OF_RELAYS 2 // Total number of attached relays
    #define RELAY_ON 1  // GPIO value to write to turn on attached relay
    #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
    
    int rxPin = 3;
    int txPin = 4;
    int ledPin = 13;
    
    SoftwareSerial Roomba(rxPin, txPin);
    
    #define bumpright (sensorbytes[0] & 0x01)
    #define bumpleft  (sensorbytes[0] & 0x02)
    
    void setup() {
      pinMode(ledPin, OUTPUT);   // sets the pins as output
      Serial.begin(115200);
      Roomba.begin(115200);
      digitalWrite(ledPin, HIGH); // say we're alive
      Serial.println ("Sending start command...");
      delay (1000);
      // set up ROI to receive commands
      Roomba.write(128);  // START
      delay(150);
      Serial.println ("Sending Safe Mode command...");
      delay (1000);
      Roomba.write(131);  // CONTROL
      delay(150);
      digitalWrite(ledPin, LOW);  // say we've finished setup
      Serial.println ("Ready to go!");
      delay (5000);
    }
    
    void presentation()
    {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Roomba", "1.0");
    
      for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
        // Register all sensors to gw (they will be created as child devices)
        present(sensor, S_BINARY);
      }
    }
    
    void loop() {
    
    }
    
    
    void receive(const MyMessage &message) {
      // We only expect one type of message from controller. But we better check anyway.
      if (message.type == V_LIGHT) {
        int mySensor = message.sensor;
        int myComand = message.getBool();
    
        //Serial.print(message.sensor-1+RELAY_1);
    
        if (mySensor == 0) {
          if (myComand == 1) {
            Serial.println("Clean");
            clean();
          }
          else {
            Serial.println("Stopp1");
            halt();
          }
        }
    
        if (mySensor == 1) {
          if (myComand == 1) {
            Serial.println("dock");
            dock();
          }
          else {
            Serial.println("Stopp2");
            halt();
          }
        }
    
      }
    }
    
    void halt() {
      ;
      Roomba.write(131);  // SAFE
      byte j = 0x00;
      Roomba.write(137);
      Roomba.write(j);
      Roomba.write(j);
      Roomba.write(j);
      Roomba.write(j);
    }
    
    void dock() {
      delay(1000);
      Roomba.write(143);
    }
    
    void clean() {
      delay(1000);
      Roomba.write(135);
    }
    
    

    Cheers,
    SJ

    My Project

  • Why I quit using MySensors for actuators
    parachutesjP parachutesj

    update on my above post:
    Another node started to act crazy, had to restart it several times (simple relay with one lamp attached). Then my gateway failed shortly after. I had to restart everything. By chance I realigned the antenna and since then all runs quite stable. This drives me crazy...

    Regarding the "new" solution I am currently trying: Exchanged one of the problematic nodes with a Wemos D1 mini. Runs without any issue since 2 months.

    General Discussion

  • fallback MQTT gateway
    parachutesjP parachutesj

    I didn't find a solution to this on gateway code. What I did and seems to be working more or less.

    I have two instances running MQTT and OpenHAB. One is active, other is inactive. Both obviously do have separate IP addresses, however I have managed with "keepalive" to put a virtual IP in front. All I had to do was reflashing my gateway to the virtual IP.
    So if one of the nodes is going down, the other one becomes the master and binds to the virtual IP.
    In addition to have this seemless, the MQTT servers have a subscription to the other one. This solves the issue, that in case of a failure, there is no current data on that instance.
    OpenHAB itself was always setup in a manner that I am able to run two instances (development and production) side by side and get updates on stats of all items.

    On hardware level, I run a server on Ubuntu with VirtualBox where the instances run. On top, I have another standy node running on a RasPi.

    Feature Requests

  • upgrading to 2.0
    parachutesjP parachutesj

    @TheoL & @sundberg84
    I updated my serial GW to 2.0 successfully. Just uploaded the code from the samle page and adjusted to my environment. All 1.x sensors seem to work after 24h.
    The issue from above is also solved, so 2.0 sketch works as well now.

    Development

  • Why I quit using MySensors for actuators
    parachutesjP parachutesj

    It's been a while since I started with MySensors and had quite some troubles and eventually figured everything out. In the meantime I have a lot of sensors all over the place but I am a bit biased about the results.

    One one side, all the sensors (door, window, temp, sun, water, humitdity etc) they work flawless. I have some very low power sensors on batteries which run "forever" and they update quite frequent and once started they just do what they need to do: send sensor data to my gateway. Perfect!
    As a sensor platform, I am very happy with the results.
    On the other side, I also have a few actuators. Mainly rollershutters, a few LED-dimmers and light switches.
    As the light and dimmers (mostly) work, the results with the rollershutters are bad. First the good part: I do have two window motors in quite remote places, they work. Built with relays for up/down movement. No troubles.
    Then a few other rollershutters which are actually quite close to the gateway, they fail. every now and then the signal from gateway fails. I do not know why. I have changed everything in the meantime: Antennas, radios, power supplys, relais, arduinos, new circuits, other electronic parts (first a bunch of Nanos, then proMini) nothing gives reliable results. I tried to tweak the software as best as it goes, added sensors to send "alive" messages like temperature but then again after one day or one week or two weeks, it fails again. sometimes I only need to trigger a manual switch to get it back, then I have to power cycle.
    So after more than one year, I am done with testing. I need to get something stable now. Moving on...

    Some facts:
    I use NRF24 radios, maybe others would deliver better results. But I am not willing to waste another year.
    I am on latest stable release.
    My gateway has been changed as well. Currently an "official" arduino Uno with amplified radio and external 10A power supply to have enough juice.
    I am doing electronics since many years, but no expert but think I know mostly what I am doing.

    Thank you for all your help, will stick around for additional sensor only devices, as this seems to work (for me).

    Cheers,
    SJ

    General Discussion

  • HLK-PM01 reliability and experience
    parachutesjP parachutesj

    all,
    after a few months of testing, another HLK-PM01 died. I ordered a new batch which seem to be ok after 5 weeks.
    However for my other node, I replaced it with an IRM-05-5 from Meanwell. Which is of course more powerfull at 5W but very stable.
    If size matters, the IRM is not for you, they are about 1.5 the size of the HLK in each direction.
    I just ordered some HLK-5m05 which are also 5W and smaller. Let's see how they perform.

    Hardware

  • Can one arduino present multiple devices?
    parachutesjP parachutesj

    @zboblamont I have to agree to this.
    With OpenHAB, every child is more or less treated as an individual device (item). No matter if there is one or 100 connected to one arduino.
    On the other hand, I do not think that more powerful devices will change dramatically. I think with sensor networks, decentralization and loose coupling with a gateway which just translates it into a common language is what is key. Putting additional intelligence into the nodes or gateways is not what I would expect and want.
    I am running a lot on mySensors. But I also do have other brands deplyed. It is quite easy to exchange one against the other. The logic and intelligence is in the controller which makes it most flexible.

    General Discussion

  • Recommendation for motorized roller blinds solution (actual motor, like somfy, rollertrol, ebay...)
    parachutesjP parachutesj

    @dakipro why bother with individual sensors at the windows? You can calculate the sun position (azimuth and elevation) any time during the day and check if it would be possible for the sun to shine into the room. And in second step you only need to know if sun is shining or it is cloudy. Simplest way is using an online weather service. However I noted that this is not very reliable. My solution is based on MySensors:
    It is a weather station with some sensors (rain, temp, pressure). I've started with a light sensor but found it very unreliable also protection from environment is difficult.

    So at the end my sun senors is quite simple. One dallas sensor exposed to the sun and a second one in the shade. If the difference is high enough, sun is shining. Depending on your geographical location and preferences values might vary but for me (Zurich, CH) 10 degree celsius seems to be a good value.

    Hardware

  • Multiple sensor node freeze
    parachutesjP parachutesj

    @siod I changed most of the power supplies for the nodes with relays. Seems to be fixed. All simple switches or sensors with temp etc. never hang. It is only with actuators and relays. Also upgrading to latest version might have improved the situation. But I am almost certain that I had a few bad power supplies.

    Bug Reports

  • Dimensional Sensor
    parachutesjP parachutesj

    @Andres-Lanza have you seen this? https://www.mysensors.org/build/distance

    General Discussion

  • Hardware advice for newbe
    parachutesjP parachutesj

    @Jasper-van-Winden
    In theory it should work. The question is just how long the wires to the DHT22 sensors are. I am not sure if anyone tried this as the whole idea behind this project is having simple sensors which talk via radio.
    I would guess if the wires are too long, the signal and/or power will be not high enough to get reliable readings.
    But if it would work via ethernet cable then why not connecting the sensors directly to one central arduino and just push that via http to your controller? I do not see any use of MySensors here if it will be wired...

    maybe I am wrong?

    Hardware

  • Problem with multiple relays and delays
    parachutesjP parachutesj

    @Lucas-van-rossum
    Hi,
    I had a similar challenge with my rollershutters and I think most standard ones do exactly the same, they have one neutral pin and two for the directions (up, down). I started a few months ago building the first prototype which was controlled via WIFI and worked very well. I did not find much examples and all was build up myself. However WIFI didn't seem to be the best and I did not want to pollute my wireless therefore I searched for alternatives which I found here. Still struggling with the stability of the sensor network but besides that I am very happy with my solution.
    I also thought that I need to build an intelligent device which drives the shutters up, down and to intermediate positions. Played a lot with timers and stuff and eventually found the arduino-shutters of marvinroger with which I wasted another few days until I gave up and found out the code does not work for me - at least the latest version. Someone (I guess it was you) pointed out that earlier release seems to be working.
    By the time I decided, that I do not want any intelligence in my hardware and instead put the logic into the controller (I am using openhab). There it is quite easy to work with threads and move one down for 20 sec and then stop. It even shows me the position where it is when driving from the physical buttons. Another point which played a role, my shutters need different time for up and down (up mostly 54sec, down 50) and I do have various variations. some of the rollos only take 35 sec and my automated windows even just 25 sec for a full cycle. And instead of making the code more complicated and potentially send an update or setup parameter via the air to the note, I maintain it centrally in the controller.

    I have build shutter controllers for 1, 2 and 3 shutters on one board and all have the same logic.
    I do need to have full control via the physical buttons all the time. So when the controller decides to send them down and I do not want, I can go to the swich and stop it immediately. So basically, my logic is checking the pysical state of the swiches and what is sent from contoller and whatever is latest wins.
    I also thought maybe I should implement a possibility to block the controller from activation and overrule it by e.g. having the physical button pressed in but then I did not want to have them all the time in neutral or blocking the controller activation.
    Anyhow, my code is based on the relay example. It needs some cleanup for the physical button evaluations but I was too lazy to do this as most of my shutters are single nodes anyway and I have only 2 with 2 shutters on one board and 1 with 3. So for the moment there is some spaghettiy code.
    I am not working with timers, delays etc. in order to find the end spots, the shutters stop anyway at their end if properly installed and the physical buttons do not do anything differently - so why bother? I only have delays of 200ms when going from up to down etc. So basically before I trigger the relay for "down" I disable the one for "up" wait for 200ms and then trigger "down" just making sure there will never be power on both directions to save my motors.
    And finally, in order to "save" my relays I trigger from my controller a "stop" every now and then to all shutters in the house. In worst case, it might interfere with one rule but I can live with that.

    Here is the code based on mysensors for a node with 6 relays for 3 rollershutters attached to physical buttons:

    /**
       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 control physical relays.
       This example will remember relay state after power failure.
       http://www.mysensors.org/build/relay
    */
    #include <MySigningNone.h>
    #include <MyTransportNRF24.h>
    #include <MyTransportRFM69.h>
    #include <MyHwATMega328.h>
    #include <MySensor.h>
    #include <SPI.h>
    
    #define RELAY_1  3  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
    #define NUMBER_OF_RELAYS 6 // Total number of attached relays
    #define RELAY_ON 1  // GPIO value to write to turn on attached relay
    #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
    
    MyMessage sensorMsg0(0, V_DIMMER);
    MyMessage sensorMsg1(1, V_DIMMER);
    MyMessage sensorMsg2(2, V_DIMMER);
    
    static int currentLevel0 = 0;  // Current dim level...
    static int currentLevel1 = 0;  // Current dim level...
    
    int upPin0 = 14;   // choose the input pin (for a up)
    int downPin0 = 15;   // choose the input pin (for a down)
    int motorUp0 = 0;     // variable for reading the pin status
    int motorDown0 = 0;     // variable for reading the pin status
    
    int upPin1 = 16;   // choose the input pin (for a up)
    int downPin1 = 17;   // choose the input pin (for a down)
    int motorUp1 = 0;     // variable for reading the pin status
    int motorDown1 = 0;     // variable for reading the pin status
    
    int upPin2 = 18;   // choose the input pin (for a up)
    int downPin2 = 19;   // choose the input pin (for a down)
    int motorUp2 = 0;     // variable for reading the pin status
    int motorDown2 = 0;     // variable for reading the pin status
    
    int switchState0 = 0; //0=off, 1=up, 2=down
    int tempSwitchState0 = 0; //0=off, 1=up, 2=down
    int rUnitPos0 = 0;
    
    int switchState1 = 0; //0=off, 1=up, 2=down
    int tempSwitchState1 = 0; //0=off, 1=up, 2=down
    int rUnitPos1 = 0;
    
    int switchState2 = 0; //0=off, 1=up, 2=down
    int tempSwitchState2 = 0; //0=off, 1=up, 2=down
    int rUnitPos2 = 0;
    
    // NRFRF24L01 radio driver (set low transmit power by default)
    MyTransportNRF24 radio(RF24_CE_PIN, RF24_CS_PIN, RF24_PA_LEVEL_GW);
    //MyTransportRFM69 radio;
    // Message signing driver (none default)
    //MySigningNone signer;
    // Select AtMega328 hardware profile
    MyHwATMega328 hw;
    // Construct MySensors library
    MySensor gw(radio, hw);
    
    
    void shuttersUp(int shutter)
    {
      if (shutter == 0) {
        Serial.println("A Shutter 0 going up.");
        digitalWrite (RELAY_1 + 1, LOW);
        delay(100);
        digitalWrite (RELAY_1, HIGH);
        gw.send( sensorMsg0.set(0) );
      }
      else if (shutter == 1){
        Serial.println("A Shutter 1 going up.");
        digitalWrite (RELAY_1 + 3, LOW);
        delay(100);
        digitalWrite (RELAY_1 + 2, HIGH);
        gw.send( sensorMsg1.set(0) );
      }
      else if (shutter == 2){
        Serial.println("A Shutter 2 going up.");
        digitalWrite (RELAY_1 + 5, LOW);
        delay(100);
        digitalWrite (RELAY_1 + 4, HIGH);
        gw.send( sensorMsg2.set(0) );
      }
    
    }
    
    void shuttersDown(int shutter)
    {
      if (shutter == 0) {
        Serial.println("A Shutter 0 going down.");
        digitalWrite (RELAY_1, LOW);
        delay(100);
        digitalWrite (RELAY_1 + 1, HIGH);
        gw.send( sensorMsg0.set(100) );
      }
      else if (shutter == 1){
        Serial.println("A Shutter 1 going down.");
        digitalWrite (RELAY_1 + 2, LOW);
        delay(100);
        digitalWrite (RELAY_1 + 3, HIGH);
        gw.send( sensorMsg1.set(100) );
    
      }
      else if (shutter == 2){
        Serial.println("A Shutter 2 going down.");
        digitalWrite (RELAY_1 + 4, LOW);
        delay(100);
        digitalWrite (RELAY_1 + 5, HIGH);
        gw.send( sensorMsg2.set(100) );
    
      }
    }
    
    void shuttersStop(int shutter)
    {
      if (shutter == 0) {
        Serial.println("A Shutter 0 halted.");
        digitalWrite (RELAY_1, LOW);
        digitalWrite (RELAY_1 + 1, LOW);
      }
      else if (shutter == 1){
        Serial.println("A Shutter 1 halted.");
        digitalWrite (RELAY_1 + 2, LOW);
        digitalWrite (RELAY_1 + 3, LOW);
      }
        else if (shutter == 2){
        Serial.println("A Shutter 2 halted.");
        digitalWrite (RELAY_1 + 4, LOW);
        digitalWrite (RELAY_1 + 5, LOW);
      }
    }
    
    void setup()
    {
      pinMode(upPin0, INPUT);    // declare pushbutton as input
      pinMode(downPin0, INPUT);    // declare pushbutton as input
    
      
        pinMode(upPin1, INPUT);    // declare pushbutton as input
        pinMode(downPin1, INPUT);    // declare pushbutton as input
    
        pinMode(upPin2, INPUT);    // declare pushbutton as input
        pinMode(downPin2, INPUT);    // declare pushbutton as input
      
      // Initialize library and add callback for incoming messages
      gw.begin(incomingMessage, AUTO, true);
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("RollerShutter Atrium", "1.0");
    
      // Fetch relay status
      for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
        // Register all sensors to gw (they will be created as child devices)
        gw.present(sensor, S_COVER);
        // Then set relay pins in output mode
        pinMode(pin, OUTPUT);
    
      }
    }
    
    
    void loop()
    {
      // Alway process incoming messages whenever possible
      gw.process();
    
      motorUp0   = digitalRead(upPin0);  // read input value
      motorDown0 = digitalRead(downPin0);  // read input value
       //relay 2
        motorUp1   = digitalRead(upPin1);  // read input value
        motorDown1 = digitalRead(downPin1);  // read input value
    
        motorUp2   = digitalRead(upPin2);  // read input value
        motorDown2 = digitalRead(downPin2);  // read input value
    
    
    //evaluate switch positions
      // GROUP 0
      if (motorUp0 == LOW && motorDown0 == HIGH) {
        switchState0 = 1;
        //Serial.println("SWITCH: " + String(switchState0)); //switch position
      }
      else if (motorDown0 == LOW && motorUp0 == HIGH) {
        switchState0 = 2;
        //Serial.println("SWITCH: " + String(switchState0)); //switch position
      }
      else if (motorDown0 == HIGH && motorUp0 == HIGH)
      {
        switchState0 = 0;
        //Serial.println("SWITCH: " + String(switchState0)); //switch position
      }
      // GROUP 1
        if (motorUp1 == LOW && motorDown1 == HIGH) {
          switchState1 = 1;
          //Serial.println("SWITCH: " + String(switchState1)); //switch position
        }
        else if (motorDown1 == LOW && motorUp1 == HIGH) {
          switchState1 = 2;
          //Serial.println("SWITCH: " + String(switchState1)); //switch position
        }
        else if (motorDown1 == HIGH && motorUp1 == HIGH)
        {
          switchState1 = 0;
          //Serial.println("SWITCH: " + String(switchState1)); //switch position
        }
    // GROUP 2
        if (motorUp2 == LOW && motorDown2 == HIGH) {
          switchState2 = 1;
          //Serial.println("SWITCH: " + String(switchState2)); //switch position
        }
        else if (motorDown2 == LOW && motorUp2 == HIGH) {
          switchState2 = 2;
          //Serial.println("SWITCH: " + String(switchState2)); //switch position
        }
        else if (motorDown2 == HIGH && motorUp2 == HIGH)
        {
          switchState2 = 0;
          //Serial.println("SWITCH: " + String(switchState2)); //switch position
        }
    
    
     //GROUP 0
      if (tempSwitchState0 != switchState0) //man only needed in case of changed switch state
      {
    
        if (motorUp0 == LOW && rUnitPos0 != 1) //man up
        {
          switchState0 = 1;
          tempSwitchState0 = 1;
          delay(200);
          shuttersUp(0);
          rUnitPos0 = 1;
          Serial.println("//////////////man 0 up");
          gw.send( sensorMsg0.set(0) );
        }
    
        if (motorDown0 == LOW && rUnitPos0 != 2) // man down
        {
          switchState0 = 2;
          tempSwitchState0 = 2;
          delay(200);
          shuttersDown(0);
          rUnitPos0 = 2;
          Serial.println("//////////////man 0 down");
          gw.send( sensorMsg0.set(100) );
        }
    
        if (motorUp0 == HIGH && motorDown0 == HIGH && rUnitPos0 != 0) //man stopp
        {
          switchState0 = 0;
          tempSwitchState0 = 0;
          delay(200);
          shuttersStop(0);
          rUnitPos0 = 0;
          Serial.println("//////////////man 0 stopp");
        }
    
      }
    
    
      //GROUP 1 
    
        if (tempSwitchState1 != switchState1) //man only needed in case of changed switch state
        {
    
        if (motorUp1 == LOW && rUnitPos1 != 1) //man up
        {
          switchState1 = 1;
          tempSwitchState1 = 1;
          shuttersUp(1);
          rUnitPos1 = 1;
          Serial.println("//////////////man 1 up");
          gw.send( sensorMsg1.set(0) );
        }
    
        if (motorDown1 == LOW && rUnitPos1 != 2) // man down
        {
          switchState1 = 2;
          tempSwitchState1 = 2;
          shuttersDown(1);
          rUnitPos1 = 2;
          Serial.println("//////////////man 1 down");
          gw.send( sensorMsg1.set(100) );
        }
    
        if (motorUp1 == HIGH && motorDown1 == HIGH && rUnitPos1 != 0) //man stopp
        {
          switchState1 = 0;
          tempSwitchState1 = 0;
          shuttersStop(1);
          rUnitPos1 = 0;
          Serial.println("//////////////man 1 stopp");
        }
    
        }
       //GROUP 2 
    
        if (tempSwitchState2 != switchState2) //man only needed in case of changed switch state
        {
    
        if (motorUp2 == LOW && rUnitPos2 != 1) //man up
        {
          switchState2 = 1;
          tempSwitchState2 = 1;
          shuttersUp(2);
          rUnitPos2 = 1;
          Serial.println("//////////////man 2 up");
          gw.send( sensorMsg2.set(0) );
        }
    
        if (motorDown2 == LOW && rUnitPos2 != 2) // man down
        {
          switchState2 = 2;
          tempSwitchState2 = 2;
          shuttersDown(2);
          rUnitPos2 = 2;
          Serial.println("//////////////man 2 down");
          gw.send( sensorMsg2.set(100) );
        }
    
        if (motorUp2 == HIGH && motorDown2 == HIGH && rUnitPos2 != 0) //man stop
        {
          switchState2 = 0;
          tempSwitchState2 = 0;
          shuttersStop(2);
          rUnitPos2 = 0;
          Serial.println("//////////////man 2 stopp");
        }
    
        }
    
    }
    
    void incomingMessage(const MyMessage &message) {
      // Let's check for the message type.
      if (message.type == V_DIMMER) {
    
        //  Retrieve the power or dim level from the incoming request message
        int requestedLevel = atoi( message.data );
    
        // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on]
        requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 );
    
        // Clip incoming level to valid range of 0 to 100
        requestedLevel = requestedLevel > 100 ? 100 : requestedLevel;
        requestedLevel = requestedLevel < 0   ? 0   : requestedLevel;
    
        Serial.print( "Changing level to " );
        Serial.print( requestedLevel );
    
        Serial.print( ", from " );
    
        Serial.println("NodeID:" + String(message.sensor) + " " + currentLevel0 );
    
        if (requestedLevel == 0) {
          // move up
          shuttersUp(message.sensor);
        }
        else if (requestedLevel == 100) {
          // move down
          shuttersDown(message.sensor);
        }
        else {
          // move percentage
          // Serial.println("currentLevel" + String(shutters.currentLevel()));
          Serial.println("move to desired postion");
          //NOT IMPLEMENTED HERE
        }
    
        currentLevel0 = requestedLevel;
    
      }
      else if (message.type == V_UP) {
        shuttersUp(message.sensor);
        Serial.println("going up:" + String(message.type));
      }
      else if (message.type == V_DOWN) {
        shuttersDown(message.sensor);
        Serial.println("going down:" + String(message.type));
      }
      else if (message.type == V_STOP) {
        shuttersStop(message.sensor);
        Serial.println("stopping:" + String(message.type));
      }
      else {
        Serial.println("wrong data received:" + String(message.type));
      }
    }
    
    

    Cheers
    SJ

    Development

  • Why I quit using MySensors for actuators
    parachutesjP parachutesj

    @Nca78 that could be an issue, I totally agree. However when I started I did not use the amplified radio and my first 3 nodes which are in fact the closer ones (4-8m from gateway) showed similar behaviour why I got the PA radio.
    Not sure if this would explain that it works for a while and then stops.
    So it might be an issue, but then again I tried so much already and if it is so sensitive in the end, it is not the right and failure proof thing I want. I am not out of MySensors, just for actuators.

    General Discussion

  • Hardware advice for newbe
    parachutesjP parachutesj

    @Jasper-van-Winden
    well I was wrong. I had 13m CAT 5e cable laying around and just tested it with one DHT22 and it seems to be working:

    alt text
    alt text

    To consider:
    The Arduino Nano is powerd with a stable DC supply and it is only one DHT22, could be different outcome when you connect 5 of them all with long wires.

    Hardware

  • upgrading to 2.0
    parachutesjP parachutesj

    @sundberg84 & @TheoL
    Thank you both. I have quite a few nodes out there and "ruining" the gateway would be not so great. However flashing it back with another PC might work, so will prepare that before there is no point of return ;-)
    But good to know that a 2.0 GW seems to be working with 1.x nodes well.

    Development

  • Why I quit using MySensors for actuators
    parachutesjP parachutesj

    @dbemowsk that could also be an issue. The relays are used to drive rollershutters. They are not connected directly to the I/O pins, always via transistors. Self-designed circuits and China-boards like below. (btw: Power does not seem to be an issue)
    But why do some locations work and others don't? The relay boards, the arduinos, power supplies etc seem not to be the issue as I have exchanged them over time. Even one lamp with a relay which is connected directly and in fact was just a proof of concept works flawless since over a year.

    Don't get me wrong, I've learned a lot and it is fun building things. I will continue with sensors, maybe return for actuators. But as I (with my limited skills and measure equipment) got to a point where I am not getting the reliable results I would had hoped, I look into another technology which might be better (simpler) for me (hopefully).

    Aliexpress relay

    General Discussion

  • Relay override using togle switch
    parachutesjP parachutesj

    @carlos should work without problem.

    I had a similar use case. My rollershutters which do have up, down and stop/neutral positions. I coded it to oversteer the automatic any time. As soon as I press the switch it will do what I want. However at the moment the controller can send another state anytime afterwards.
    But what I had coded and set inactive is more or less what you are looking for.
    I just check if either button is pressed (up or down) and if so, then the comands from the controller are ignored. this is e.g. if you want to keep them up or down, only in stop/neutral it will accept the comands.
    So basically you need to check the state of the buttons. if either A or B is active (in your case on or off) it will not be overruled. only in case of middle position it will accept the comand.

    However after a few months of tests I am confident that it works.

    Cheers,
    SJ

    Hardware

  • Retrieve sensor values from sensors on OpenHab request
    parachutesjP parachutesj

    either what @gohan said or persist the values in OH

    OpenHAB

  • Why I quit using MySensors for actuators
    parachutesjP parachutesj

    @wallyllama I appreciate your help and also the help from the others on this thread, I really do.
    And I also still hope to find the root cause some day. However as you mentioned it is no straight forward and there are so many components and variables I might never been able to have a stable environment even after so many tests I did (see above).
    For the moment I stopped building new actuators based on MySensors, I switched to ESP. There are challenges but not so much on the radio side. I actually wanted to avoid having them in my WLAN why I started with MyS in first place but for the moment it looks like they just work. It is only a few days so need to wait to come to a result.

    For sensors, I am still building on MyS, have recently deployed a few more temp/hum sensors with coin cells. Still impressed with the low power consumption.

    General Discussion

  • Step by step (guide) to enable nodes as repeaters
    parachutesjP parachutesj

    Moin,
    as I am struggling with the range of my nodes, I thought it is a must to enable them as repeaters when not running on batteries.
    I am a bit confused as I found different settings in forum compared to the API documentation.

    EDIT (after clarification): this is for code prior 2.0 release:
    In API it says it needs 3 steps:

    • Enable repeater-mode in gw.begin();
      gw.begin(NULL, AUTO, true)
    • Keep node awake all time (no slepping!)
    • calling process() in your loop()

    EDIT: this is for code from release 2.0 onwards:
    What I also found is a definition
    #define MY_REPEATER_FEATURE

    ~~So, what is that all about? ~~

    Thank you and best Regards,
    SJ

    Troubleshooting
  • Login

  • Don't have an account? Register

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