HOME >; >; SENSING AND CONTROL MAIN PAGE >; >; CONNECTING SENSORS, ACTUATORS VIA LAN or INTERNET
Delicious Bookmark this on Delicious    StumbleUpon.comRecommend at StumbleUpon

Internet or LAN device for sensing and control

Table of contents:
      Introduction
      Uses
      Making it work...
          Outputs
          Inputs
      The SDK


Introduction:

In 5/05, I became the happy owner of a device you may find a useful: The Aviosys IP Power 9212. It is a network remote controller and sensor.. 8 bits of digital input, 8 of output. You can switch things on and off, or sense the state of diverse sensors from anywhere on your network, be it internet or LAN, using this device. Your sensors and actuators plug into it, it plugs into your network. The IP 9212 has a built in web server. You access it across the net almost the same way as you probably accessed this page.

I obtained mine from www.digidave.co.uk, where they were for sale May 05 for £79 +p&p. He has an eBay reputation you can check out, and he accepts PayPal.

I have since moved most of my attention to the products from HW-Group in the Czech Republic, but you can probably find inexpensive IP9212's on eBay. (I've done notes on the HW-Group products.)

What's it good for? (After we look at that, I'll turn to some work I've done on "How do you make it work?")

You connect the 9212 to your LAN. The 9212 has 8 bits of digital output and 8 bits of digital input. It can, or will, so I'm told, also control a motor... but that's a tale for another time. Aviosys also sell devices to make access to CCTV over a LAN easy.

You then fire up your favorite web browser, and point it at the 9212 (more in a moment). The 9212 has a built in web server, and will cause a page to appear in your browser. That page is a control panel for the outputs, and displays state of the inputs when the page was last refreshed.

In theory, which I don't doubt, but have not tested, if your IP 9212 is connected to the internet, you can access the device from a browser running in any internet-connected PC.

You can also read from / write to the device using programs written by you, not involving a web browser. Sample code is provided in VB and C, and I think you could use Delphi. There's more on all of this below in the section about the SDK. (In fact anything which can access functions inside a DLL.)


Uses:

So... as I said... what's it good for? Basically, it is useful whenever your PC is a point "A", and you want to know about, or control things happening at some point "B"... you just need to be able to connect "A" and "B" with a LAN, wired or wireless.... or (supposedly) via the internet. Here are a few examples. Some require additional devices, of course, and others are not realistic as presented... but are indicative of things which could be made, even if you must increasing the solution's sophistication in come cases.

Imagine you have a greenhouse. You could have it "tell" you when it was hot / cold / humid. You could then, from the desk in your study, open or close vents, control fans, heaters. "Soil too dry" could be tested. "Water that plant" could be commanded.

The unit could be part of an access control system. The inputs could be used to indicate a user's identity, the outputs could open various locked cupboards... under the control of a supervisor who would not need to be in that part of the building. With one IP 9212 unit, 127 cupboards could be controlled with no great difficulty.

There are many more things you could do. Why you'd want an IP 9212 isn't the main reason for this page.

One major point before we leave this section, though: I know you can sense the inputs and control the outputs if you sit in front of a PC on the same LAN as the device. I am told, and believe, that you can also write programs to automate the sensing / control job. So, for instance, if you've wired your greenhouse, you don't have to be there to turn on the heater when the sensor says the temperature is too low. You can write a program to watch and respond.


Making it work:



Before I say more, I must stress:

I am new to this device. I believe it is new to the market.

I am very favorably impressed by the physical aspects of the device. It is well built, and stylish. It consists three sleek metal boxes, 12cm x 8cm x 2.5cm. They are interconnected with simple, readily replacable cables. (Everything you need comes with the device... even an ethernet patch cable.) There's the usual power brick... suitable for 100-240v input, thank you. There are all the status LEDs you could wish for. What's inside looks good, too. In other words... everything you see points to a well made, well designed product.

Having said that... one must admit that the documentation which comes with it is perhaps an early draft.... which is what this web page is all about. The manufacturer's English is a lot better than my Taiwanese... but that still leaves a lot of room for obscurities in the documentation. Also, it should be noted that they are working very hard to produce a good product, and are not really expecting to spend a lot of time doing email with hobbyists who need a lot of help. Pester me first? For one thing, English is my first language, and I may be able to reply more quickly, more clearly.

I am not going to try to cover everything the device is supposed to be able to do.... Don't think it is lacking something, just because my notes fail to mention it.

Great news: If you make mistakes and misconfigure the device, there is a reset button which is supposed to restore it to it's original state.

First connect your rabbit:

Perhaps I'm over cautious, but I'll set out what I would do, in case any of it matters.

Power up the PC that is going to operate the device. Connect it to your LAN.

If I read the documents right, the device can be operated either with a fixed IP address (what I've been doing) or behave according to the commands from a DHCP server which you would have as an existing part of your LAN.

I would suggest, if you can, doing your first work with JUST the controlling PC and the IP 9212 on the LAN concerned. I would also suggest connecting just the "IP Power" box to your LAN initially. And I'd take down your firewalls, if your system can be isolated from the rest of the world while you get started.

To have the IP 9212 maintain the fixed IP address it has, connect the power to your IP 9212 first, THEN connect it to your LAN. Doing it the other way, I think, causes the IP 9212 to look for, accept a "you will use this IP address" command from the DHCP server. I've been staying with a fixed address. I have not disconnected anything when I've rebooted the system. I power everything up before I boot the PC. I have no DCHP server.

So! You have the PC running, the equipment connected.

The next thing you need to do is discover the IP address of the IP 9212. I don't think you need to install any drivers.... though the Aviosys supplied documentation might make you think you do need to.

Insert the CD that came with the equipment. Suppress auto-boot, if you know how. Cancel the offer to install Chinese language support if it arises. Cancel the web page if it opens.

Browse into the Tools folder. Double click on "IPEditV3". I don't think that's a driver; I think it is just an application. Don't let the error messages distress you. Look for an entry in the upper left, under the heading "Camera Lists", where I hope you'll see a line "IP Power". On the right hand end of that line, you should see an IP address... something like 192.168.0.182

Shut down IPEditV3.

Start up your browser (Opera, FireFox, the other one... you choose.)

In the place where you usually put the www thingie, put the IP address. Press enter or click "Go".

A page should open requesting a username and a password. (If it doesn't, remember that your firewall may be to blame.) The username "admin" should already be entered in the box. Supply "12345678" (without the quotes) for the password.

A page should open with tickboxes for the outputs, and maybe some stuff about a motor. (I have yet to explore the motor side of things. I think you need further hardware, for one thing.)

Outputs: There are real LEDs on the front of the IP Power module, which should go on or off when you click the "Apply" button.

Two asides:

First aside: Parts of the documentation speak of half of the outputs being normally open, half of them being normally closed. I don't think this is true. I think that from a cold boot they are, initially, all in the same state.

Second aside: The three boxes that come with the IP 9212 are marked "IP Power", "IP 9201", and "IP 9202". At various places in the Aviosys documents and on their website, there is talk of IP 9201 and IP 9202. I think that they, in most cases, refer to something OTHER than what you have in your package.... I think they refer to alternate products which had built in web servers. Maybe the 9212 replaced an earlier 9201 and 9202, which would make sense, as the 9212 gives you, in effect, two of the old 9201s plus two of the old 9202s, all controlled via a single IP address.

Anyway... by now, you have a working, I hope, system with 8 LEDs under your control.

I THINK you can just plug the output box in. (N.B.: Physically, you COULD plug it in to the WRONG socket on the back of the IP Power unit. Read the labels!) If you are feeling cautious, power down, make the connections, re-power (remembering the issues of DCHP or no). Get back to where you were before. Now when you turn the outputs on and off, connections will be made / broken between the pairs of pins on the front of the output box. (One pair of pins per output.) They seem to run back to the switch contacts of a relay, so, if that's right, you have pretty good isolation of things you connect and your (presumably expensive) computer's internals. The output module's case is not, I don't think, earthed, so for safety reasons you might want to provide an extra layer of circuitry between your IP 9212 system and anything operating on household voltages. If you don't know what you are doing, it is best to avoid household voltages. They are not very forgiving.

Inputs: Again... you can power down if you wish, but, with no inputs connected, I don't THINK you need to. Connect the inputs box to the "IP Power" unit. Get the system up and running again.

A "Gotcha": Unless I'm mistaken, the first four bits are VOLTAGE driven. Ignore them for the moment. (Well... more than a moment. For now, you're on your own with these... I suspect the answer to "how do they work" is what you'd expect... but I haven't explored that yet. Try emailing me, if you need to know the latest info.) Bits 5,6,7 and 8, when your system is working, will "see" a switch: Connect the two pins of any of those inputs together, and the status LED on the IP Power box should change state, and the software should "see" what you've done.

The browser-accessed page that we used earlier to play with the outputs has a link to a "Read Inputs" page. Click on that, and you should be able to "watch" the inputs. The page refreshes itself frequently.


The SDK



I was really excited by the prospect of writing my own programs to read and drive the device. There is an SDK for the IP9212. I believe you can get it from the website, if you do not have it on the CD. (If you have to look for it there, please tell me how you get on? If you send me the URL, I'll put it here for the next person.)

Don't be put off by the "bad news" that appears next... there is good news farther down the page...

There is a sample application for you on the CD. It is available both in VB and in C. Happily, both source code and a finished EXE file are provided. You need to put the Aviosys supplied "socket.dll" in the same folder as the EXE you are trying to run. The one written in Visual Basic just caused a weird hang-up of my machine, but the C version would run... IF....

At one point, BEFORE I tried to run the exe, I had to access the IP9212 via a browser, and go past the User/ password page, and THEN start the other program will. BUT...

.. Be Sure that the first thing you do is to enter the IP address, and click the "Transmit" button. The format you need is:

        192.168.0.182

If you've got all of the above right, you should find yourself "in".

For some reason, I had problems until I changed the device's IP Address to 192.168.0.27 (from 192.168.0.182... don't ask me why it matters!!). NOW I can access the device with one the Aviosys supplied demo programs, without having to log on, enter password via web browser first. NOTA BENE: If you do not enter the right IP address, and click "Transmit", FIRST... the program will hang. This may merely be sloppy programming, but it is not a major flaw in the product.... remember the supplied program is just a demo, trying to show you how to access the device. Such programs are, I think, best kept as simple as possible, and "simple" means leaving out lots of things.

A word of warning: My unit seems to have a flaw: Unless I set BOTH bits 6 and 7 (numbering from "1") high, NEITHER goes high. In other words, if one is low, they are both low. Somewhere in the device the bits are AND'ed. I presume this is just a minor solder whisker somewhere, but if you find similar behavior in your unit, please tell me?

My own program, written with Delphi 2, is now able to read the state of the inputs, and set or clear individual outputs. You can download a scruffy version of the sourcecode if you like. REMEMBER: I said "scruffy"... this is not the way my code usually looks! And you will need socket.dll (see elsehwere on this page) in the folder with the Delphi stuff. If enough people email me, I will put some effort into cleaning up the code. If you email with comments which show you've given some of my shareware a try, I'll get to the code cleanup sooner!

You'll need a copy of Aviosys's "socket.dll" which I'm not sure I can distribute, so I won't... but you should find it on the downloads page of their website. You want the "SW-AP for 9XXX", "Infinity Cam.Zip". That 3.4 Meg zip file has a number of things in it, including, I hope, the "socket.dll" you need. I say "I hope" because if it is, it only emerges after you run the "setup.exe" which is in the zip file. A general point: Don't be too quick to apply the firmware update... you may have that version of the firmware, anyway, and if it isn't broken....

I believe that the device is able to "remember" the state of the outputs from when power was last removed, but I haven't had time to chase the details down. An Aviosys supplied demo program has buttons for controlling a stepper motor via the IP9212, and I think there are routines connected with this in Aviosys's driver dll. AVIOSys sell a motor which I presume is meant to interface with the IP9212... and Digidave sells that, too.

Remember: If you have a use for up to 8 bits of input, 8 of output which you will read / control directly, the Aviosys is just fine. If you know Delphi, Visual Basic or C then it is probably a pretty good unit for you, too.


   Search this site or the web        powered by FreeFind
 
  Site search Web search
Site Map    What's New    Search The search engine merely looks for the words you type, so....
*    Spell them properly.
*    Don't bother with "How do I get rich?" That will merely return pages with "how", "do", "I"....

Please also note that I have two other sites, and that this search will not include them. They have their own search buttons.
My site at Arunet.
My oldest site. (It's at Compuserve).
Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and circulate it for me? At least (please) send an 'I liked the parallel port use page, and I'm from (country/ state)' email? (No... I don't do spam) Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

Other projects

This is just one of the guides I have published on the net. Please visit any of the following that relate to interests you have....

Delphi Tutorials
Pascal programming tutorials
Electronics for hobbyists and schools
Main Home Page

Here is how you can contact this page's author, Tom Boyd.

Index of sensing and control pages (From there you can also go to other help from the editor of this page.)

-- Page ends --