'Inteligenty' dom ze sterownikiem PLC
Główna => Sterowanie i Wizualizacje => Wątek zaczęty przez: DZIKI_2005 w Marca 05, 2011, 06:28:49 pm
-
Jak załatwić najprościej sterowanie przez komórkę?
-
Witam,
Wszystko zależy od tego, co chcemy robić. Jeśli sterować kilkoma funkcjami, wystarczy jakiś odbiornik/nadajnik z kartą sim, który odbierze smsy i zewrze wybrane obwody. Jedno z wyjść mojego ATG-SV1 mam połączone ze sterownikiem PLC i jestem w stanie wysyłąjąc smsa wyłączyć wszystkie światła w domu.
Do bardziej złożonych funkcji używam nie tyle telefonu, co przeglądarki www, która jest dostępna w większości aparatów. Telefon łączy się z domową siecią przez Wifi, w przeglądarce wybieram adres sterownika PLC, otwiera się strona ze skryptem SSI, przez którą mogę tak naprawdę wszystko.
Trochę więcej znajdziesz na http://www.wspin.duu.pl/index.php?option=com_content&view=article&id=64:ssi&catid=29:podsystemy&Itemid=54 (http://www.wspin.duu.pl/index.php?option=com_content&view=article&id=64:ssi&catid=29:podsystemy&Itemid=54)
Pozdrawiam,
-
Nie wiem czy spotkałeś się z tą aplikacją ale poszukując możliwych rozwiązań sterowania przez komórkę z Androidem natknąłem się na ten film:
http://www.youtube.com/watch?v=D5yT-I9efjg
Sam program znalazłem tu:
http://code.google.com/p/wagoandroid/
Niestety opis bardzo skromny, w dodatku po Niemiecku, którego nie znam ale być może dało by się ten program wykorzystać.
-
Witam,
Wielkie dzięki za linki, nie znalazłem wcześniej tej strony. Wielki plus jest taki, że to wszystko jest open source i można przebudowywać dowolnie. Minus to niestety spora złożoność, na rozgryzanie której brakuje teraz czasu. Tak, czy inaczej, jestem zdania, że przyszłością jest tablet z Androidem przyczepiony do ściany z programem do sterowania domem, z pocztą, Skypem itd... Dedykowane panele z roździelczością 400x600 na potrzeby domu to przeszłość.
Pozdrawiam,
-
Hi,
I hope you speak English, because I dont speak Polish.
I translate everyting with Google translate.
I found your video on You tube very interesting.
Iworking on a simulair project:
http://www.youtube.com/watch?v=3tYHzOOuLBA
But I placed de HTML and Java code in the plc and jou on a other website I think?
I work with this princip from Wago:
http://www.youtube.com/watch?v=PdAKm0_YiRs
http://www.youtube.com/watch?v=IzarLfoPwLg
I can give the code, from my and from Wago.
regards Janus from Spain
-
I forgot my url ;D
http://www.jan-karina.be/android/wago_test2.html
For Android Windows and Iphone
-
Hello Janus,
I'm glad you found my project interesting. I have visited your site. PLC is not as astonishing as all the photos from your journeys. Very impressive!
I also started with placing SSI scripts and the htm pages on the PLC. I have, however, quickly noticed it is an outdated technology. A page placed at the server must be refreshed each time you want to have new data. That is not an user experience of our dreams.
It is, in my opinion, much more effective to have a web page stored locally, on the device which you use (PC, mobile phone etc.) and use AJAX request to fetch the data from the server. There are 2 main benefits of such an approach:
1. The page loads quicker, as it is available locally, so all the html, js, jpg/png files do not need to be downloaded,
2. The Ajax request can be launched at any time, many at once, can be controlled, cued, terminated etc.
Since it was difficult for me to write a script using HtmlRequest, which would work on all browsers, I used the jQuery library, which takes care for all the details. You can see an example page here (http://www.wspin.duu.pl/index.php?option=com_content&view=article&id=70:sterowanie-przez-komork&catid=36:sterowanie&Itemid=70).
So I still use the READPI, WRITEPI commands but send requests in bulks. All the rest you see in the movie is a 'fancy' html and some graphics.
If the link above does not work or the example code is not clear enough, please let me know and I will try to write something better.
Cheers!
-
Hi, I refresh some variables with a javascript
<script language="JavaScript">
var int=self.setInterval("varupdate()",1000);
function varupdate()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","tag_list.XML",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
document.getElementById("MW0").innerHTML="Datum en tijd van PLC (UTC): " + xmlDoc.getElementsByTagName("var1")[0].childNodes[0].nodeValue;
document.getElementById("MW1").innerHTML= xmlDoc.getElementsByTagName("var2")[0].childNodes[0].nodeValue;
}
</script>
So I don't refresh the whole page.
But I think your Ajax is better.
I dit try it but it does not work??
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#Button1').click(function() {
$.post('http://www.mysite.com:8080/READPI',
{ADR: 'QX6.0', FORMAT1: '%d'},
function(data){$('#Result').append(data);
}
);
});
});
</script>
</Head>
<body>
<Div id ="Button1" > Kilknij mij! </div>
<Div id ='Result'></div>
</Body>
</Html>
-
Hi,
It seems we are doing the same thing ;) XMLHttpRequest is a pain in the a... to work with, that's why I prefer a ready-to-use solutions.
Please try to extend the $(document).ready(function() {...}) with additional lines:
$.ajaxSetup({
username: 'ABCABC',
password: 'ABCABC',
});
What error message do you get from the javascriptconsole or the $.post querry?. I use Chrome to debug the pages and enjoy its 'Test element'/right click funcion.
A javascript command like: $.post("http://192.168.1.1/READPI", {ADR: "QX0.0", FORMAT: "%d"}, function(data) {alert(data);});
proceeded by the $.ajaxSetup information works for me like a charm.
Cheers!
-
Can I ask if you want to take a look at it?
This is the website.
http://www.jan-karina.be/android/Test_pool.html
And here is mij PLC:
http://jan-karina.dlinkddns.com:8080/plc/webvisu.htm
-
Hi,
I have sent you an email with a file, which - when placed at my desktop - reads the status of your output being 0
I do hope there is no risk of somebody hacking you site when now you have the address posted publicly...
Best regards,
Piotr
-
I do hope there is no risk of somebody hacking you site when now you have the address posted publicly
Normaly the PLC is protected ;D
I tryed your file on my desktop but it is not working???
-
So after one week of testing ??? someone give me the solution ;D
Instead of getting data direct from the plc $. posten ('http://www.mysite. com: 8080/READPI ',
Ik get it from a PHP page > $.ajax({
type: 'GET',
url: "http://www.mysite.com/wago.php",
data: {ADR: $(this).data('address'), FORMAT1: "%d"},
ajaxParent: $(this),
success: function(data){
this.ajaxParent.append(data)
And on this page I put this code > <?php
$url = "http://www.mysite. com: 8080/READPI?ADR=" . $_REQUEST['ADR'] . "&FORMAT1=" . $_REQUEST['FORMAT1'] ;
$handle = fopen($url,"r") ;
$contents = stream_get_contents($handle) ;
fclose($handle) ;
echo $contents;
?>
That was the trick for me, hopefully it is also usefull for someone else.
-
Hello Janus,
many thanks for sharing the solution... I took us some time to test all the options. At the end the idea of redirecting through another server was briliant. Thank you.
For all the others: attached is the file we used to test the connection.
Good luck!
-
So my site is almost ready.
You can see en test here: http://www.jan-karina.be/piotr/index_pc.html
The 2 buttons on the left "licht zembad" and "pomp zwembad" are test buttons to to write and read.
I'm only hope for a button to write a certain value in the plc.
I need that as a thermostat to start my heating system.
eg. 21 will be 21° in the living.
-
Hi,
I found your site via Janus and a German Wago Forum.
First of all, I'm very impressed by your installation/solution! I downloaded your package from http://www.wspin.duu.pl/wago/jquery.e-dom.plugin.zip and run it (after modifying regarding my own setting).
I run into the same cross scripting problem as Janus with Chrome (it doesn't allow accessing data from another site without tricks) but got it somehow working with Firefox.
Now I can switch on a light by pressing the "button", but the spinning wheel never stop (even though all posts are ok, as far as I can see from the javascript console). Furthermore the light bulb (image) won't light up even though the related output (QX1.1) is true.
Any tipps for me?
Kind regards,
Andreas
PS: Are you going to replace your "regular" visualisation (ie. http://www.wspin.duu.pl/plugins/content/mavikthumbnails/thumbnails/172x116-images-stories-e-dom-ScreenShot002.jpg) with an Ajax solution as well?
-
Try to uncheck your webserver security
(http://www.jan-karina.be/piotr/Clipboard01.jpg)
-
Thank you Janus for you suggestion. I tried it, but it didn't work for me.
Tomorrow I'll try to use your php redirect "trick".
Andreas
-
Hello Andreas,
Hello Janus,
I do not know why it happens that there is a problem with accessing data within the same network. Based on the Janus experience pls try using the redirection via a php file. If you need support at making it work, please let me know.
I will not replace the visualizations. What works through the CoDeSys HMI is fine. If however I get a bigger tablet to hang on the wall I will prepare a new visualization based on html/javascript. I think it is easier to transfer between environments and will be usable in 10 years from now... Anyway - I am sure it is possible to build even better and more fancy things with html. The number of sliders/counters and other gadgets is unlimited.
A new version of the plugin is on its way. I want to make it more general. Janus keeps inspiring me of new interesting usages ;)
All the best!
-
And Andreas,
Do you make any progress?
-
Well, read request are working now - I use a generic php-proxy (see http://www.troywolf.com/articles/php/class_http/proxy.phps (http://www.troywolf.com/articles/php/class_http/proxy.phps)). For write requests I'm able to send the correct value to the wago, but when the wago tries to redirect to the result page it run into infinite redirections...
This is more complicated than I thought it would be :-)
Andreas
-
Sorry Andreas, I mist your post, to bussy with my own project ;D
But why are you not just using the php we I use??
<?php
IF ($_REQUEST['TYPE']=='READPI') {
$url = "http://www.mysite.com/READPI?ADR=" . $_REQUEST['ADR'] . "&FORMAT=" . $_REQUEST['FORMAT'] ;
};
IF ($_REQUEST['TYPE']=='WRITEPI') {
$url = "http://www.mysite.com/WRITEPI?ADR1=" . $_REQUEST['ADR1'] . "&VALUE1=" . $_REQUEST['VALUE1'] . "&FORMAT1=" . $_REQUEST['FORMAT1'] ;
};
$handle = fopen($url,"r") ;
$contents = stream_get_contents($handle) ;
fclose($handle) ;
echo $contents;
?>
-
Update,
Now with Google Gaugemeters and a slider.
(http://db.tt/TZO1EQ7u) (http://db.tt/TZO1EQ7u)
For safety, only button "licht zwembad" and the slider are working :wink:
http://www.jan-karina.be/piotr/index_gauge.html
Ps, There are some browser issues, in IE before version 9 the meters are not working.
-
W O W !!
Absolutely cool!
I'll try to use your PHP script this afternoon. The vacum cleaner just got busted and I have to get a new one :-)
Andreas
-
The jsgauge isn't working any more , Anybody suggestions ?
http://jsgauge.googlecode.com/svn/trunk/src/gauge.js
http://jsgauge.googlecode.com/svn/trunk/src/jquery.gauge.js
-
Hi,
You are looking for the link to the files, or the files are not working?
https://code.google.com/archive/p/jsgauge/
-
Hi I'm looking for the link to the files
The are not in the download files where you point to.
-
Hi,
it seems google has abandoned the project
There is a copy at: https://github.com/Nirvason/jsgauge
or try to use the attachment :)
-
Thank you very much, you make my day :)
It is working again with the zip file.