|
ANY-maze Help > The ANY-maze reference > The I/O page > Making I/O connections > Connecting using generic digital I/O devices > Turning something on and off Turning something on and off
IntroductionThe purpose of this topic is to describe how to use a generic I/O device to turn some equipment on and off. This might be a lamp, a buzzer, a shocker, etc.
Types of outputThe generic I/O devices supported by ANY-maze have three types of output, TTL level outputs, open collector outputs and relay outputs. Of these relay outputs are far and away the most useful, indeed other than specific situations, TTL and open collector outputs generally can't be used to switch anything on and off. Relay outputsAs you may know, a relay is simply a mechanical switch that can be activated electronically. Thus your computer can send a signal to the I/O device which can close or open the switch. Most relays in I/O devices are of what's known as Form C relays meaning they have switch inside them, like the one shown in figure 1.
Figure 1. A Form C relay. When the relay is inactive the COM terminal is connected to the NC terminal, when activated the COM terminal is connected to NO.
As can be seen in figure 1, the relay has three terminals COM (common), NC (normally closed) and NO (normally open). When the relay is inactive the COM and NC terminals are connected together, when the relay activates the COM-NC connection is broken and the COM terminal connects to NO. So using a relay as a simple on/off switch is very easy, you just connect to the COM and NO terminals. In fact, in some cases you may wish to connect to COM and NC - that way when the relay is inactive your switch will be on and when the relay activates the switch will turn off. Although relays are very easy to work with, there are a few things to watch out for:
Although the circuit to switch a lamp or a buzzer is quite obvious, it may seem less obvious how to switch a shocker on and off, or how to switch a food hopper so it dispenses a food pellet; however, a little time studying the device's manual will usually provide an answer. For example, many shockers include a 'remote control' connector, which simply has two terminals - connect them together and the shocker comes on. So these two terminals can be connected to the relay and you're done. In the case a food hopper you may find, for example, that a pellet will be dispensed if 12VDC is applied to a certain input. In this case you can connect a 12VDC supply to one side of the relay and the input on the hopper to the other side. Now when the relay closes the hopper input will be connected to 12V and a pellet will be dispensed. It's worth pointing out, that within ANY-maze it's very easy to create outputs that switch on momentarily, which is exactly what you'd want in either of these shocker and food pellet dispenser examples. You'll find more information about how to create momentary output switches here. TTL outputsAs mentioned above, a TTL output on its own is not really able to switch anything, although you may find that some devices, such as shockers, have a TTL level input on them, in which case simply connecting the TTL output on your I/O device to this input (and connecting GND too) will allow you to control the shocker. But if the device you want to control doesn't have a TTL input are you completely lost? Well, almost. Probably the easiest thing to do would be to change over to use a different, relay based, I/O device, but if you feel adventurous you could build a circuit to use your TTL output to switch either a mechanical or solid state relay. This isn't as complex as it might sound, and you can, of course, then choose exactly the right relay for your needs. If you're interested in further information then contact ANY-maze Support. Open collector outputsAn open collector output describes the type of output formed by a transistor that has its emitter connected to ground and its collector left 'open' - as in figure 2. Thus, when the transistor is conducting (i.e. active from ANY-maze's point of view) the 'output' is, effectively, connected to ground and when the transistor is inactive the 'output' is floating.
Figure 2. An I/O device with an open collector output.
In principle an open collector output is very useful, for example the circuits shown in figure 3 could be used to switch the LED on and off (figure 3a); to make the TTL input read a logic 1 or logic 0 (figure 3b); or activate the relay (figure 3c). However, the problem with open-collector outputs from a input/output interfacing point of view is that they usually only work at relatively low voltages and currents - around 12VDC and 100 milliamps maximum.
Figure 3. (a) An open collector output used to control an LED; (b) An open collector output used to provide an input to a TTL level input; (c) An open collector output used to control a relay.
So, to actually make use of an open collector output you will usually want to connect it to a relay (either mechanical or solid state) and have the relay switch the device you wish to control. The circuit in figure 3c can be used to do this. Here the diode is included to protect against voltage transients as the relay switches on and off.
© Copyright 2003-2026 Stoelting Co. All rights reserved ANY-maze help topic T0921 |