www.homeseer.com    
 

Go Back   HomeSeer Message Board > RFID Plug-ins > RFID Discussion

Reply
 
Thread Tools Display Modes
  #21  
Old December 31st, 2010, 06:29 PM
mrhappy mrhappy is offline
OverSeer
 
Join Date: Nov 2007
Location: W.Mids, UK
Posts: 7,314
Sorry I never replied, the script if you ran it and it did work can be amended to accept a parameter, which can come from a slider/button. It was posted just to see if the communications worked - if it did then a couple of lines could be added to turn the parameter into the position= variable
Reply With Quote
  #22  
Old January 1st, 2011, 06:54 AM
Seereus Seereus is offline
Seer
 
Join Date: Mar 2010
Location: Southeast
Posts: 21
OK, could you provide detail on how to add a slider to it. This is where I am really lost. I just do not have a grasp on how scripts work and how to interact with them. Thanks.
Reply With Quote
  #23  
Old January 1st, 2011, 07:02 AM
mrhappy mrhappy is offline
OverSeer
 
Join Date: Nov 2007
Location: W.Mids, UK
Posts: 7,314
Quote:
Originally Posted by Seereus View Post
OK, could you provide detail on how to add a slider to it. This is where I am really lost. I just do not have a grasp on how scripts work and how to interact with them. Thanks.
Sorry I may have confused things slightly there, sliders/scroll bars are Visual Basic Form Controls (like buttons on a normal windows program), HomeSeer does not use forms for scripts so things like scroll bars are'nt really supported, when you run a script it runs in the background and unless you want to you don't even need to have anything visible - you can instead use either a button on a device or when you run the script you can pass the position for the servo in. I thought you were talking about a slider in HSTouch - which could be used later on to move the servo.

That script has the position coded into it, which I was just hoping would move the servo to prove the communication worked and could later be amended, does it do anything if you run it or does any error appear in the log? Just wondering if you get a reply back from the board or not...
Reply With Quote
  #24  
Old January 1st, 2011, 05:00 PM
Seereus Seereus is offline
Seer
 
Join Date: Mar 2010
Location: Southeast
Posts: 21
It doesn't move when you run the script but here is what the log shows when I hit run:

1/1/2011 3:59:15 PM ParallaxTest Port Closed1/1/2011 3:59:13 PM ParallaxTest Data Sent




I just need to know how to add a way to tell it what to do? This is where I am stuck. How do I make it move? What do I use to control the actions of the servo?
Reply With Quote
  #25  
Old January 1st, 2011, 05:17 PM
mrhappy mrhappy is offline
OverSeer
 
Join Date: Nov 2007
Location: W.Mids, UK
Posts: 7,314
Hmm...probably my bad code, did it come with any software? If so does the board work?

I've found this in vb.net http://www.crustcrawler.com/software/psc/index.php which i'm just looking at the sourcecode for to see if its any easier for me to understand.

To tell the servo where to go you can do a number of ways (that script I posted the position was 500 [the line position=500] - it was hard coded to move there if you change that to another number like 600 I take it still does not move as I don't think the comms are correct - you can try it though [and I take it you changed the channel and the port correctly?]), how do you want to control it eventually?

A common way is to do it via a parameter, what happens then is when you run the script (perhaps from an event) you run it like;

&hs.run("parallax.vb", "Main", "50") - to move it to 50
&hs.run("parallax.vb", "Main", "200") - to move it to 200

But that all depends on getting it to initally to work...
Reply With Quote
  #26  
Old January 1st, 2011, 05:25 PM
Seereus Seereus is offline
Seer
 
Join Date: Mar 2010
Location: Southeast
Posts: 21
Ahhh, OK. Let me try that. It does work very well using something like roborealm and chossing the parallax from the device control list. It also works with software from parallax's website. Been a while PSC something...but I know for a fact the servo and the board both work fine.
Reply With Quote
  #27  
Old January 1st, 2011, 05:50 PM
Seereus Seereus is offline
Seer
 
Join Date: Mar 2010
Location: Southeast
Posts: 21
Ok, still no response from the servo. You have to remember I am really clueless and can only think I am doing this wrong. Take me step by step through what I need to do. Just putting: &hs.run("parallax.vb", "Main", "50") - to move it to 50 into a text file and running it gives this message in the log: 1/1/2011 4:49:31 PM Error Running script, script run or compile error in file: parallax50.txt1024:Expected statement in line 1 More info: Expected statement
Reply With Quote
  #28  
Old January 1st, 2011, 06:17 PM
mrhappy mrhappy is offline
OverSeer
 
Join Date: Nov 2007
Location: W.Mids, UK
Posts: 7,314
Its a learning curve for both of us, i'm afraid if this does not work i'm probably out of ideas - i'm sorry (bitten off more than I can chew I think). That vb.net example is pretty complex, but i've had a look at the sourcecode and come up with something else - its a bit of a leap of faith but here goes;

Code:
Imports System.IO

Sub Main(ByVal Parms As Integer)

Dim Channel As Integer = 0
Dim Ramp As Integer = 7
Dim Position As Integer = 500
Dim Port As String = "COM9"

Dim connection As New IO.Ports.SerialPort

connection.portname = port
connection.BaudRate = "2400"

Try

If connection.IsOpen = True Then
connection.close()
End If

connection.Open

hs.writelog("Parallax", "Connection Open? " & connection.IsOpen)

connection.Write("!SC")
Dim data As Byte() = FormatPscPositionCommand(Channel, Ramp, Position)
connection.Write(data, 0, 5)
connection.Close()

Dim i As Integer
Dim dataStr As String

For i = 0 to Ubound(data)
DataStr = DataStr & Data(i)
Next

hs.writelog("Parallax", "The Data I sent is: " & DataStr)

Catch ex As Exception

hs.writelog("Error", "Parallax Error: " & ex.message)

End Try                    

End Sub

Public Function FormatPscPositionCommand(ByVal channel As Integer, ByVal ramp As Integer, ByVal postion As Integer) As Byte()
	Dim data(4) As Byte
        data(0) = CByte(channel)
        data(1) = CByte(ramp)
        data(2) = CByte((postion And &HFF))
        data(3) = CByte((postion And &HFF00) / &H100)
        data(4) = &HD
        Return data
End Function
Copy all of that code into notepad, change the following lines;

Dim Channel As Integer = 0 <- Change this to your servo channel
Dim Port As String = "COM9" <- Change this to your port COM1, COM2, COM3 etc

save it as parallax.vb in your scripts directory, then go into the HS control panel and write

&hs.run "parallax.vb"

Check your log for any errors and/or see what it says - see also if the servo moves, don't worry about the position you are sending at the minute, just want to know if it moves at all or there is any kind've response from the board (status LED?)
Reply With Quote
  #29  
Old January 1st, 2011, 07:49 PM
Seereus Seereus is offline
Seer
 
Join Date: Mar 2010
Location: Southeast
Posts: 21
OK here is what posted on the log file:

1/1/2011 6:37:06 PM SCR Option Strict OffImports System.IOimports Schedulerimports SystemPublic Module scriptcode22#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin Public WithEvents hs As Scheduler.hsapplication Public WithEvents hsp As scheduler.hsp Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End RegionSub Main(ByVal Parms As Integer)Dim Channel As Integer = 0Dim Ramp As Integer = 7Dim Position As Integer = 500Dim Port As String = "COM13"Dim connection As New IO.Ports.SerialPortconnection.portname = portconnection.BaudRate = "2400"TryIf connection.IsOpen = True Thenconnection.close()End Ifconnection.Openhs.writelog("Parallax", "Connection Open? " & connection.IsOpen)connection.Write("!SC")Dim data As Byte() = FormatPscPositionCommand(Channel, Ramp, Position)connection.Write(data, 0, 5)connection.Close()Dim i As IntegerDim dataStr As StringFor i = 0 to Ubound(data)DataStr = DataStr & Data(i)Nexths.writelog("Parallax", "The Data I sent is: " & DataStr)Catch ex As Exceptionhs.writelog("Error", "Parallax Error: " & ex.message)End Try End SubPublic Function FormatPscPositionCommand(ByVal channel As Integer, ByVal ramp As Integer, ByVal postion As Integer) As Byte() Dim data(4) As Byte data(0) = CByte(channel) data(1) = CByte(ramp) data(2) = CByte((postion And &HFF)) data(3) = CByte((postion And &HFF00) / &H100) data(4) = &HD Return dataEnd FunctionCopy all of that code into notepad, change the following End Module1/1/2011 6:37:06 PM Error Script compile error: 'End' statement not valid.on line 681/1/2011 6:37:06 PM Info Running script statement immediately: &hs.run "parallax.vb"

I changed the com to 13 as that is where it shows the parallax usb controller. Channel is already in zero, so that's ok. Checked the control board, red power light always on but no activity out of green signal light and servo was idle.

I was stoked about running the script I did not answer some of your questions. I basically don't care what controls it whether is automatic or have to do several moves to get it to change. I would just be happy if it worked. You stated to open control panel in homeseer? Not sure what that is, I took it that you meant to create an event an run that so that is what I did. LMK if I should be doing something different. Thank you for all you are doing.
Reply With Quote
  #30  
Old January 1st, 2011, 07:58 PM
mrhappy mrhappy is offline
OverSeer
 
Join Date: Nov 2007
Location: W.Mids, UK
Posts: 7,314
I think some of that script may have disappeared as it works here without error (its very easy if you copy and paste to miss off something and VB is very unforgiving)...i've attached it to this message with a .txt file extension, save it to your scripts directory and change the extension to a .vb file and give it another run.

Don't worry about the control panel, it looks like you are running it correctly (its just a name for the page I think your running it from) whichever way your doing it...

I've changed it to COM13 for you so you should just have to run it straight away.

Last edited by mrhappy; August 17th, 2012 at 11:01 AM.
Reply With Quote
  #31  
Old January 1st, 2011, 08:23 PM
Seereus Seereus is offline
Seer
 
Join Date: Mar 2010
Location: Southeast
Posts: 21
YOU DID IT. As soon as I hit test it moved about a 1/4 turn WOW! It's Working!!!!!!!!!!!!!

1/1/2011 7:18:07 PM Parallax The Data I sent is: 072441131/1/2011 7:18:07 PM Parallax Connection Open? True1/1/2011 7:18:07 PM Info Running script statement immediately: &hs.run "parallax.vb"
Reply With Quote
  #32  
Old January 1st, 2011, 09:01 PM
mrhappy mrhappy is offline
OverSeer
 
Join Date: Nov 2007
Location: W.Mids, UK
Posts: 7,314
Quote:
Originally Posted by Seereus View Post
YOU DID IT. As soon as I hit test it moved about a 1/4 turn WOW! It's Working!!!!!!!!!!!!!

1/1/2011 7:18:07 PM Parallax The Data I sent is: 072441131/1/2011 7:18:07 PM Parallax Connection Open? True1/1/2011 7:18:07 PM Info Running script statement immediately: &hs.run "parallax.vb"
Im relieved, I throught it was going to get the better of me there!

I've attached another script, this time it can accept a servo position via a parameter, reading the docs the value Parallax decided is 250 for 0 degrees and 1250 for 180 degrees. It checks if you try and pass a parameter which the board cannot accept, this time you need to run it using the hs.runex command to pass the parameter. So;

&hs.runex("parallax.vb", "Main", "250") should hopefully relate to 0 degrees
&hs.runex("parallax.vb", "Main", "1250") should be 180 degrees

You can do any value between and the board should calculate it so 90 degrees is 750 (I think) - although the Parallax manual does say that not all servos are alike so you may need to experiment with what relates to what if those values are off.

Thats a very basic method of controlling it, let me know if you want any more advanced ways of doing things and i'll see what I can think of...

Hope it works for you...(its the same deal, place in scripts directory, rename as .vb file and run using the commands above)

Last edited by mrhappy; August 17th, 2012 at 11:01 AM.
Reply With Quote
  #33  
Old January 1st, 2011, 09:02 PM
Seereus Seereus is offline
Seer
 
Join Date: Mar 2010
Location: Southeast
Posts: 21
THIS IS TOO COOL, ok so I got it put into the device list and added a 250 and a 1250 to the scripts folder and now it works by the device list as open and closed. I Knew you could do it. One question though, is there a way to make it turn slower? This is really the jump start I needed. I will start on the blind assembly and get some pics posted as soon as it is perfected. This was really great of you to take the time to do this. I don't have much but I would like to send you something for all the time you took to make this work. Is there a way I can upload a paypal account with a donation? THANK YOU MRHAPPY VERY MUCH. Your efforts are more appreciated than you will ever know.
Reply With Quote
  #34  
Old January 1st, 2011, 09:07 PM
Seereus Seereus is offline
Seer
 
Join Date: Mar 2010
Location: Southeast
Posts: 21
Quote:
Originally Posted by mrhappy View Post
Im relieved, I throught it was going to get the better of me there!

I've attached another script, this time it can accept a servo position via a parameter, reading the docs the value Parallax decided is 250 for 0 degrees and 1250 for 180 degrees. It checks if you try and pass a parameter which the board cannot accept, this time you need to run it using the hs.runex command to pass the parameter. So;

&hs.runex("parallax.vb", "Main", "250") should hopefully relate to 0 degrees
&hs.runex("parallax.vb", "Main", "1250") should be 180 degrees

You can do any value between and the board should calculate it so 90 degrees is 750 (I think) - although the Parallax manual does say that not all servos are alike so you may need to experiment with what relates to what if those values are off.

Thats a very basic method of controlling it, let me know if you want any more advanced ways of doing things and i'll see what I can think of...

Hope it works for you...(its the same deal, place in scripts directory, rename as .vb file and run using the commands above)

WOW, that's even cooler. THANK YOU, I will try this out. With the board supporting 16 servo's it will be just a matter of seeing how far I sling Data across cat5 's. Woo HOO! THANK YOU!
Reply With Quote
  #35  
Old January 1st, 2011, 09:20 PM
mrhappy mrhappy is offline
OverSeer
 
Join Date: Nov 2007
Location: W.Mids, UK
Posts: 7,314
I think I know which way you've done it, two scripts right? Not a problem to do it that way a all so you don't have to use the last script I posted if you don't want to...

Now the speed I think is the ramp rate (quite a nice board this for features), the manual says

Quote:
The R parameter is a binary number 0 – 63 that controls the ramp function for each channel. If the ramp
parameter is set to 0, ramping is disabled and the pulse width will be set to the P parameter sent
immediately. Ramp values of 1-63 correspond to speeds from ¾ of a second up to 60 seconds for a full
500uSec to 2.50 mSec excursion for standard servos. This correlation is rather linear though no equation
presently exists.
So if you open the script and look for the line;

Dim Ramp As Integer = 7

and change this to something like

Dim Ramp As Integer = 50

to slow it down, between 1 and 63 it should relate to the speed (1 - 3/4sec to 63 - 60secs), save the script and run it again to check. It's a bit late and the mention of setting it to zero does slightly confuse me, but I think if you change Ramp to 0 it is as near to instant as you are going to get it
.
And don't worry, I built my stepper controller today ready for fitting into my blind (i'm v. interested in how you end up doing it - lets say i'm better at coding than mechanics ) - i've got the added fun of having to do the PIC coding aswell so i'll be on here asking for help in the next few weeks! Don't worry about a donation or anything, i've got too much time on my hands and much of the credit needs to go to the other people that wrote the vb applications, I just hacked HS and them together

Best of luck
Reply With Quote
  #36  
Old January 1st, 2011, 09:36 PM
Seereus Seereus is offline
Seer
 
Join Date: Mar 2010
Location: Southeast
Posts: 21
Perfect, that is all I needed to tweek this thing. I have noticed this forum is jammed with wizards like yourself. I am really greatful that people like you exist. I cannot thank you enough for doing this. It really makes my day. It will take me some time but I will give you an update once the project is functioning. Thank you again.
Reply With Quote
  #37  
Old January 1st, 2011, 09:49 PM
mrhappy mrhappy is offline
OverSeer
 
Join Date: Nov 2007
Location: W.Mids, UK
Posts: 7,314
Quote:
Originally Posted by Seereus View Post
Perfect, that is all I needed to tweek this thing. I have noticed this forum is jammed with wizards like yourself. I am really greatful that people like you exist. I cannot thank you enough for doing this. It really makes my day. It will take me some time but I will give you an update once the project is functioning. Thank you again.
Thanks for the kind words, ill post some pics of mine if I ever get that far (its been a thing on my to do list since late 2009 ) - nice to be called a wizard but trust me this board is full of people who have jaw dropping coding skills I could only ever dream of!
Reply With Quote
  #38  
Old January 2nd, 2011, 08:07 AM
Seereus Seereus is offline
Seer
 
Join Date: Mar 2010
Location: Southeast
Posts: 21
I just wondered if you have ever looked at the posts and interaction of cctv systems with hs. I have been through this forum over and over and no one seems to have successfully integrated a cctv system. IP and webcams are easy, I am refering to analog cams. I spent months testing several different mfg's of capture cards. The one I settled on was by Hupervision. It is as most, very proprietary but the software beats anything I have ever seen. I have 7 stationary zoom cams and 1 PTZ Speed Dome in the system. The board has the ability to plug contact closures on it. One of the main features that is so cool is the ability for one cam to see motion and tell the speed dome to turn and look at that same location. Plus, Motion tracking, Fire detection, smoke detection, people counter, face detection, license plate detection, the list goes on. To me HA and Surveillance go hand in hand but no integration available. If you happen to come across a script or plugin for analog cameras, I would really like to know about it. The software has a remote interface as well as a web app. There is so much it can do, I am hard pressed to believe that there would be no way to work it into hs. I used the netcam plugin and it sees the capture cards but the actual video capture seems to be the part that it just can't integrate. The blind project is on the bench in test mode...YEAH!
Reply With Quote
  #39  
Old January 2nd, 2011, 08:39 AM
mrhappy mrhappy is offline
OverSeer
 
Join Date: Nov 2007
Location: W.Mids, UK
Posts: 7,314
Quote:
Originally Posted by Seereus View Post
I just wondered if you have ever looked at the posts and interaction of cctv systems with hs. I have been through this forum over and over and no one seems to have successfully integrated a cctv system. IP and webcams are easy, I am refering to analog cams. I spent months testing several different mfg's of capture cards. The one I settled on was by Hupervision. It is as most, very proprietary but the software beats anything I have ever seen. I have 7 stationary zoom cams and 1 PTZ Speed Dome in the system. The board has the ability to plug contact closures on it. One of the main features that is so cool is the ability for one cam to see motion and tell the speed dome to turn and look at that same location. Plus, Motion tracking, Fire detection, smoke detection, people counter, face detection, license plate detection, the list goes on. To me HA and Surveillance go hand in hand but no integration available. If you happen to come across a script or plugin for analog cameras, I would really like to know about it. The software has a remote interface as well as a web app. There is so much it can do, I am hard pressed to believe that there would be no way to work it into hs. I used the netcam plugin and it sees the capture cards but the actual video capture seems to be the part that it just can't integrate. The blind project is on the bench in test mode...YEAH!
To get proper integration it relies on the manufacturer releasing exactly how to talk to their devices (usually called an SDK - software developers kit) a quick google suggests they have not, i'm guessing here but due to the very nature of the line of work they probably don't want everyone knowing the inner workings of their system, I guess its bad for business if somehow you release how to disable the box remotely and its then used in some form of criminality.

I did a quick google and yep looks jam packed with features, but they all look like they stay inside the system - the nearest you look to be able to get to interfacing with HS looks to be the remote viewer application, from the photos it appears some of it is web based. With the webbased applications you can sometimes intercept the links and recreate them in HS. So you might be able to bring the images into HS and do some elementary control of the PTZ, perhaps even press record but thats probably the limit i'm afraid and no guarantee that would work as it depends exactly on how they have designed their pages.

I think thats why there are not many plugins about, theres so many different standards and the lack of info about them unfortunately.
Reply With Quote
  #40  
Old January 2nd, 2011, 03:07 PM
Seereus Seereus is offline
Seer
 
Join Date: Mar 2010
Location: Southeast
Posts: 21
I gotcha, well stated. That does make perfect sense, I do have an SDK folder within the Huper software pack. It's 8 + megs. I wonder if that would be what is needed? I did try the web interface but I kept getting stuck on the password. Every time the frame would refresh I would have to re-enter the username and password. Not fun. I could not find a piece of software or way to get it to save the user/password. Like I said, I worked with several different vendors but this was the first one that really had all the cool features. That is why I was interested in integrating with HS.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:05 AM.


Copyright HomeSeer Technologies, LLC