Here, the parallel port (or output interface) drives the LED inside the OptoIsolator in sink mode: when the line is low, the LED turns on. The +5v comes directly from the computer's power supply, from batteries, or from a separate PSU. Because the current in this branch is pretty small (about 10mA), there is no problem with noise and interferences. The stage to the right uses a separate power line that should come from an independent power supply unit. Its voltage depends on the relay's needs. Depending on the size of the relay's coil, the reverse currents generated when the relay turns off (shunt by D1) can cause spikes on the power lines. If needed, insert RF chockes and filters on + and - to reduce them. At last, the LOAD (lamp or so) is powered by whatever you need. Again, for large loads, use filters to suppress dangerous spikes. |
|
Again, the parallel port (or output interface) drives the LED inside the OptoIsolator in sink mode: when the line is low, the LED turns on. The +5v comes directly from the computer's power supply, from batteries, or from a separate PSU. Because the current in this branch is pretty small (about 10mA), there is no problem with noise and interferences. The stage to the right uses a Triak to directly drive the load by the main power that must be AC (otherwise once lit, the load will be on until you disconnect it). Again, for large loads, use filters on the main lines to suppress dangerous spikes. |
Now is the time to start sending data to our interface. If we use our own interface card, then we need to know at what I/O address it is mapped, then perform an [ OUT (address),data ]from Basic. If we use the parallel port, it is just as easy, use [ LPRINT CHR$(data); ] instead. Don't forget the ";" after LPRINT or the system will send 10 and 13 also as "End of line" and "Carriage Return".
Data is a number between 0 and 255; in binary each one of the 8 bits controls one of the lines. According to your diagram, either a 0 or a 1 will activate each load. For our interfaces above, we need to send out a "0" to turn one relay (or triak) on.
Start from something like this: