Announcement

Collapse
No announcement yet.

Signal Sensing

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Signal Sensing

    I've gotten quite a few questions about signal sensing with a BC4 GPIO. The BC4 Plugin now (starting with V 1.2.3) supports scripting functionality which will make this much easier and more flexible. This thread will hopefully get you going.

    Connections:
    The BC4 with a BCX-1 module installed (or other BCX module which contains GPIOs) has two external GPIO connections which can be configured (among other things) as an analog input. This means that you can connect an analog signal, such as line-level audio or composite video, directly into a BC4 GPIO, without the need for expensive additional sensors. You can use an otherwise un-used output from the source equipment, or you can use a "Y-Cable" to sense the signal. For further clarification, the physical connection is as simple as this:



    To be continued.....

    #2
    Once the physical connections have been made, you need to set up the GPIO in HomeSeer. Use the checkboxes in the BC4 Config page to tell HomeSeer which BC4 devices you want to use as HomeSeer devices. For this example, let's assume we're using GPIO #1 (as illustrated in the first post). Click the "Update" button to save your changes.
    We now have to set up that BC4 as an analog input. Your GPIO should now be available as a HomeSeer device from the Status page. Click on the device name ( at this point it's called "GPIO 1" ) to configure the device. Set the "Mode" property to 2, as illustrated here. You may need to change the "Delay" setting later, but for now let's leave it at the default value of 3.

    To be continued.....

    Comment


      #3
      Now we should have the GPIO device pretty well set up in HomeSeer, and physically connected to the piece of equipment we're monitoring. In this example, let's say it's a DVD player which doesn't have discrete power On and Off commands, just a Power Toggle command. It's a TOAD, and we want to be able to reliably control the power state. Therefore, we're sensing the composite video output of it. We now need to get an idea of what the signal looks like with the player powered "On" and with the player powered "Off". I attached a quick script here which has a sub called "LogValues" which will help us with this. Save it to your installation's "Scripts" folder.

      Let's create a HomeSeer event, with a manual trigger, which is running the BC4SignalSense.vb test script as an action. Click the advanced button to show the optional parameters. We need to run the "LogValues" sub from this script, with the Device Code of the GPIO as a parameter. You can see the Device code of the devices on the Status Screen. As you can see from the screenshot, the Device Code of GPIO 1 (which is the one we hooke the video cable to and set up as an analog input) has the Device Code "[5".

      So the script parameters would look like this in my case.

      To be continued.......
      Attached Files
      Last edited by ; December 11, 2008, 11:45 AM.

      Comment


        #4
        OK, so now that the script is set up (hopefully) properly, we can use it to get a picture of the activity on the GPIO. You should run the event manually a few times with the DVD player (or whatever you're using) on, and make a note of the info that gets printed to the HomeSeer log. You should get a string that looks something like:
        "SCRIPT - Signal Levels for [5,VAL=18,MIN=0,MAX=66"

        Here's what those values mean. VAL is the signal level on the input at the moment it was reported. MIN is the minimum (lowest) value that was sensed since the last report. MAX is the maximum (highest) value that was sensed since the last report.
        Remember the "Delay" setting on the GPIO config page? The longer the delay, the greater the difference you will typically see between the MIN and MAX values. Because the Delay setting is how often (in tenths of a second) to automatically report to HomeSeer a signal change on the GPIO. So the Delay setting can be used to help get a reliable signal report. I've found with the devices I've tested with that a setting between 3-5 usually works just fine, unless the level of the analog signal is very, very low.

        Now let's run the event with the DVD player turned off, to get an idea of how the signal looks then.
        You will probably see something like this:
        "SCRIPT - Signal Levels for [4,VAL=1,MIN=0,MAX=1"

        So when the DVD Player was On, we got:
        "SCRIPT - Signal Levels for [5,VAL=18,MIN=0,MAX=66"
        and with it Off, we got:
        "SCRIPT - Signal Levels for [4,VAL=1,MIN=0,MAX=1"

        This gives us all we need to create a script which will actually sense our signal and do something useful with it.

        To be continued.....

        Comment


          #5
          The BC4SignalSense script also has a sub called "Sense" which I created to quickly show how you might use the signal sensing functions in a real world situation. You can alter it to suit your purposes, and you may have to adjust a few things to make it work with your equipment. There are lots of comments in the script which explain what's going on, and you can use the info you got by running the "LogValues" script to help you.

          Hopefully this has been a decent primer for analog signal sensing with a BC4.
          Let me know if you have any questions, and I'll clarify as best I can.

          Comment

          Working...
          X