CF Mini - Video Sense

29 views
Skip to first unread message

Andy Greaves

unread,
Sep 1, 2014, 6:04:24 AM9/1/14
to commandfusi...@googlegroups.com
Hi All,

I have an installation with a couple of items that do not have discrete on/off commands, so I was hoping to use the IO ports of the CF mini to monitor a composite video output.

Is this easy to implement?  I can see how to set the ports for video sense, but unsure of how to easily bring this into GUI designer to presumably change the state of a join.

I couldn't find anything in previous posts here.

Could anyone offer any guidance?

Thanks

Andy.

Jarrod Bell

unread,
Sep 1, 2014, 9:11:57 AM9/1/14
to commandfusi...@googlegroups.com
You need to play around with the port settings to get it to work correctly for your specific device's voltages.
Then the CF Mini will simply report an IO state of 0 or 1 for that input.

The format of the data is as per the wiki protocol documentation:
http://www.commandfusion.com/wiki2/hardware/cflink/input-output-io-module-cflink-protocol#cha-change-notification

You can create a simple regex like this to capture it:
RIOXCHA\xF4.*P02:S:(0|1)

Assuming you are using IO port 2 (just change the P02 to suit the port you are using as video sense input).

Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--
You received this message because you are subscribed to the Google Groups "CommandFusion Hardware" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusion-har...@googlegroups.com.
To post to this group, send email to commandfusi...@googlegroups.com.
Visit this group at http://groups.google.com/group/commandfusion-hardware.
For more options, visit https://groups.google.com/d/optout.

Andy Greaves

unread,
Sep 2, 2014, 7:30:23 AM9/2/14
to commandfusi...@googlegroups.com
Hi Jarrod,

Thanks for the info.

I didn't have much luck getting the port to trigger with the video sense, but I ran out of time to keep testing. It appears it may be the amp that could be the issue. I could get an analogue voltage input to work using a USB port on the amp that switched between 0.9v and 5v on power cycling.
I will try again with it tomorrow when I go back to site.
With the video sense option, what is the job of the voltage adjustment option? Could this be to do with it not working?

If I have to end up using the USB option instead, could i use the > operator in the regex to detect if the IO port is greater than say 3v for example?

Lastly, I will hunt through the wiki for this anyway, but if there is a quick and easy answer it would help me out! Whats the easiest way to perform some logic to create discrete on off commands based on the IO states.

For example to create an 'on' command - if IO port 1 = 1 then Amplifier is on = do not send power toggle - else, send power toggle.

I realise this may be better done with JS and I currently have some more hardware on order, so I may make this my first JS challenge when I have another CFmini in the office.

Thanks

Andy.

Andy Greaves

unread,
Sep 3, 2014, 6:26:34 AM9/3/14
to commandfusi...@googlegroups.com
Just as an update to this,

I still couldnt get a video sense to work so I thought I would try using the analogue voltage to read the output to see if there was any noticeable difference between power states on the amplifier.

When I switch any of the IO ports on the CFmini to analogue voltage, with nothing connected to them, I am seeing 1.7-1.8v

Do they need a resister across them to pull them down?

If it's seeing 1.8v on an empty port, there's no wonder it's not seeing a 1v video signal.

Andy.

Jarrod Bell

unread,
Sep 3, 2014, 7:03:36 AM9/3/14
to commandfusi...@googlegroups.com
JavaScript is definitely the way to go for this.

It could be as simple as comparing a join and sending a command, all without any external script - just some script attached to a command.

Command Properties:
Command Value: 'PUT YOUR POWER TOGGLE COMMAND HERE'
JavaScript: CF.getJoin("d10", function(j,v) { if (v == "0") { CF.send(system, data); });
JavaScript sends command value?: Ticked!

This script will get the state of digital join 10, then only send the command value if the join is low (signifying the amplifier is off). This takes advantage of the 'data' and 'system' variables that are automatically defined for you in any code attached to a command - http://commandfusion.com/docs/scripting/startup.html#command_send_handler

Your CF Mini would send back data based on the power state (however you hook it up) and then you have to use regex to process the data into the digital join 10 state.

As for the video sense - I will have to get back to you on exactly how that works.


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


Andy Greaves

unread,
Sep 4, 2014, 8:11:33 AM9/4/14
to commandfusi...@googlegroups.com
Hi Jarrod,

Thanks again for the info.

I'll update this with what I did in case it's useful for anyone else...

I couldn't get the video sense to work and suspect its because the ports are showing 1.7v even when not connected (let me know if you find anything out on this one!)

I did however have some luck using the USB outputs as both the AVR and a bluray player had USB ports that switch with the power toggles.

I set the IO ports to analogue voltage and noted the differences, 1.7v when off and 5v when on.
I created a feedback item for each to capture just the first digit and link to a digital join.
The Regex used was: RIOXCHA\xF4.*P01:A:(\d)(\d)
I used capture group one to capture either a 1 or 5 depending on power state.

This then allowed me to produce discrete power commands using the javascript from Jarrod's post above. It also gave me my first opportunity to debug javascript as it was missing a } from the end of the line! Thanks Jarrod ;-) (At least I assume it was as it didn't work until I added the second } )

This worked great, but it did present a problem, when the GUI loads, it doesn't know the state of the two devices as they only do something on a state change. In my case this was even worse as I was using GUI linking to use the XBMC module and each time the main GUI came back up, it didn't know the state of the devices so displayed them as off.
So to solve this, I read through and found the query state command. I added two more commands to query the state of the IO ports as follows: -
\xF2\x20\xF3QIOXSTA\xF4.*P01\xF5\xF5
\xF2\x20\xF3QIOXSTA\xF4.*P02\xF5\xF5

I then made a macro with these two commands in them and added to a page timer to run each time the page loads.

This seems to have worked quite nicely.

As always, Thanks for the help Jarrod, much appreciated.

Andy.

Reply all
Reply to author
Forward
0 new messages