Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!boulder!sunybcs!rutgers!clyde!watmath!thfisher From: thfisher@watmath.waterloo.edu (Terry Fisher) Newsgroups: comp.sys.cbm Subject: Re: Commodore 64: How do you control a simple AC relay? Message-ID: <15543@watmath.waterloo.edu> Date: Fri, 13-Nov-87 20:19:07 EST Article-I.D.: watmath.15543 Posted: Fri Nov 13 20:19:07 1987 Date-Received: Sun, 15-Nov-87 17:36:17 EST References: <2955@bnrmtv.UUCP> <15408@watmath.waterloo.edu> <6388@sunybcs.UUCP> Reply-To: thfisher@watmath.waterloo.edu (Terry Fisher) Distribution: na Organization: U. of Waterloo, Ontario Lines: 136 Keywords: Commodore 64, Hardware, User Port, Relay Summary: here's the circuit!!! In article <6388@sunybcs.UUCP> bowen@joey.UUCP (Devon E Bowen) writes: >In article <15408@watmath.waterloo.edu> thfisher@watmath.waterloo.edu (Terry Fisher) writes: >> >> I don't remember the circuit off hand, but if you >> are interested, I can post a schematic and a simple program to run it. >> >>Terry Fisher > >Please do... > Devon Bowen (KA2NRC) > University of Buffalo > >********************************************************* >uucp: ..!{ames,boulder,decvax,rutgers}!sunybcs!bowen >Internet: bowen@cs.Buffalo.EDU >BITNET: bowen@sunybcs.BITNET >********************************************************* Okay, here it is. Enjoy!!! If you have any questions, let me know and I'll try to help. The following circuits will switch AC circuits. The first will handle resistive loads (ie light bulbs) ---v--- +5 ---------------+| |+----\/\/---------+------------out | | / | load 10kohm /--+| MOC |+ 180ohm | +--out \ b |-+c | 3010| |--+ | OUT -\/\/---| +| |+--------------| | |-+e ------- gate |--+ +--in 2n2222 ^ \ | 110 vac | / +------------in GND ------------+ triac (Radio Shack 276-1000) (will handle 6 amps) For inductive loads (ie motors) the following circuit should be used. v0.2 uF 160V (note this is not a +-----||--------+ / connection) ---v--- | |/ +5 ---------------+| |+----\/\/--+--\/\/-----+---)--------out | | / \ | | load 10kohm /--+| MOC |+ 180ohm 1.2kohm | | +--out \ b |-+c | 3010| |--+ | | OUT -\/\/---| +| |+-------------------| | | |-+e ------- gate |--+ | +--in 2n2222 ^ \ | | 110 vac | / +---+--------in GND ------------+ triac (Radio Shack 276-1000) (will handle 6 amps) NOTE: the triacs will require heat sinking. When building either of these circuits, make sure that everything is connected properly before connecting it to the computer. If you make a mistake, you can say good-bye to your C-64. Also it would be a good idea to enclose the circuit when finished in order to prevent someone from touching one of the high voltage connections. The OUT pin on the schematic should is one of PB0-PB7 on the user port. You will need a 12/24 .156in spacing card edge connector. Sample program: 10 REM PROGRAM TO TOGGLE TURN ON/OFF THE AC CIRCUIT. 20 REM BY TERRY FISHER 30 : 40 OUT = 0: REM THIS ASSUMES THAT OUT IN THE CIRCUIT IS CONNECTED TO PB0 50 : REM IF YOU USE A DIFFERENT PB LINE, SET OUT EQUAL TO THE 60 : REM PB LINE USED. IE. IF PB3 WERE USED CHANGE OUT = 0 TO 70 : REM OUT = 3 80 POKE 56579,255 90 POKE 56577,0 100 PRINT "PRESS ANY KEY TO TOGGLE OUTPUT" 110 GET A$: IF A$ = "" THEN 60 120 X = PEEK 56577 130 IF (X AND 2^OUT) = 0 THEN POKE 56577, X + 2^OUT 140 IF (X AND 2^OUT) <> 0 THEN POKE 56577, X - 2^OUT 150 GOTO 100 You could connect up to 8 of these circuits to the c-64 at one time. The program would need to be altered some to take care of the extra ouput lines. Another method of switching circuits is to use a relay. A simple relay controller to control a relay follows +5 -------------------+ 1n4001 | \ +------+-------------------- + 10-25 volts to 10kohm | \ | | activate the \ b |--+ c __ ) +-- - relay OUT --\/\/---------| /\ ( coil of relay | |--+ e -- ) | / | +------+ | 2n2222 | b |--+ c | +----| | |--+ e | 2n3055 | | GND --------------------------+------------------------+ The program above will also work with this circuit Also note that the 2 relay connections that get connected to the circuit to be switched are not shown in the above diagram. The above circuit turns the relay on and off. If you are really interested in interfacing your c64 to the outside world, you should get the C-64 Interfacing Bluebook. I don't know where to get it, but I have used mine extensively. (these circuits are simelar to ones in the VIC-20 Interfacing Bluebook.) DISCLAIMER. I am posting these circuits for your benifit. I cannot be held responsible for any damage done to your computer by improperly connecting it to high voltages. While these circuits are not extremely complicated, if they are connected improperly, they could damage the computer, and posibly cause electrical shock to someone if they were to touch live wires. IF YOU DO NOT KNOW WHAT A TRANSISTOR, OR A DIODE IS, YOU PROBABLY SHOULD NOT BE BUILDING THESE CIRCUITS. GET SOMEONE WHO KNOWS WHAT HE IS DOING TO BUILD THEM FOR YOU. -- watmath!thfisher // \\//-\miga user. The meek shall inherit the earth because everyone else is leaving. Disclaimer: Would you claim these ideas? Neither do I.