[FrontPage Save Results Component]

SunPatrol

(download software) coming soon new version

1 - Introduction

2 - The program

3 - Using Sunpatrol

4 - Final considerations

 

Introduction

 

I love DSP and so I write programs like VA, but  I love also photovoltaic plant (and whatever related to clean energy). In particular, I built at home a standalone photovoltaic plant, that is, completely autonomus (I do not need to buy energy from the Italian energy supplier). It is composed from some photovoltaic panels, a sinusoidal inverter, a charge regulator and obviously a lot of batteries. But this is another story, and not the subject of this web page. May be in the near future I'll write a specific web page describing my page, although I think it is not a very interesting subject for the most of the reader of this web site.

My photovoltaic plant is used to power a lot of loads, including a PC used as a Server "always on". It is an old laptop used for file sharing, data backup, forum etc.

Some time ago, for a number of reasons, I bought a VELLEMAN Kit, that is the famous Demo Board K8055 (give a look to the manifacturer web site, search for "K8055"). It is a board connected to the PC via a USB serial cable and allows, by means of a Windows software (the manifacturer provide a simple demo software, source code included) to manage some digital output (8, that you normally want to connect to relays), to read 5 digital input and 2 analogue input; and last but not least two analogue output  with an output range of about 0..5 volt. The internal A/D and D/A converters are not so powerful (only 8 bit of resolution) but if you plan to use it simply as on-off remote controller and for monitoring a couple of analogue input without the need of a great resolution, is pretty OK. In particular, considering the low price, and the possibility to build it from yourself (if you have a PIC microprocessor programmer, you can avoid to buy the Kit). In Italy it has been reviewed from the magazine Elettronica In (www.elettronicain.it) ; the magazine allows to download FOR FREE the whole article (you must register before).

It is rather clear that this article is apparently suited only for the owners of the K8055 board, and actually the software runs only with it; nevertheless, I'm available to modify Sunpatrol adapting it to other different boards (for example other Velleman boards) or any  board, provided someone tell me as interface Sunpatrol with it (for example by means of a DLL and/or C++ example code or whatever). Naturally I should to get at least one of them to tune the software!

So, I had the need to manage remotely  my photovoltaic plant (for example turning it on/off), in particular the inverter, and also, to connect my plant to the whole house wiring (and in contemporary disconnect the house wiring from the energy supplier). And, last but not least, monitoring the charge of the batteries, the sunlight and store these information (values and time of acquisition) in a persistent manner. Naturally, at this point would be very simple to extend the mechanism for example to manage the acquarium lights and so on.

Actually, products that make all this - ready to use - exists, and also with the possibility to choose among a lot of models. But my software born because of three simple considerations: 1) I already had a K8055 demo board, unused (and anyway it is very cheap); 2) I had a server already up and running powered by sun 3) I like to program!

Et-voilą, I wrote a simple software that allow me to do all the things described above, and much more. Naturally, the first version was dedicated to my photovoltaic plant, and this is the cause of the name "SunPatrol".

In a while, I realised the possibility to write, with a little further effort, a general software, and so I write a program named always Sunpatrol but completely general, that is capable to manage remotely the Velleman demo board (via internet!) for whatever scope (domotic, photovoltaic plan, didactics etc).

I put the demo board in a simple case, like that (adding also 8 relays to drive external loads):

 

This is the main window of the Windows program running on a standard PC (Vista, Seven, XP and may be also 9X and server 200X):

Figura 1

In the figure below,  the web page for the remote control of the demo board. It is displayed on a remote PC (with Internet Explorer) connected through Internet  (HTTP) at the software of Figure 1 (i.e.   Sunpatrol  implement a complete autonomous WEB SERVER!):

Figura 2

Three screenshot, just to give a quick idea of the program and related capabilities. Now, I'll try to explain deeply the features of the program and related functions, although on my opinion it is not truly necessary; in fact I tried to design a self-explicative user interface, with no need of a written help (....)     

The software

The created software, as said, is called Sunpatrol but it is NOT created specifically for photovoltaic plant, but you can use it also for photovoltaic plants (by the way, it is possible to modify Sunpatrol to fit needs limited only from fantasy) and it is a remote-control program general purpose that allows to manage remotely by means of  INTERNET and a standard browser (Intenet Explorer for instance, or Firefox, Opera etc.) a Velleman K8055 board. The software was created starting from the demo program provided by Velleman, that you can download freely from the web site. The Italian magazine "ElettronicaIN", in number 90 (july/august 2004) reviewed the K8055 and the demo software. It is possible, as already said in previous paragraph, the whole article from the web site (www.elettronicain.it) for free (you must register before).

The Sunpatrol software is extremely more powerful than the example provided from the manifacturer; it comprised a standalone web server and also the possibility to send email without the need of an SMTP server, provided your ISP has not blocked the corresponding port. In this case you can anyway send the mail using your standard smtp server. The program send e-mail (if desired) to advice you of "events" (for example the switch from off to on of an output or input).

The program allows the following main functionalities:

1) To be managed locally by means of the interface of figure 1, that

:

     -  allows to turn on/off the output by means of checkbox,

     - monitoring the status of the input by means of checkbox (you cannot modify them manually),

     - input level of A/D converter by means of level bar and graphics

     - set the output level of D/A converter,

     - show current time (date and time),

     - graphic display of acquired points (for example, for my plant, the values of battery voltage ),

     - display system log,

     - display and reset of counters.

2) Manage all setup parameters by means of the setting window, available by selecting the OPTION/SETTING item of the main menu. A setting window appear allowing to manage all the parameters of the Sunpatrol program; they are saved in a text file (.INI extension).

Figura 3 a,b,c...

In fig. 3a you can set the address of the K8055 board, the refresh rate of the graphic log, the "sampling frequency" of the A/D converter plus the HTTP parameters (see next point). In window of fig. 3b you can set the parameters of the e-mail (as we will see in another section the program can send e-mails to notify "events" such as the switch of an input/output to on or off etc.). In fig. 3c you can set the values for the timer function, that is you can set four different timers, allowing to turn on/off one (or more) of the 8 available output (normally connected to a relay) at a predefined value of time.

The remaining functions are available in the tabs "Input label Setting", allowing to define custom label for the input checkbox, in the tab "Output label setting", allowing to define, as before, labels for the output checkbox. That labels will be used also in the web page and everywhere replacing the default labels output1,2,3,4,...,8 and Input1,2,3,4. For instance, instead of the default label Output1, related to your on/off switch of you acquarium light, you may use the label "Aquarium".

 "A/D e D/A setting" allows to set labels and scale factors for the A/D and D/A converter, while "log file options" allows to define the cadence of saving of the graphic log; you can choose to save it arbitrarily, with a one day step, or save them in a single file (saved anyway each day at the midnight, for safety reason, and when the program shutdown). It is also possible to save the file each month.

3) The main parameters, and the manual activation of the output, and the complete Timer setup (plus the possibility to monitor the graphic log and event log) may be full web-managed, by means of an autonomous  web server , running and listening on a TCP port (default 80). The fig. 2 is a screenshot of the main web page used to manage the Sunpatrol software; to invoke it, simply type the ip address of the computer running the program while the timer web page is the following:

Figura 4

 

The web page of figures 2 and 4 can accept command only if you digit a predefined password, that you can define in the main window of the setting window (fig. 3a), by pressing the "submit" button after the selection of the desired command (on/off checkbox). Using a wrong password will cause nothing (simply the selected command will be ignored). It is possible that the board needs some millisecond to refresh its state, plus the time to refresh the web page, so you must refresh manually the web page (by means of the refresh link). In other words, it is possible that when you click the submit button using the right password, the "input" checkbox (that you may have choose as "confirm" to your command) will be updated only after some click to the "refresh" link.

Errors in input parameters in the timer web page will be immediately reported in the web page as text message.

General philosophy of the "system": the program run (in background) reading data from the acquisition board (the K8055) with a predefined frequency that you can set in setting window ("Meas Time" option). The data are displayed in a graphics window (in real time) and also refreshing the checkbox status and the level bar of A/D converter. The graphic window display the acquisition time on the X axis (time and date).

The latter can be displayed in "extended mode" by clicking the item "View" and then "Extended graphics", invoking the following window:

Figura 5

It allows to display the same data displayed in the main window, and like that you can "zoom" or explore by means of mouse. Moreover, it has a lot of new options allowing a complete management of the data (at the moment I'm working at a new version). In particular, to zoom you should delimit by means of the left mouse button: put the cursor on the left angle of the rectangle you want zoom to, press the left mouse button, and holding the button down, move the mouse diagonally toward the lower right angle. A rectangle will be painted, and the graphic within the rectangle zoomed. To unzoom, you can press the "unzoom" button or tracking another rectangle as before but in reverse direction. In this case don't  care the dimensions of the tracked rectangle.

To move the graphic (moving it horizontally) you can use the trackbar or the mouse. In this latter case, you should use the right button (holding it pressed and moving it in the desired direction). Take into account, in fact, that the display of the acquired values is limited to a reduced number of values (18 for the extended graphic window, 6 for the standard) to get more legibility. And so,the displayed graphic is a "window" over the whole sequence of values. Note that if you set a frequency capture of samples log of some minutes (or whatever) the window will be filled after a time equals to 18*(frequency_capture) for the extended window.

You can get further information about the acquired values by clicking of the middle button of the mouse (if you have a three button mouse: click on a data bar with the middle button).

A further option allows to interpolate the raw acquired values, according to one of the method listed in the combobox "fitting method". Then, id desired, you can disable, by means of an option located in the menu of the main window, the visualization of the raw data (the bars) leaving only the interpolated graphic ("View" option). In any case Sunpatrol will save only the raw data.

 

Using Sunpatrol

Below a quick guide for using Sunpatrol.

Simply, unzip the zip file you downloaded from this web site (from this page, for example from here), put it in a directory (choose freely the name). The program can be executed without any installation. The files you should find in the Sunpatrol.zip archive are:

SunPatrol.exe = the program

K8055D.dll = is the .DLL provided by Velleman for the control of the K8055 board by means of USB interface. The included version with Sunpatrol is the 4.0.0 downloaded directly from the Velleman web site (www.velleman.de). I think there are no problem for Velleman if I attach it in my file .zip.

Link the board to the computer, execute the Sunpatrol.exe file. Go to the menu item called "option" and open the setting window. It appear with a set of default parameters, included the address of the board (0 = default); for now is not included an automatic routine to search the board. Likely included in the next version.

Then, as each K8055 owner should know, the board is addressed by a two bit code, hard coded by means of two jumper. In the setting window it is possible to define the address in a simple way: 0,1,2,3. The first (0) means the two jumper non inserted (binary 0 and 0 = 0) and so on.

Set a PASSWORD (recommended), very important to manage remotely the board by means of a web browser. The password allows to issue commands when use the web page: to be executed click the "submit" button after password insertion. The password is also important to avoid that others than you can enable/disable your device!

At this point all is ok and ready to run. Close the setting window and click the "Connect" button. Now, the program is running with parameters defined in setting window.

Now you can set ON/OFF the output (output of the board, that is enable/disable the - for example - relays connected to the open collector output of the board), read the digital input, the analogue input and set the output value of the D/A converter. From the main menu "File" option you can click on the item "Tray" , that will reduce the program to an icon on the tray bar, leaving the program working in background. Or, equivalently, click on the standard border icon (to iconize the program) that will cause, instead of iconizing, the same effect as before.

Keep in mind that the program implement a complete web server, running on the desired port; if you have another web server running on standard port 80 you must select another port, otherwise Sunpatrol will raise an exception and won't work. For example I do not use the standard 80 port for safety reason. Do non forget to "authorize" Sunpatrol if your firewall will try to block it; Sunpatrol IS a server and then IT IS NOT a virus or spyware or whatever. Naturally to be sure the program has not been altered by hacker you should download it only from the www.sillanumsoft.org web site (this web site).

At this point go to a remote PC located in your private network or elsewhere in the world (but internet connected ) and try to manage the program by Internet Browser. Digit the address of your server (as a standard IP address or a symbolic name if you have one, for example obtained by means of a free service for dynamic address as DynDNS - www.dyndns.com ). And remember that you cannot use the address (symbolic or not) within your internal network (subnet). In this case you must use a local address as 192.168.x.y.

For example my internet provider give me a dynamic address, that I "staticized"  through dyndns and other stuffs (casa.accattatis.org), and so, when I try to connect from a remote location to my server (for example when I'm at work) I digit something like that:

http://casa.accattatis.org:XX

where XX stands for the number of the port I choose. The same if I use a computer connected in my private home network, except that I must use an address of the form "192.168.x.y", that is, in my case, 192.168.1.100.

This is what appear on the browser:

From this page you can manage the output and read the input; by clicking on the REFRESH option you can refresh the page, and so read the updated values. That in my case is the voltage of the photovoltaic panels and the state of charge of the battery. In my case I use the label "Welcome to Accattatis server", but you can use a personalized one.

Final considerations

The program has been written for my personal use, and so it is absolutely FREEWARE. I plan to build a custom hardware, to not being obliged to use a third part hardware, although for now I'm very satisfied of K8055. In any case the compatibility with K8055 will remain. I'm available to extend the use of the software to other boards, provided I will get the hardware and software needed to adapt Sunpatrol. In other words, if someone is interested to use my software with other boards should send me at least one of it!

The K8055 board is produced by Velleman, and distributed in Italy by Futura Elettronica (www.futuraelettronica.net). The Italian magazine ElettronicaIn published two articles about K8055 that you can download freely after registration.

In my case, I have a little server "always on" and then using a software is even better than using a dedicated standalone hardware (network connected) as many exists. Moreover, I can modify and adapt the software for my personal needs. The only limit to the possibility of a software like Sunpatrol and a K8055 board is the fantasy! Naturally, suggestions are welcome, as well as bugs individuation. 

Thanks to the experience acquired developing Sunpatrol I'm thinking to build a "Web Edition" version of Visual Analyser, and many other useful programs.

Suggestions, bugs, and whatever are welcome, please use the e-mail used for VA (go to main page of sillanumsoft web site).

Alfredo Accattatis