A noob needs some guidance

edlentz

Member
I purchased a WebControl and a two relay board to interface with my two garage doors. I have just the webcontrol fired up and I can log in and poke around. I even figured out how to change a TTL state. Initially I would like to use my android phone to control the doors using a couple of buttons. I have just about zero experience in writing code. Can someone explain some of this to me? I get the feeling looking at some of the posts here, it appears that some code can offer what I am looking for, is this true? If so How?

Thanks for any help / suggestions

Ed
 
Hi Ed,
writing PLC code is simple. The most simple code is two lines:

start
end

PLC code will run from start to end and back to start all over again. If you want to control your garage door, you can first decide which TTL output is for garage door, then which relay will be hook up to your garage door pushbutton. What do you want to use to open the garage door, just phone or something else?

I have my garage door pushbutton wired to a relay. I installed the RFID reader coil inside the garage door wood frame. When RFID tag put on top that area, the garage door will open. The PLC code is a modified code based on the example from user guide.
 
The example from user guide is like this:
START
CALLSUB LIGHTS
TSTEQ RAM1 0
CALLSUB SET_OP1
CALLSUB CHK4LOW
TSTEQ OP1[1000] 1
SET OP1 0
END

CHK4LOW:
TSTEQ IP1 0
SET RAM1 0
RET

SET_OP1:
TSTEQ IP1 1 RAM1
SET OP1 1
RET

LIGHTS:
TSTGE CH 19 RAM2
NOP
TSTLE CH 5 RAM3
NOP
OR RAM2 RAM3 OP3
RET

which TTL output 1 is drive the relay board to operate the garage door. Relay output stays on for 1 second.
I change the code on the light control using X10.
 
Hi,

Thanks for the help. In your first message you use a RFID to trigger the WebControl I want to either use the web server (on the WebController)from the browser on my phone, or an app on my phone to open and close the doors individually. Setting the output for TTL1 to 1 for 1 second and then set it back to 0. Does using PLC code provide a new web interface?
Sorry for all the questions
 
Controlling the cai from an android phone won't be very clean. To the best of my knowledge, there are no apps for android (and only one for iphone that my friend has and never worked well). Ideally you would want an app to send your commands directly to the cai rather than doing it through the gui. You could bookmark a few pages on your android and use the "post" function on cai rather than going through the gui. Just "open" the page on your android browser for turning on an output for example.

I assume you know that any relays you attach to cai have to work at TTL current limitations. Standard relays will not work (they will fry the cai secondary to over current).

I would love to see someone write a nice Android app. If anyone knows of one already out there, please let me know. I just checked Android store and nothing there. Of course Android apps can be had outside of there store so I don't know for sure all that is out there.
 
Hi Lou,
The relays I have are for a TTL connection so that should be OK. I am going to double check them. I also, haven't seen any Apps for the Android. I do have a crude Android APP I created with a couple of buttons that are links to a web page. So if I want to control the CAI TTL1 and have it change state for 1 second (from 0 to 1 to 0) I could do that from a simple browser bookmark?
 
Here is the Relay board I purchased.

http://www.amazon.com/SainSmart-2-Channel-Relay-Module-Arduino/dp/B0057OC6D8/ref=sr_1_4?s=toys-and-games&ie=UTF8&qid=1349890532&sr=1-4
 
With our example, you can just change the state to 1, after one second, PLC code will change that back to 0. If you can save that URL to turn on the OP1, you can simply run that once, similar to push the real garage door open button once.

You only need to post the PLC code from your PC to WebControl once during configuraiton, then you don't have to touch that any more.
 
Hi Lou,
The relays I have are for a TTL connection so that should be OK. I am going to double check them. I also, haven't seen any Apps for the Android. I do have a crude Android APP I created with a couple of buttons that are links to a web page. So if I want to control the CAI TTL1 and have it change state for 1 second (from 0 to 1 to 0) I could do that from a simple browser bookmark?

Yes. Also see CAI_support comments. Check out the instructions for the cai and you will see the format for URL posts. Basically you go to the "Webpage" for any of the outputs and it will turn it on/off as desired. So you bookmark that "page" so you don't have to type it in every time. When you go to that page, the cai returns confirmation.

If you write PLC code to automatically turn the output off 1 second after it turns on, then you don't have to shut it off manually.

If you can write some simple Android apps that link to webpages, then you should be in good shape to create a simple remote control out of your android phone. Just link your button to the url for turning on various outputs and use the PLC to shut them back off.
 
I don't know if you could save this on the console, or if that work on your phone browser:

http://192.168.1.15/api/setttloutput.cgi?output=1&state=1 to turn on

There is a new iPhone app developed by a user on this forum, but we don't know if there is Android app yet. Maybe we could develop one, if we know what would be most useful for people.
 
Controlling the cai from an android phone won't be very clean. To the best of my knowledge, there are no apps for android (and only one for iphone that my friend has and never worked well). Ideally you would want an app to send your commands directly to the cai rather than doing it through the gui. You could bookmark a few pages on your android and use the "post" function on cai rather than going through the gui. Just "open" the page on your android browser for turning on an output for example.

I assume you know that any relays you attach to cai have to work at TTL current limitations. Standard relays will not work (they will fry the cai secondary to over current).

I would love to see someone write a nice Android app. If anyone knows of one already out there, please let me know. I just checked Android store and nothing there. Of course Android apps can be had outside of there store so I don't know for sure all that is out there.

I've been using OpenRemote for a while now and it works pretty good with the webcontrol board. OpenRemote is very flexible and can be used with a lot of devices android and apple alike. Mine is running on an old netbook I had running windows xp. I plan on moving it over to a raspberry pi board as soon as the bugs get worked out. The one major plus is I have hmailserver running on the same netbook which acts as a gmail relay for the webcontrol board. I needed it because webcontrol doesn't do ssl for gmail.

I have my garage door wired to the webcontrol board. A relay for the opener and a contact sensor to let me know if it is up or down. In OpenRemote, I have a macro setup to send the command to turn on the TTL then off with a 500 millisecond delay in between. I haven't had any problems with it. I even gave the app to my wife and made her a panel with just the garage door on it. Everyone who sees it gets a kick out of it.

I have the webcontrol board packed with so much code, I ran out of vars and rams. Once I got started, I just kept adding on. OpenRemote handles 2 webcontrol boards very well. I have an ipad, 2 droids, iphone and a xoom on it.
 
MobileMe,

That sounds like just about what I am looking for. I have a PC running Win7 as my Home DVR. Would that work with OpenRemote or does it have to be a dedicated machine?
 
I've been using OpenRemote for a while now and it works pretty good with the webcontrol board. OpenRemote is very flexible and can be used with a lot of devices android and apple alike. Mine is running on an old netbook I had running windows xp. I plan on moving it over to a raspberry pi board as soon as the bugs get worked out. The one major plus is I have hmailserver running on the same netbook which acts as a gmail relay for the webcontrol board. I needed it because webcontrol doesn't do ssl for gmail.

I have my garage door wired to the webcontrol board. A relay for the opener and a contact sensor to let me know if it is up or down. In OpenRemote, I have a macro setup to send the command to turn on the TTL then off with a 500 millisecond delay in between. I haven't had any problems with it. I even gave the app to my wife and made her a panel with just the garage door on it. Everyone who sees it gets a kick out of it.

I have the webcontrol board packed with so much code, I ran out of vars and rams. Once I got started, I just kept adding on. OpenRemote handles 2 webcontrol boards very well. I have an ipad, 2 droids, iphone and a xoom on it.

I'll have to look at this Open Remote. I suppose I never found it on a search since it probably doesn't specifically mention cai webcontrol. Thanks for the info.
 
You can run Openremote on any windows (XP and up) or linux computer. Just as long as the PC stays on, your fine. You just have to install java (jdk version) and download the controller. I did a lot of searching on the openremote forums to get it running the way I wanted it to. I didn't have any experience with tomcat and webapps, so it was a long process.

The best thing about openremote is you can customize just about everything. Check it out. It's worth the time.
 
The example fwd03 provided is for a single ttl1 output isn't it? I want to control two relays with two inputs. I tried using a bookmark on my phone and entering the URL to change the state of ttl1 and that worked fine. So, the code example will take an input for ttl1 and then set it to 1 for a second and then back to 0. Can this be added to to make two ttl actions the same?

Thanks
 
Back
Top