The concept is that we take a controlling voltage from the computer or a micro-controller, which drives an electrically isolated circuit with Relay or Triac.
You must choose a Relay circuit, if you have a big coffee-machine (greater than 200W or so), otherwise you can use a triac-based one.
All circuits presented are at least once tested, but it’s YOURS RESPONSIBILITY the results. If you have no experience with electronics you should NOT try with these, otherwise you may get a bad one…
You should be very careful while experimenting with 220V, and there is no obsolesce in using an appropriate fuse.
(Thanx to tldp.org)
Step 1 Driving voltage 0-5V from the computer.
Pin 10 is the acknowledge signal (ACK), controlled by you, so that you can produce an interrupt to the CPU.
Pins 18-25 are short-circuited and this is the ground (GND).
Step 2 Controlling with a relay.
Step 3 Controlling with TRIAC v1.
If you only want a simple circuit, you can use Motorola’s triac driver MOC301012 (or other opto-isolator), together with a general purpose TRIAC like SC141D (NTE5608). This method has the advantage that you don’t need an extra power supply.
For non-inductive loads this is the circuitry: (See picture)
If you are going to work with 220V, prefer a 3021. Inductive loads should be used in conjuction with bypass capacitors, see Motorola Application Note AN-780. Coffee-machines are mainly resistive loads and not inductive (like a motor), but who knows what’s yours…
Step 4 Controlling with TRIAC v2.
The MC3032 is an optoisolator TRIAC driver. The 180-ohm resistor sets the current for the LED emitter in the optoisolator. Change the value of this resistor – if necessary – to get reasonable current (e.g., 15 mA).
Note that you cannot test this circuit without a load. The TRIAC will not switch unless connected to an AC voltage source, so you can’t test it for simple switching w/o applying AC and a load. Note the 500V rating on the .01 cap.
Step 5 Etc.
Here are three examples of controlling a relay from the PC’s parallel printer port (LPT1 or LPT2). Figure A shows a solid state relay controlled by one of the parallel port data lines (D0-D7) using a 300 ohm resistor and 5 volt power source. The solid state relay will energize when a “0” is written to the data line. Figure B and C show mechanical relays controlled by two transistors. The relay in figure B is energized when a “1” is written to the data line and the relay in figure C is energized by writing a “0” to the line. In each of the three circuits, a common connection is made from the negative side of the power supply to one of the port ground pins (18-25).
There are three possible base addresses for the parallel port You may need to try all three base addresses to determine the correct address for the port you are using but LPT1 is usually at Hex 0378. The QBasic “OUT” command can be used to send data to the port. OUT, &H0378,0 sets D0-D7 low and OUT, &H378,255 sets D0-D7 high. The parallel port also provides four control lines (C0,C1,C2,C3) that can be set high or low by writing data to the base address+2 so if the base address is Hex 0378 then the address of the control latch would be Hex 037A. Note that three of the control bits are inverted so writing a “0” to the control latch will set C0,C1,C3 high and C2 low.
For more Detail: External device control (i.e. coffee machine).