Announcement

Collapse
No announcement yet.

Arduino - HC-SR04 Ultrasonic Sensor Distance Module

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by aldo View Post
    Quick question:
    I have attached the picture, what the input and output should be set at?

    After making changes or adding pins, do I need to download the sketch and make your changes into the new uploaded sketch?

    Thanks, Aldo
    There is no output set up in the code so you only need the input for the moment.

    If you are using Ethernet then you can not use some of the pins as they are used for the shield. Pins 12 and 13 are two of them so change the pins in the code to pins 8 and 9 and connect the sensor to them and upload the code again.

    You do not need to update the code if you make changes to the plugin config only if you change the code for the API.

    For the normal Sketch you do not need to update the board once it is set unless you change the IP config or change it from IP to a com port.

    Greig.
    Zwave = Z-Stick, 3xHSM100 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
    X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
    Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
    Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
    Scripts =
    Various

    Comment


    • #17
      Edit: I need to play with this some more, in the mean time I think I have found the issue with Unknown, I was setting the status to value, I changed it to string and it seem to be working ok. Still not sure if the refresh is right or needs to be adjusted.

      Thanks Greig, almost there. Sometime it reads the values like Dim 73% then mostly shows the value Unknown, I think it can not keep up with the value changes.
      these are the messages I get in the log
      May-15 6:36:26 PM Arduino Plugin Sent to IP:192.168.0.47 Port No:8900 = 1 h ,Ack Command
      May-15 6:36:26 PM Arduino Plugin Sent to IP:192.168.0.47 Port No:8900 = 1 h ,Ack Command
      May-15 6:36:26 PM Arduino Plugin Sent to IP:192.168.0.47 Port No:8900 = 1 h ,Ack Command
      May-15 6:36:26 PM Arduino Plugin Sent to IP:192.168.0.47 Port No:8900 = 1 h ,Ack Command
      May-15 6:36:26 PM Arduino Plugin Sent to IP:192.168.0.47 Port No:8900 = 1 h ,Ack Command

      Trust me, I'm reading as much as I can and getting my brain to overload, I saw it in your manual at one point but I recollected it after you told me.

      If I would like to integrate the switch into the API. Let me know if I'm doing it incorrectly:

      #define inputPin 5
      --
      pinMode(inputPin, INPUT);
      --
      SendToHS(2,inputPin);

      Then create in the plugin an input pin.
      Last edited by aldo; May 15th, 2017, 06:18 PM.

      Comment


      • #18
        Not sure why but the values given by the sensor are sporadic, anything that we would need to adjust in the code?

        I'm also trying to implement the water level switch as part of this implementation, it has been already tested in the normal Arduino code, I would like to implement it into the API, is this the code that I would need to add to the API?

        #define inputPin 5
        --
        pinMode(inputPin, INPUT);
        --
        SendToHS(2,inputPin);

        Then create in the plugin an input pin.

        Thanks,
        Aldo

        Comment


        • #19
          Originally posted by aldo View Post
          Not sure why but the values given by the sensor are sporadic, anything that we would need to adjust in the code?

          I'm also trying to implement the water level switch as part of this implementation, it has been already tested in the normal Arduino code, I would like to implement it into the API, is this the code that I would need to add to the API?

          #define inputPin 5
          --
          pinMode(inputPin, INPUT);
          --
          SendToHS(2,inputPin);

          Then create in the plugin an input pin.

          Thanks,
          Aldo
          Aldo Sorry I missed this post.
          Yes this is the code to add to the API but also add a change detection "IF" because this will send the value to HS every time the code loops and this is very fast so will likely crash the plugin.

          Greig.
          Zwave = Z-Stick, 3xHSM100 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
          X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
          Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
          Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
          Scripts =
          Various

          Comment


          • #20
            Thank you Greig.

            Comment

            Working...
            X