Navigation

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

    Naitsirhc

    @Naitsirhc

    4
    Reputation
    15
    Posts
    440
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Naitsirhc Follow

    Best posts made by Naitsirhc

    • RE: New scketch for water level + control valves

      update:

      Adapted the old distance sensor sketch to the 2.0 library and upladed it and connected to my PC. Also connected the gateway 2.0 to raspberry (Domoticz).....
      Allright it works....I do get distance in my serial monitor and in domoticz.

      Now try to upload the basement alarm sketch...See what happens...

      posted in Troubleshooting
      Naitsirhc
      Naitsirhc
    • RE: Pump + Relais + Decoupling

      To all,

      Thanks for your answers. Unfortunatly I didn't have time to check your answers. I will keep in touch

      posted in Troubleshooting
      Naitsirhc
      Naitsirhc
    • RE: Pump + Relais + Decoupling

      Hi,

      I promised to keep in touch.... 🙂

      I have disconnected the radio from the Arduino, so the radio is fed through a seperate stable 5V.
      And also the relais board is fed seperately.
      It runs for a cuple of days and it seems to work well. Time to move on.
      To see if the magnet is working or not, I decided to connect a RGB led. When I connect the led, the board is going bonkers. The led is connected on D5 and D6 and the other side to ground (via a resistor)

      Anybody a clue?

      posted in Troubleshooting
      Naitsirhc
      Naitsirhc
    • RE: Pump + Relais + Decoupling

      Again, thanks all for answering

      Until now its working 2 days flawlessly.

      posted in Troubleshooting
      Naitsirhc
      Naitsirhc

    Latest posts made by Naitsirhc

    • RE: Pump + Relais + Decoupling

      Unfortunatly the sensor stopped working last night. I have ordered a relais board with opto coupler....
      I will keep in touch

      posted in Troubleshooting
      Naitsirhc
      Naitsirhc
    • RE: Pump + Relais + Decoupling

      Again, thanks all for answering

      Until now its working 2 days flawlessly.

      posted in Troubleshooting
      Naitsirhc
      Naitsirhc
    • RE: Pump + Relais + Decoupling

      Going bonkers is probably not the right word. I actually meant that the owner, and especialy his wife, are going bonkers 🙂
      What I meant is:
      When I connect the led: (red = D5, Green = D6 and the ground is connected through a resistor of 1K.) When I turn on the relay it's answering for aprox. 5 minutes and than it crashes.
      I can only reanimate it by turning off the power

      posted in Troubleshooting
      Naitsirhc
      Naitsirhc
    • RE: Pump + Relais + Decoupling

      Thanks for your quick reply.

      The led is indicating one colour at the same time. Green for open and red for close.
      I can give it a try to have more resistors connected...

      posted in Troubleshooting
      Naitsirhc
      Naitsirhc
    • RE: Pump + Relais + Decoupling

      Hi,

      I promised to keep in touch.... 🙂

      I have disconnected the radio from the Arduino, so the radio is fed through a seperate stable 5V.
      And also the relais board is fed seperately.
      It runs for a cuple of days and it seems to work well. Time to move on.
      To see if the magnet is working or not, I decided to connect a RGB led. When I connect the led, the board is going bonkers. The led is connected on D5 and D6 and the other side to ground (via a resistor)

      Anybody a clue?

      posted in Troubleshooting
      Naitsirhc
      Naitsirhc
    • RE: Pump + Relais + Decoupling

      To all,

      Thanks for your answers. Unfortunatly I didn't have time to check your answers. I will keep in touch

      posted in Troubleshooting
      Naitsirhc
      Naitsirhc
    • Pump + Relais + Decoupling

      Hi,

      Picked up the hobby again 🙂
      I would like to build an irregation system with a pump, 4 valves and a sensor to easure the total amount of water in a tank.
      I have found some sketches to help me with the problem. So I hope this would not be the problem.
      I now have tried the relais sketch on my doormagnet (other project), and after a while it will fail (probably noise causes the problem)
      My system is:
      Arduino nano
      radio NRF2401 PA/LNA
      NRF24L01+ Socket Adapter Board
      relais board
      All of this are connected with jumper wires and the arduino + radio are fed seperatly with a charger.

      Before I try to build the irregation system I would like to know if there is a good method to calcuate the size of the decoupling capacitor. And where do I have to put it. Do I have to put it on the 230V side, or also on the 5V (on the relais board)

      Hope too get some aswers here, thanks in advance

      posted in Troubleshooting
      Naitsirhc
      Naitsirhc
    • RE: New scketch for water level + control valves

      update:

      Adapted the old distance sensor sketch to the 2.0 library and upladed it and connected to my PC. Also connected the gateway 2.0 to raspberry (Domoticz).....
      Allright it works....I do get distance in my serial monitor and in domoticz.

      Now try to upload the basement alarm sketch...See what happens...

      posted in Troubleshooting
      Naitsirhc
      Naitsirhc
    • RE: New scketch for water level + control valves

      Hi

      First of all, thanks for all the answers.

      Started from skratch again. Downloaded the new arduino IDE.Some Libraries (NewPing and Mysensors) and finaly the sketch compiled 😄
      I uploaded it to the Nano and then expected to see something on the serial monitor....

      Too bad...Oh right. removed slashes for MyDebug and MyDebug_Verbose...

      Presto.

      Unfortunatly I see in serial monitor:

      Starting sensor (RNNNA-, 2.0.0)
      TSM:INIT
      TSM:RADIO:OK
      TSP:ASSIGNID:OK (ID=32)
      TSM:FPAR
      TSP:MSG:SEND 32-32-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSM:FPAR
      TSP:MSG:SEND 32-32-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSM:FPAR
      TSP:MSG:SEND 32-32-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSM:FPAR
      TSP:MSG:SEND 32-32-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      !TSM:FPAR:FAIL
      !TSM:FAILURE
      TSM:PDT
      TSM:INIT
      

      Too bad. What have I done wrong? Is it possible to see the distance in serial monitor and to see if a relay turned on or off?

      EDIT:
      Upgraded my Gateway also to 2.0

      Stil no succes 😞

      Output from Gateway:

      0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
      0;255;3;0;9;TSM:INIT
      0;255;3;0;9;TSM:RADIO:OK
      0;255;3;0;9;TSM:GW MODE
      0;255;3;0;9;TSM:READY
      0;255;3;0;14;Gateway startup complete.
      0;255;0;0;18;2.0.0
      0;255;3;0;11;GateWay
      0;255;3;0;12;1.0
      0;255;3;0;9;No registration required
      0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
      0;255;3;0;9;TSP:SANCHK:OK
      0;255;3;0;9;TSP:SANCHK:OK
      0;255;3;0;9;TSP:SANCHK:OK
      0;255;3;0;9;TSP:SANCHK:OK
      0;255;3;0;9;TSP:SANCHK:OK
      
      posted in Troubleshooting
      Naitsirhc
      Naitsirhc
    • RE: New scketch for water level + control valves

      Did a check with my other sketches a adapted the basement fooding alarm sketch:

      /*
        Ultrasonic Sensor - based on a MySensors example (actuator)
      
        modified 30 august 2016
        version 1.2
        by Gert Sanders
      
        Uses 2.0.0-dev version of the library
      
      */
      
      // Enable debug prints to serial monitor
      
      //#define MY_DEBUG
      //#define MY_DEBUG_VERBOSE
      
      //#define MY_NODE_ID 123
      #define MY_NODE_ID 32
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      // possible values: RF24_PA_LOW (is default on gateway), RF24_PA_MED, RF24_PA_HIGH, RF24_PA_MAX (is default on nodes)
      #define MY_RF24_PA_LEVEL RF24_PA_MAX
      
      // RF channel for the sensor net, 0-127
      
      #define MY_RF24_CHANNEL     80  // just my choice
      
      
      //RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
      #define MY_RF24_DATARATE      RF24_250KBPS
      
      
      // defines for sensors
      #define PUMP          1
      #define WATERLEVEL    2
      
      
      // Enable repeater functionality for this node
      //#define MY_REPEATER_FEATURE
      
      
      // All includes
      #include <MySensor.h>
      #include <NewPing.h>
      #include <SPI.h>
      
      // Pin definitions and other defines
      #define TRIGGER_PIN  5  // Arduino pin tied to trigger pin on the ultrasonic sensor.
      #define ECHO_PIN     6  // Arduino pin tied to echo pin on the ultrasonic sensor.
      #define RELAYPIN     7
      //#define LEDPIN       8
      
      #define PumpOFFLimit    2
      #define PumpONLimit     12
      
      #define MAX_DISTANCE 255 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
      
      #define NUMBEROFSAMPLES 100
      
      
      // constants
      
      
      // variables
      boolean  PumpStatus = false;
      boolean  oldPumpStatus = false;
      
      unsigned int uS = 0;
      byte Distance = 0;
      byte LastMeasuredDistance = 0;
      byte MaxMeasuredDistance = 0;
      
      
      
      // Instantiate objects
      MySensor gw;
      NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
      MyMessage PumpMsg(PUMP, V_LIGHT);
      MyMessage DistanceMsg(WATERLEVEL, V_DISTANCE);
      
      
      
      void presentation()
      {
         gw.begin();
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("BasementAlarmUltrasonic", "1.1");
        gw.wait(500); // delay needed by Raspi/domotics
        gw.present(PUMP, S_LIGHT);
        gw.wait(500); // delay needed by Raspi/domotics
        gw.present(WATERLEVEL, S_DISTANCE);
        gw.wait(500); // delay needed by Raspi/domotics
      }
      
      
      
      
      
      // supporting functions.
      //void blipled()
      //{
      //  digitalWrite(LEDPIN, !PumpStatus);   // turn the LED on (HIGH is the voltage level)
      //  wait(50);              // wait for a bit
      //  digitalWrite(LEDPIN, PumpStatus);    // turn the LED off by making the voltage HIGH
      //  wait(150);              // wait for a bit
      // digitalWrite(LEDPIN, !PumpStatus);   // turn the LED on (HIGH is the voltage level)
      //  wait(50);              // wait for a bit
      //  digitalWrite(LEDPIN, PumpStatus);    // turn the LED off by making the voltage HIGH
      //}
      
      
      
      
      
      
      void receive(const MyMessage & message)
      {
      
      
      #ifdef MY_DEBUG
        // Write some debug info
        Serial.print(F("Incoming change for sensor:"));
        Serial.print(message.sensor);
      #endif
      
      
        if (message.type == V_LIGHT)
        {
          // Change relay state
          oldPumpStatus = PumpStatus;
          PumpStatus = message.getBool();
          digitalWrite(RELAYPIN, PumpStatus ? HIGH : LOW);
          // Store state in eeprom
          saveState(PUMP, PumpStatus);
      
      #ifdef MY_DEBUG
          Serial.print(F("Changing PUMP status to : "));
          Serial.println(PumpStatus);
      #endif
      
        }
      
      
      }
      
      
      
      
      /////////////////////////////////////////////////////////////////////////
      // the setup function runs once when you press reset or power the board
      /////////////////////////////////////////////////////////////////////////
      void setup()
      {
        PumpStatus = false;
        oldPumpStatus = false;
      
        // initialize digital LEDpin as an output.
      //  pinMode(LEDPIN, OUTPUT);
        //digitalWrite(LEDPIN, HIGH);    // turn the LED on by making the voltage HIGH
      
        // initialize digital Pumppin as an output.
        pinMode(RELAYPIN, OUTPUT);
        digitalWrite(RELAYPIN, LOW);    // turn the LED off by making the voltage LOW
      
        PumpStatus = loadState(PUMP);
        digitalWrite(RELAYPIN, PumpStatus);
        send(PumpMsg.set(PumpStatus == true ? 1 : 0));
        wait(500);
      
        MaxMeasuredDistance = loadState(WATERLEVEL);
      
      //  digitalWrite(LEDPIN, LOW);                   // turn the LED off by making the voltage LOW
      
      }
      
      
      
      
      
      
      
      
      
      
      ///////////////////////////////////////////////////////
      // the loop function runs over and over again forever
      ///////////////////////////////////////////////////////
      
      void loop()
      {
        blipled();
      
        uS = sonar.ping_median(NUMBEROFSAMPLES); // Send ping, get ping time in microseconds (uS).
      
        Distance = uS / US_ROUNDTRIP_CM;
      
        if (Distance >= MaxMeasuredDistance)
        {
          MaxMeasuredDistance = Distance;
          if (Distance >= loadState(WATERLEVEL))
          {
            saveState(WATERLEVEL, Distance);
          }
        }
      
        if (Distance != LastMeasuredDistance)
        {
          if (send(DistanceMsg.set((MaxMeasuredDistance - Distance), 0)))
          {
            LastMeasuredDistance = Distance;
            wait(500);
          }
        }
      
      #ifdef MY_DEBUG
        Serial.print("Ping: ");
        Serial.print(Distance); // Convert ping time to distance in cm and print result (0 = outside set distance range)
        Serial.print("cm");
        Serial.print("    Max: ");
        Serial.print(MaxMeasuredDistance); // Convert ping time to distance in cm and print result (0 = outside set distance range)
        Serial.println("cm");
      #endif
      
      
        if ((MaxMeasuredDistance - Distance) >= PumpONLimit)
        {
          SetPumpOn();
        }
      
        if ((MaxMeasuredDistance - Distance) <= PumpOFFLimit)
        {
          SetPumpOff();
        }
      
        if (oldPumpStatus != PumpStatus)
        {
      
          if (send(PumpMsg.set(PumpStatus == true ? 1 : 0)))
          {
            oldPumpStatus = PumpStatus;
            wait(500); // delay needed by Raspi/domotics
          }
        }
      
      
      }
      
      
      
      
      void SetPumpOn()
      {
      
        digitalWrite(RELAYPIN, HIGH);
        oldPumpStatus = PumpStatus;
        PumpStatus = true;
        saveState(PUMP, PumpStatus);
      
      }
      
      
      
      void SetPumpOff()
      {
      
        digitalWrite(RELAYPIN, LOW);
        oldPumpStatus = PumpStatus;
        PumpStatus = false;
        saveState(PUMP, PumpStatus);
      
      }
      

      I turned of the LED pin (I don't need it)

      The compiler does his job till the last line:
      saveState(PUMP, PumpStatus);

      which returns:
      exit status 1
      'saveState' was not declared in this scope

      What can I do to make this error disappear

      Thanks in advance

      posted in Troubleshooting
      Naitsirhc
      Naitsirhc