Navigation

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

    micmuec

    @micmuec

    0
    Reputation
    5
    Posts
    225
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    micmuec Follow

    Best posts made by micmuec

    This user hasn't posted anything yet.

    Latest posts made by micmuec

    • RE: Problem with reed sensor

      Hi

      Yes it is! I want to merge old and new technology.
      I am completely aware that I could control my pump only with the reeds and a relay, but that would be too easy.
      Of course I'm not offended, I know that I do not understand it correctly.
      I enjoy working with my arduino, even if it does not always work.
      free according to the motto. learning by doing!
      I already had a sensor with ultrasound.
      but this one was very prone to error. was probably due to the cheap product.
      I do not know yet if my new craft will be better, but I will see that.
      I want to check the reeds and let me show in FHEM what condition they have. and in this, I would have just connected a relay to my arduino and this can control the pump.
      It's way too complicated, but it would work.
      I think over my system again, maybe I'll build it as you suggested.

      Thank you!

      greetings
      Michael

      posted in Troubleshooting
      micmuec
      micmuec
    • RE: Problem with reed sensor

      Hello

      Thank all for the answers.
      I've done a couple of tests and got new insights.
      @ zboblamont: yes, I know that it is very old technology, but usually old works better as new ...
      and yes you were partly right, as far as the interaction of the reeds and the magnets is concerned.
      It always happened two switching operations during a movement.
      After a bit of tweaking, I have now found the right position.

      but the bigger problem is actually that I may have too little idea .....
      The sketch is written in such a way, which is switched with each key. reed Closes = "on". reed closes the second time = "off".
      and i thought that when the reed is closed it is "on" and when the reed opens again it is "off".

      that means I have to rebuild my Floater, and rewrite the sketch, then it should actually work as I imagine.
      does anyone have a tip on how to change the sketch?

      Thank you very much!

      greetings
      Michael

      @ dbemowsk: not at the moment 😉

      posted in Troubleshooting
      micmuec
      micmuec
    • RE: Problem with reed sensor

      Hello

      the relays have no function in this case.
      I took over the sketch and changed just a little bit.
      I do not really need them.

      greetings
      Michael

      posted in Troubleshooting
      micmuec
      micmuec
    • RE: Problem with reed sensor

      Hello

      the individual sensors should show me the status of the water.
      I have a float with magnet that triggers the individual reed contacts.
      sensor (reed) 1 = 25%, sensor 2 = 50%, 3 = 75%, 4 = 100%, sensor 5 is intended for a relay.
      I would like to see the whole in FHEM.
      and at 100% a pump should start up and pump up to 25%, then switch off again. I want to control the pump with FHEM.
      but there are my problems. because the reeds do not switch clean, the pump would go on and off when it wants.
      I think man could also write the code differently, so that all the sensor takes over.
      but unfortunately I miss the programming knowledges.
      Do you manage my plan?

      greetings
      Michael

      posted in Troubleshooting
      micmuec
      micmuec
    • Problem with reed sensor

      Hello
      I would like to build a water level sensor.
      I have four reed contacts wired and connected.
      it works so far.
      but unfortunately it happens very often that he switches though.
      but not back.
      I think it's the software.
      Unfortunately, my programming arts are not that great.
      my english also not .... 🙂
      can someone help me solve this problem?

      I use the following 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
       * Example sketch for a "light switch" where you can control light or something 
       * else from both HA controller and a local physical button 
       * (connected between digital pin 3 and GND).
       * This node also works as a repeader for other nodes
       * http://www.mysensors.org/build/relay
       */ 
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #define MY_NODE_ID 50
       
      // Enabled repeater feature for this node
      #define MY_REPEATER_FEATURE
      
      #include <SPI.h>
      #include <MySensors.h>
      #include <Bounce2.h>
      
      #define RELAY_PIN1  8  // Arduino Digital I/O pin number for relay
      #define RELAY_PIN2  6  // Arduino Digital I/O pin number for relay 
      #define BUTTON_PIN1  2  // Arduino Digital I/O pin number for button
      #define BUTTON_PIN2  3  // Arduino Digital I/O pin number for button
      #define BUTTON_PIN3  4  // Arduino Digital I/O pin number for button
      #define BUTTON_PIN4  5  // Arduino Digital I/O pin number for button 
      #define BUTTON_PIN5  A3  // Arduino Digital I/O pin number for button 
      #define CHILD_ID 1   // Id of the sensor child
      #define RELAY_ON 1
      #define RELAY_OFF 0
      
      Bounce debouncer1 = Bounce();
      Bounce debouncer2 = Bounce();
      Bounce debouncer3 = Bounce();
      Bounce debouncer4 = Bounce();
      Bounce debouncer5 = Bounce();
      int oldValue1=0;
      int oldValue2=0;
      int oldValue3=0;
      int oldValue4=0;
      int oldValue5=0;
      bool state1;
      bool state2;
      bool state3;
      bool state4;
      bool state5;
      MyMessage msg1(1,V_LIGHT);
      MyMessage msg2(2,V_LIGHT);
      MyMessage msg3(3,V_LIGHT);
      MyMessage msg4(4,V_LIGHT);
      MyMessage msg5(5,V_LIGHT);
      
      void setup()  
      {  
        // Setup the button
        pinMode(BUTTON_PIN1,INPUT);
        pinMode(BUTTON_PIN2,INPUT);
        pinMode(BUTTON_PIN3,INPUT);
        pinMode(BUTTON_PIN4,INPUT);
        pinMode(BUTTON_PIN5,INPUT);
        // Activate internal pull-up
        digitalWrite(BUTTON_PIN1,HIGH);
        digitalWrite(BUTTON_PIN2,HIGH);
        digitalWrite(BUTTON_PIN3,HIGH);
        digitalWrite(BUTTON_PIN4,HIGH);
        digitalWrite(BUTTON_PIN5,HIGH);
        
        // After setting up the button, setup debouncer
        debouncer1.attach(BUTTON_PIN1);
        debouncer2.attach(BUTTON_PIN2);
        debouncer3.attach(BUTTON_PIN3);
        debouncer4.attach(BUTTON_PIN4);
        debouncer5.attach(BUTTON_PIN5);
        debouncer1.interval(30);
        debouncer2.interval(30);
        debouncer3.interval(30);
        debouncer4.interval(30);
        debouncer5.interval(30);
      
        // Make sure relays are off when starting up
        digitalWrite(RELAY_PIN1, RELAY_OFF);
        digitalWrite(RELAY_PIN2, RELAY_OFF);
        // Then set relay pins in output mode
        pinMode(RELAY_PIN1, OUTPUT);
        pinMode(RELAY_PIN2, OUTPUT);   
            
        // Set relay to last known state (using eeprom storage) 
        state1 = loadState(1);
        digitalWrite(RELAY_PIN1, state1?RELAY_ON:RELAY_OFF);
        state5 = loadState(5);
        digitalWrite(RELAY_PIN2, state5?RELAY_ON:RELAY_OFF);
      }
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Relay & Button", "1.0");
      
        // Register all sensors to gw (they will be created as child devices)
        present(1, S_LIGHT);
        present(2, S_LIGHT);
        present(3, S_LIGHT);
        present(4, S_LIGHT);
        present(5, S_LIGHT);
      }
      
      /*
      *  Example on how to asynchronously check for new messages from gw
      */
      void loop()
      {
        debouncer1.update();
        debouncer2.update();
        debouncer3.update();
        debouncer4.update();
        debouncer5.update();
      
        
        // Get the update value
        int value1 = debouncer1.read();
        if (value1 != oldValue1 && value1==0) {
            send(msg1.set(state1?false:true), true); // Send new state and request ack back
        }
        oldValue1 = value1;
       
        // Get the update value
        int value2 = debouncer2.read();
        if (value2 != oldValue2 && value2==0) {
            send(msg2.set(state2?false:true), true); // Send new state and request ack back
        }
        oldValue2 = value2;
      
        // Get the update value
        int value3 = debouncer3.read();
        if (value3 != oldValue3 && value3==0) {
            send(msg3.set(state3?false:true), true); // Send new state and request ack back
        }
        oldValue3 = value3;
      
        // Get the update value
        int value4 = debouncer4.read();
        if (value4 != oldValue4 && value4==0) {
            send(msg4.set(state4?false:true), true); // Send new state and request ack back
        }
        oldValue4 = value4;
      
        // Get the update value
        int value5 = debouncer5.read();
        if (value5 != oldValue5 && value5==0) {
            send(msg5.set(state5?false:true), true); // Send new state and request ack back
        }
        oldValue5 = value5;
      } 
       
      void receive(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.isAck()) {
           Serial.println("This is an ack from gateway");
        }
      
        if (message.type == V_LIGHT) {
           // Change relay state
           if(message.sensor==1){
        digitalWrite(RELAY_PIN1, message.getBool()?RELAY_ON:RELAY_OFF);
               state1=message.getBool();
        }
           // Change relay state
           if(message.sensor==2){
        digitalWrite(RELAY_PIN1, message.getBool()?RELAY_ON:RELAY_OFF);
               state2=message.getBool();
        }
           // Change relay state
           if(message.sensor==3){
        digitalWrite(RELAY_PIN1, message.getBool()?RELAY_ON:RELAY_OFF);
               state3=message.getBool();
        }
           // Change relay state
           if(message.sensor==4){
        digitalWrite(RELAY_PIN1, message.getBool()?RELAY_ON:RELAY_OFF);
               state4=message.getBool();
        }
        if(message.sensor==5){
        digitalWrite(RELAY_PIN2, message.getBool()?RELAY_ON:RELAY_OFF);
              state5=message.getBool();
        }
      
      // Store state in eeprom
            saveState(message.sensor, message.getBool());
        
           // Write some debug info
           Serial.print("Incoming change for sensor:");
           Serial.print(message.sensor);
           Serial.print(", New status: ");
           Serial.println(message.getBool());
         } 
      }
      
      

      Greetings
      Michael

      posted in Troubleshooting
      micmuec
      micmuec