PDA

View Full Version : Diy controller. Has anyone ever used a usb relay?????


jdoenumber2
05/23/2011, 12:32 AM
Its a usb switching relay????????

http://www.sparkfun.com/products/9669

MaLi
05/23/2011, 01:37 AM
... at $60 per four channels I will pass. :fun2: You will be better off with a reefkeeper or any ready made controller.

cheers,
Marian

BeanAnimal
05/23/2011, 05:13 AM
Unless, of course cheap is not the goal and DIY PC based is.

jdoe,
The product will work, as will those from activewire, labjack, phidgets, etc. You will need to write the software using a language supported by the product and the stability if the controller will depend on your software and the stability of the system it runs on.

I am currently using a combination of USB and ethernet I/O products for my lighting and some other functions. I had built an Atmega128 based controller, but once again interested in a PC based solution.

MaLi
05/23/2011, 05:06 PM
Bean I am not so sure I will recommend the method.
In order to run an USB relay board one will have to avail the use of an operating system and on top of that to load a set of drivers for which (as you said) a control software will have to be written. In my mind is way to complicated and not worth the trouble. Interesting thou will be to involve a cheap Android tablet and use that as a monitor/control/webserver device. Other than that .... :beer:

cheers,
Marian

BeanAnimal
05/23/2011, 06:04 PM
Mali,

To build an aquarium controller using a microprocessor you need to buy and/or build the hardware, including I/O devices and user interface or display devices. You then need to write the software and device drivers. This includes understanding and working with bit and byte level code and understanding protocols like i2c, twi, spi, arp, tcp/ip, modbus and the timings that go with each, etc. While there are certainly some dev environments that are almost 3G, most still require a LOT of learning and understanding of low level stuff. You also need a development platform, soldering skills, and rather extensive programming knowledge of either machine code, C or BASIC.

With a PC based platform, once can purchase a ready built product from one of the vendors listed above and simply write code using just about ANY 3rd or 4th generation language from C, VB, .NET, Java, Flash, Pearl, HTML/XHTML/PHP, etc. This is FAR easier than rolling a controller from scratch and in many cases far more versatile.

I have built many dedicated microcontroller projects and as many PC based projects. My recent endeavor is a hybrid of the two. One can buy an 8 channel Ethernet based power controller for about $100 and control it via any language that can be used to send html post or get requests. To do the same with an Atmega128, it took me many hundreds of lines of code, just to get PING working.

Purchasing an off the shelf controller is simple. Windows or Linux based controller is the next easiest, and building a microcontroller based project is by far the most complex.

fppf
05/23/2011, 06:55 PM
I would never trust a PC to any type of control. There still unstable and a lockup at the wrong time can spell disaster.

BeanAnimal
05/23/2011, 09:17 PM
That is a fairly narrow statement that may or may not be valid depending on both the context of the "PC" and the duties it is asked to perform.

PCs (Windows, Linux and others) can be found at the core of an ever growing number of automation products from industrial control to home and building automation. From traffic light control systems to automated soldier system. From set top boxes to web servers.

I have Windows based servers (NT, 2000, 2003 and 2008) that regularly have error free up-times of well over 900 days without a reboot and workstations that have similar up-times. Stability is primarily a function of the software running on the system. If the software is stable and the system is built on a stable hardware platform, then it will be stable. There is (clearly) a huge difference between a PC that doubles as a gaming rig and photoshop host to that of a machine that runs only software dedicated to a single task.

PCs are actually very fault tolerant devices that can handle numerous types of software or hardware faults without complete failure, and if setup properly can warn the end user via SNMP, SMS, EMAIL etc. Many software and hardware product have watchdog timers that can be configured in many ways. The hardware is very robust and not easily damaged by power surges handling.

Most hobby controllers are not at all fault tolerant and the hardware is far from being robustly engineered or fail-safe, to the point that several brands have well known failure modes and interference problems.

With the application of some basic design logic, a rather fail-safe PC based control system can be easily designed. Certain functions like dosing and temperature control are almost always left to stand alone commercial/industrial control systems. This should be a consideration regardless of the choice of "reef controller". By placing the critical life support systems on dedicated devices, the danger of a "reef controller" crash causing a catastrophic event are minimized, if not eliminated.

In my case the PC provides the logic for the lighting schedules, and provides a common location for data logging inputs (PH, ORP temperatures, flow rates, etc). The PC has the ability to send email, sms or even call me. I have a web interface, iPhone interface in the works and DTMF driven control and reporting. All relays are Ethernet based, and each discrete port can be set to a pre-configured state in the event of a reboot. The Ethernet controlled relays have time scripting built in so that things like a feeding timer (or for that matter a light schedule) only need a single discrete HTML or UDP trigger and then run their pre programmed timespan.

Furthermore, I can control the Ethernet relays via their built in web servers if the PC does crash and burn.

Watchdog timers have been implemented to reset systems and/or contact me if there is an outage.

So you may not ever trust a PC (and that is certainly ok with me), but that does not mean that they can not be trusted.

terahz
05/23/2011, 09:36 PM
jdoenumber2, yes they will work just fine if you want to control from your computer. You can probably even talk to them via another micro (from the photo it looks like a PIC IC on that board). Just keep in mind that they are 5A relays so don't go off running a bunch of 450W MH on one relay.

FWIW, I wouldn't run a full blown computer just to control a few relays and collect information from a handful of sensors. It is like killing a mosquito with a nuke.

fppf
05/23/2011, 10:45 PM
I'm a system integrator and controls expert. I do this stuff all day every day.

Turning lights on and off is not really "Control"
If your just turning lights on and off and recording non critical data, yes a PC is fine.

But I would never control temperature or any other critical function that has feedback and stimulus. I consult customers everyday on the best methods and practices to control stuff from little parts to multiple loop aerospace hardware. I'm always steering away from PCs and have never had an unhappy customer.

MaLi
05/24/2011, 04:29 AM
Well gentlemen ... we are all in violent agreement :wavehand:

I guess we all got way too comfortable with the simplicity of Arduino base controllers and anything else just seems to be simply too complicated.

To the original question; yes you can use it. If you like it and have a PC that you trust (with your fish and corals :-)) go for. Sparkfun should have a driver for and I guess with couple of lines in VB or VC you will be able to flip on/off lights or pumps. Go for and let us know the output.

Would this be a proffered method ?? probably not. many reasons and we can debate till next week. I guess you all have better things planned for Memorial Day. Have fun !

cheers,
Marian

BeanAnimal
05/24/2011, 07:46 AM
I'm a system integrator and controls expert. I do this stuff all day every day...
...I'm always steering away from PCs and have never had an unhappy customer.
I am very aware of your job description, as you often post it in an attempt to discredit those who do not agree with your opinion. Measuring credentials is pointless and has no bearing on my comments. In the context of YOUR customers, a PC may not be the best practice choice but an hacked together Arduino board is not likely either!

Please, lets keep the discussion in context :)

You steer customers away from PCs and have happy customers. That does not mean that steering customers towards PCs would make them unhappy. The first statement is fact, the second is false logic based on the initial fact.

Please don't miss the context of my remarks. Given a specific application, a PC may not be suited to your customer's needs. I am NOT even remotely attempting to make the case that a PC is more suitable or as stable as an engineered, dedicated control system or a competantly engineered PLC system!! I am pointing out that your design criteria, budget and operating environment for a customer is not the same design criteria, budget and operating environment as a reef controller. Certainly best practices can be considered and/or applied but the contexts of the systems are worlds apart.

My comments were clearly in context to this thread and a "DIY reef controller" based on a PC platform.

Turning lights on and off is not really "Control". If your just turning lights on and off and recording non critical data, yes a PC is fine. To debate what constitutes "control" is pointless. You made a blanket statement regarding "PCs" as unsuitable. That statement had little context or depth with regard to functionality or application. I have kindly responded adding context and depth in order to show that in fact, PCs can be very well suited to DIY reef control projects (among other things).

I pointed out that with a little bit of common sense and planning, a dedicated Windows or Linux based system is more than capable of functioning as a "reef controller". I mentioned that (in my opinion), critical life support systems such as temperature and chemical dosing functions would better be performed by autonomous systems, regardless of the controller topology chosen.*

*A well engineered PLC with redundant control paths could be the exception, but they are not part of the context of this thread.

It is all a matter of context and in the context of our hobby, a PC can be well suited to a DIY reef controller project. Temperature control is so very important to our systems, that it (again in my opinion) is best left to a stand-alone system comprised in a fail-safe manner.


But I would never control temperature or any other critical function that has feedback and stimulus. . I stated as much, and added that I would not trust an integrated "hobby controller" either. Integrated life support functions would be better suited to a PLC, but even in that case, real world life support systems are often comprised of discrete systems that collect feedback and act upon it autonomously.

BeanAnimal
05/24/2011, 07:56 AM
Well gentlemen ... we are all in violent agreement :wavehand:

I guess we all got way too comfortable with the simplicity of Arduino base controllers and anything else just seems to be simply too complicated. I love designing and building microcontoller projects and have done so on many platforms over the years. I think what most of us forget is that it was not so simple when we started :)

PC based system = plug stuff in and write some code.
uC based system = learn stuff, build stuff, calculate stuff, write some code.

In other words if you already know how to build and program a uC, you already have ample skills to program a PC. In the converse, if you only know how to program a PC, then you may be lacking the skills to build a uC.

I go back and forth between the two technologies and that is why I likely find myself being more comfortable with a hybrid of the two. My latest project is an automated drip irrigation system for my raised bed gardens. I started with a uC but have ended up with a rather simple PC based code set and (again) Ethernet relays. At first, I built my own Ethernet relay boards using an Atmega and Wiznet modules, but what a PITA when off the shelf products are cost effective and work well :)

My current reef project does use Atmegas as the basis for the dosing system, dimming systems and power monitoring systems.