Cheap Easy Opto Isolated TTL To 110V Light Contr
Cheap Easy Opto Isolated TTL To 110V Light Contr
Cheap Easy Opto Isolated TTL To 110V Light Contr
Table of Contents
step 1: Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
step 16: File the case lid and reassemble the box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
License: Attribution Non-commercial Share Alike (by-nc-sa)
Motivation
I wanted a way to completely isolate 110V high voltage circuitry from a low voltage drive circuit. I also wanted to do it inexpensively with easily available parts. The heart
of the device is a light-controlled outlet available for $6.95. The ambient light input is replaced by a small red LED. So this is an affordable way to get into light control for
Christmas displays, stage lighting, or any electrical load where you need only on/off control. The components for this 2-channel example cost $17.90, not including the
various wires which came from scrap.
step 1: Background
The photo shows one of the light-controlled outlets used for this project.
Light-controlled outlets are normally used to light a nightlight when it gets dark. By mounting a red LED directly above the light sensor you can use any digital circuit to
drive a 110V load safely opto-isolated from your low voltage control circuit. This Instructable shows a 2-channel module built into an outlet box, but the concept can be
expanded to any number of channels in any packaging format. I use a pair of compact 8-channel modules to drive an outdoor Christmas tree display using a Basic Stamp
microcontroller.
The light sensor inside these devices is a cadmium sulfide (CdS) light-sensitive resistor which is most sensitive to red-orange light, so light from a low-output red LED is
sufficient to make the outlet turn on. The LED can be driven from any control source.
This Instructable shows you how to modify the light-controlled outlet, converting it into a simple module that has a pair of wires for 110V control and a pair of wires to drive
the LED. If you don't want to do the "circuit bending" required to make this module, you can use the light-controlled outlet as-is by merely mounting the LED over the
sensor externally. Then you can plug as many modules as you want into a power strip and run your LED wires to a suitable controller.
This Instructable does not cover the controller that drives the LEDs. That is left to your imagination. Your controller could be any kind of digital circuit from a bank of
switches to an interface you plug into a PC. At the bottom of this Instructable I include an overview of my simple Basic Stamp microcontroller circuit with source code for
driving a 16-channel Christmas tree.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 2: Parts and Tools
Parts list for one twin-outlet controller module:
Total cost without sales tax: $17.90, not including various hookup wires and "misc" parts.
You can get two channels for just under $20, less if you can find light controllers on sale, they are the "big ticket" item. I did not price the 110V hookup wire because the
type and length of 110V wiring you use will depend on how you connect this module to the rest of your display. For that reason I also did not include any connectors for
the control wires. The wiring shown here is sufficient for testing the module.
Note: you cannot use typical outdoor lighting photo controllers like the Intermatic "Photo Control" p/n K4021C, available at Lowe's for $6.98, and that's too bad because
they would be so much easier to modify this way. They look tempting with their nice pigtail leads and obvious CdS photocell input. However, those controllers are
thermally actuated and take about a minute to turn on and off. So unless you want a really slow display, stay away from them.
screwdrivers
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
soldering iron
file
vise
wire stripper
diagonal wire cutter
needle-nose pliers
continuity tester
hot glue gun
drill with 3/16 inch bit and 1/16 inch bit
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 5: Remove the two external 110V prongs
The 110V fittings are not used, so they are removed to make the module more compact and to create places to attach the 110V wiring. There are two large brass prongs
which are the external 110V connection, and two copper-colored leaf springs which are the internal 110V connections. All four of these must be removed. The first step is
to drill out the rivets holding the large brass prongs. Referring to the picture, use a 3/16 inch drill bit to cut away one side of each rivet. Only remove the protruding lip of
the rivet then stop. The prongs will remain attached by a little bit of solder. To remove a prong, heat the solder and push the prong sideways. Be careful not to tear the
printed circuit traces. The red circle in second photo shows a trace where one of the prongs was removed. If you do tear these traces don't worry too much, it just makes
a later step where you add wires a little more finicky.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 6: Remove the two internal 110V springs
The copper leaf springs are a bit harder to get off. I heated their soldered joints then quickly turned the board over and tapped it against the table to knock most of the
melted solder off. You could also use solder wick. Once most of the solder is removed, you can see each spring is held in place by 3 twisted tabs. Twist the tabs so they
align with their holes and you should be able to pull off the spring. You may have to heat the solder joint again.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 8: Mount LED over light sensor
Bend the LED leads as shown in the picture so the LED drops into the well and the leads drop through the two drilled holes. Note which lead on the LED is the anode
(positive lead, refer to the LED packaging) and mark the corresponding drilled hole. Put the LED into the sensor well so the exposed leads are flat on the top of the case.
Fill behind the LED with hot glue or caulk or whatever you have.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 9: Make a hole for the 110V wires
To fit the module into the outlet box the way I did it in this project, the wires must come out the end of the module instead of coming out the existing holes. Remove one of
the slats from the vent hole as shown. You can snip it off with little cutters or just pry it off at each end with a flat blade screwdriver.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 11: Place the control wires
Take about two 1-foot lengths of small gauge stranded wire. I used a pair I pulled off a ribbon cable. The wires must be colored or marked so you can tell their polarity to
drive the LED. Tie a knot in the wires about 4 inches from one end for a strain relief and pass them through one of the vent slots as shown.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 14: Trim the 110V wires, reattach CdS cell
Trim off the 110V wires and strip them about 3/16 inch so they will align with the pads where they will be soldered, marked IN and OUT in the photo. One pad is the place
where the wire comes through, and the other where one of the internal 110V spring connector was removed. After you trim the wires to length it may be easier to pull the
circuit board off temporarily to strip the wires. Tin the ends of the wires and bend them so they will lay flat over their pads. Trim them so they won't extend past the pads
when they are soldered down.
At this point I reattached the CdS cell leads, circled in red. Why? For no reason I can remember, now that I'm trying to make these pictures into an Instructable. I attached
the leads to the side of the board facing up. If the holes are clean you could try to get the wires back up from underneath but it's not necessary. It also doesn't matter
which lead goes to which pad, CdS cells are not polarized.
If you tore a circuit trace removing one of the brass prongs back in step 5 (like I did on the second module) you can still attach the 110V wire as shown in the second
picture. You just have to be neater about it and be sure you don't make a solder bridge to one of the neighboring traces.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 16: File the case lid and reassemble the box
In order to fit two modules into the outlet box you have to file down the raised rims of the holes where the 110V prongs used to exit the case. Once the rims are filed off
you can snap the lid back onto the case and put the screw back in. I also put a small piece of electrical tape over the exposed LED leads.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 18: Form the 110V leads
The type and length of 110V wiring you use will depend on how you connect this module to the rest of your display. The wiring shown here is sufficient for testing the
module. Since the outlets have a ground, you should use a grounded power cord even though the original modules do not include a ground.
Punch out one of the holes in the base of the plastic outlet box and run the 110V power cord end through. For strain relief I tied a knot in the cord about 4 inches from the
end.
Picture 2: Break the wires out on the end of the power cord and prepare them as shown in the figure. Use a continuity tester to ensure you get the hot and neutral leads
identified correctly. The 110V leads coming out of the modules will be connected as follows: The "IN" leads will be connected together to the 110V cord, the "OUT" leads
will be connected individually to the outlet.
The ground and neutral wires on the power cord should be tinned and formed into hooks to make a neat connection to the outlet and the same for the 110V "OUT" leads
from the modules (arrows).
The hot wire on the power cord should be left bare and the same for the 110V "IN" leads from the modules (circles).
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 20: Assemble into the outlet box.
Feed the control wires for the two modules out through one of the openings in the bottom of the outlet box. Put the modules face-to-face (arrow) and push them to the
bottom of the outlet box, they should just fit and leave room at one side for the wires to come into the box. Stuff the rest of the wiring in behind the outlet and screw it to
the box. Mount the faceplate over the outlet and the assembly is finished.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 22: A word about power capacity.
The modules used here are each rated to control 400 Watts. However, they are air-cooled via the vents, so with them packed into an outlet box like this you might want to
limit the load to 200W on each outlet or drill vent holes in the outlet box to align with the vents in the modules. Also, make sure your 110V power cord can handle the
maximum load you plan to put on both outlets combined. The amount of load will not affect the low voltage control side - it's opto-isolated and very safe.
Yeah, I didn't really have a picture for this step, but I like this "warning sticker for the unclueful".
That's the end of the main part of this Instructable. Depending on your application you might need to make more of these, and of course you will need to come up with a
suitable control circuit. One possibility is presented briefly below, but it is more of a SlideshowÂ? than an Instructable since it was done before I knew of this site.
To make this light-controlled outlet concept really useful, you'll probably want more than just 2 channels. I started off with 8 unmodified modules plugged into a couple
power strips with the LEDs added externally, but that quickly got unwieldy. So I removed the 8 module circuits from their cases and built them into a single box with 8
outlets along one side. Then I built another for a total of 16 channels.
Between the time I built my 8-channel versions and became aware of this Instructables site, Wal-Mart changed suppliers for the light controlled outlet and the new ones I
used above do not have the same circuit board as I originally used.
Since I could not repeat the old project I decided to do the 2-channel version shown here just to convey the concept. The new modules are actually much easier to work
with than the old ones, but there's no guarantee that Wal-Mart won't change suppliers again by the time you decide to build your project. So be flexible and keep in mind
that the basic idea is just to replace the normal light input with the LED in a light-tight enclosure.
The photo shows the entire 16-channel setup with controller, in a weather-proof enclosure made out of an old toy box. The next steps will briefly describe these parts.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 24: Controllers
Having controllable channels is not much use unless you are controlling them with some kind of sequencer that you can set or program. That controller could be as
simple as a panel of toggle switches and pushbuttons for a stage production or a museum-style interactive display, all the way up to a PC-driven card with a fancy GUI
interface for a production timed to music. Although I won't go into construction detail in this "appendix", I will show my controller and its program code as an example.
My controller is somewhere between switches and a PC. I decided to use a Basic Stamp "Homework" microcontroller/protoboard mostly because I wanted to play with
microcontrollers again and that seemed to be a popular modern choice with low cost and lots of online support. The only other choice I had on hand was an MCS-85
"System Design Kit" (Intel 8085, ca 1977) and support for those is thin these days. Plus you have to program it with a cheesy little hex keyboard every time you power it
up. Another cool possibility I may yet build is something that reads holes in a paper tape like a player piano or a PDP-8. OK enough tech-fogey stuff.
What I am controlling these days is an outdoor Christmas tree decoration which is basically a maypole with 16 individually controlled strings of lights arranged in upper
and lower rings of 8 strings each. The fun of building the hardware is over, but there is still the fun of programming new lighting patterns each year and cramming the
code into the limited memory space of this particular model of Basic Stamp.
I also included pictures of the 16-channel controller setup, its weatherproof box, and the simple octal-latch interface between the Basic Stamp and the control modules.
These pictures should give all the creative types here on this board a good head start on their own designs.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 26: Circuit board
The photos show a modified circuit board. I turned one of the external 110V prongs into a screw terminal. This board is only rated for 300W, but times 8 that's 2.4KW,
which I am unwilling to drive through a wood box. Also, the power cord feeding it is only good for about 1.2 KW, so I keep the load down to 2 strings of 100 mini-lights per
outlet.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 28: Controller interface circuit
With the Basic Stamp Homework board I could drive 16 channels directly, but that would be the maximum. When I went from 8 to 16 channels I decided to use octal
latches to hold each modules' control bits and address each one with a direct control line. With this simple control scheme the Stamp can drive 8 sets of 8 bits, or up to 64
channels. I'll never need that many, but someone might. If you want more than that you must use address decoders.
The program sets the control bits on pins 0-7, then writes a 1, 0 sequence to the control pin (8 or 9 or both) to latch the control bits. The modules are connected to the
control board with 9-pin connectors so the board can be easily removed for programming. The octal latches are 74573 types; any version will do, this is not a high speed
circuit.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
step 30: Enclosure
The controller is outside, so it has to be protected. This box came with an outdoor game that the kids have lost all the pieces for. I cut a hole in the bottom for all the
extension cords to run out and added some legs. The box has four yellow latches that hold the lid on, making it very easy to open. The inside was shown back in step 23
with the controller bolted in.
To use this system, each light string is connected to its outlet with a 9 foot extension cord. The 32 mini-light strings were about $3 each, the maypole is just an extension
pole for painting with a hook fixture added to the top, and the extension cords are about $3 apiece. So the whole setup is very inexpensive.
Referring to the picture in step 24, the light strings are tied together in a V for the top strings and an upside down W for the bottom ones. Strings opposite each other
around the circle are the same color. The control possibilities are endless, or at least they would be if you could fit the routines into this little microcontroller's memory.
'Version of the "Westinghouse" Xmas tree driver for the 16 light-string tree.
'This is an homage to the original tree used at the Westinghouse R&D center in Churchill, PA.
'Runs 2 modules of 8 110V outlet controllers, 1 for 8 upper strings, 1 for 8 lower strings
'Each module driven by TTL 74-573 series octal latches. Data from the lower IO byte is
'written/held by low-high-low transitions on control bits from the upper IO byte.
'Module 1 (upper lights) latched by port 8 control bit, module 2 (lower) by port 9 bit.
'The 2 modules as used here are expandable to 8 modules for total of 64 controlled outlets
' This version minimizes memory usage by eliminating the randomized variables
' and also the structured design of having a main loop that calls lighting
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
' routines as subroutines. Now all routines are in the main loop itself.
' Yes, bad for having less structure but saves many bytes. Several of the
' earlier routines were also rewritten to use more loops since they take up
' much less space than just stepping through lists of lamp values. Relying
' more on loops has the downside of constraining the patterns a little, but
' makes the programming more intricate and interesting.
'----------------------------------------------------------------------------
lowerlamps VAR Byte 'holds lamp state bits for lower 8 strings
upperlamps VAR Byte 'holds lamp state bits for upper 8 strings
'Set values for the constants that set the overall look and speed of the tree
delay1 = 500 'half-second delay
delay2 = 800
lpctr1 = 3
lpctr2 = 6
'main loop - in this minimal memory version, the lamp routines are not called as subroutines
DO
FOR ctr1 = 1 TO 4
OUTL = %11111111 'all lights on
GOSUB Drivemodule12
PAUSE delay2
OUTL = %00000000 'all lights off
GOSUB Drivemodule12
PAUSE delay2
NEXT
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
holdvar1 = %00000000 'same routine as above, filling in the upper strings
ctr3 = 8 'while the lower strings all remain lit
FOR ctr1 = 1 TO 8
shiftee = %00000001
FOR ctr2 = 1 TO ctr3
upperlamps = holdvar1 | shiftee
OUTL = upperlamps
GOSUB Drivemodule1
PAUSE delay1
shiftee = shiftee << 1
NEXT
holdvar1 = upperlamps
ctr3 = ctr3-1
NEXT 'All lamps left on
'NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
'QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
FOR ctr2=1 TO 8
OUTL = OUTL >> 1 'right shift, shifts in zeroes
GOSUB Drivemodule1 'turn off upper string
PAUSE delay2
GOSUB Drivemodule2 'turn off lower string
PAUSE delay2
NEXT
'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
NEXT
GOSUB Drivemodule12 'Ends with all lights off
'WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
'lights off sequentially CW top/bot string at a time
FOR ctr1=0 TO 7
LOW ctr1
GOSUB Drivemodule12
PAUSE 100+(ctr2*(delay1-100)/2)
NEXT
'CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
upperlamps = %00000010
subpause = 200
shiftcount = 4
GOSUB ShiftLeftUpper
GOSUB ShiftRightUpper
NEXT
'JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
' THIS ROUTINE NOT WRITTEN YET, STILL IDENTICAL TO SeqOnOff ABOVE
'HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
'Circulate1:
OUTL = %00000001 'light 1,2,3 strings top & bot before entering chasing loop
GOSUB Drivemodule12
PAUSE 150-(ctr2*15)
OUTL = %00000011
GOSUB Drivemodule12
PAUSE 150-(ctr2*15)
lowerlamps = %00000111 'lowerlamps variable used for lower and upper together
subpause = 150-(ctr2*15)
shiftcount = 9
GOSUB ShiftLeftBoth
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
'GirlsGirlsGirls:
FOR ctr2=0 TO 16
OUTL = %01010101
GOSUB Drivemodule1
OUTL = %10101010
GOSUB Drivemodule2
PAUSE 100
OUTL = %10101010
GOSUB Drivemodule1
OUTL = %01010101
GOSUB Drivemodule2
PAUSE 100
'PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
'RotatePairs:
OUTL = %00000000 'clear all lights to off
'DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
OUTL = %10000000
GOSUB Drivemodule12
PAUSE delay1
OUTL = %01000001
GOSUB Drivemodule12
PAUSE delay1
OUTL = %00100010
GOSUB Drivemodule12
PAUSE delay1
OUTL = %00010100
GOSUB Drivemodule12
PAUSE delay1
OUTL = %00001000
GOSUB Drivemodule12
PAUSE delay1
OUTL = %00010100
GOSUB Drivemodule12
PAUSE delay1
OUTL = %00100010
GOSUB Drivemodule12
PAUSE delay1
OUTL = %01000001
GOSUB Drivemodule12
PAUSE delay1
'EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
OUTL = %00000001 'light 2 strings top & bot before entering chasing loop
GOSUB Drivemodule1
PAUSE 150-(ctr2*15)
OUTL = %00000011
GOSUB Drivemodule1
PAUSE 150-(ctr2*15)
OUTL = %00000111
GOSUB Drivemodule1
OUTL = %00000001
GOSUB Drivemodule2
PAUSE 150-(ctr2*15)
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
OUTL = %00001110
GOSUB Drivemodule1
OUTL = %00000011
GOSUB Drivemodule2
PAUSE 150-(ctr2*15)
OUTL = %00011100
GOSUB Drivemodule1
OUTL = %00000111
GOSUB Drivemodule2
PAUSE 150-(ctr2*15)
upperlamps = %00011100
lowerlamps = %00000111
FOR ctr1=1 TO 8 'shift 3 lit strings around 1 full revolution until all off
NEXT
'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
'GirlsGirlsGirls:
OUTL = %10101010
GOSUB Drivemodule1
OUTL = %01010101
GOSUB Drivemodule2
PAUSE delay1
'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
'MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
'ChasePair:
lowerlamps = %10100000
shiftcount = 6
subpause = delay2-(ctr2*(delay1-100)/lpctr1)
GOSUB ShiftRightBoth 'use subroutine to shift pattern to far right
lowerlamps = %01000001
shiftcount = 1
GOSUB ShiftRightBoth
'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
'FlashQtrs:
OUTL = %00110011
GOSUB Drivemodule12
PAUSE delay2
OUTL = %11001100
GOSUB Drivemodule12
PAUSE delay2
'KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
'GirlsGirlsGirls:
OUTL = %10101010
GOSUB Drivemodule12
PAUSE delay1
'LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
'----Subroutines -------------------------------------
'The Drivemodule subroutine writes the data byte appearing on ports 0-7
'to the module address or addresses called out in the subroutine name.
'For the 74LS573 latches this means driving the selected control lines
'from low to high then driving all the control lines to low again.
'The control bits will be all low when entering and leaving this routine.
'Port 8 controls module 1, port 9 controls module 2, etc, so this style
'of module addressing can be expanded to 64 individual light strings.
'control byte for module 1 - %00000001
'control byte for module 2 - %00000010
'control byte for modules 1 and 2 - %00000011
'Module 1 controls the upper 8 light strings, module 2 the lower ones
'Note that multiple modules can be addressed at the same time, although
'each module will get the same light control bits from ports 0-7 that way.
Drivemodule1:
OUTH = %00000001
OUTH = %00000000
RETURN
Drivemodule2:
OUTH = %00000010
OUTH = %00000000
RETURN
Drivemodule12:
OUTH = %00000011
OUTH = %00000000
RETURN
'The ShftX8X subroutines take in a byte of lamp values, displays them then
'shifts them, doing this <shiftcount> times.
'The first four subroutines handle left and right shift of upper and lower lamps.
'The last two shift both upper and lower 8 bits, using the lowerlamps variable.
'Pass in variables Subctr1, shiftcount, subpause, and lower- or upperlamps;
'changes value of OUTL and lower- or upperlamps.
'NOTE - the two -shiftlower- routines have not been used yet
'As with the module driving routine, it still takes up less memory to have
'individual routines for each possible shift operations rather than using
'a more universal set of routines Whne ther is a control variable designed
'for the module driving routine, then using that routine will eliminate
'the need for duplicate shifting routines.
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
ShiftLeftUpper:
FOR subctr1 = 1 TO shiftcount
OUTL = upperlamps
GOSUB Drivemodule1
PAUSE subpause
upperlamps = upperlamps << 1
NEXT
RETURN
'ShiftLeftLower:
'FOR subctr1 = 1 TO shiftcount
' OUTL = lowerlamps
' GOSUB Drivemodule2
' PAUSE subpause
' lowerlamps = lowerlamps << 1
'NEXT
'RETURN
ShiftRightUpper:
FOR subctr1 = 1 TO shiftcount
OUTL = upperlamps
GOSUB Drivemodule1
PAUSE subpause
upperlamps = upperlamps >> 1
NEXT
RETURN
'ShiftRightLower:
'FOR subctr1 = 1 TO shiftcount
' OUTL = lowerlamps
' GOSUB Drivemodule2
' PAUSE subpause
' lowerlamps = lowerlamps >> 1
'NEXT
'RETURN
ShiftLeftBoth:
FOR subctr1 = 1 TO shiftcount
OUTL = lowerlamps
GOSUB Drivemodule12
PAUSE subpause
lowerlamps = lowerlamps << 1
NEXT
RETURN
ShiftRightBoth:
FOR subctr1 = 1 TO shiftcount
OUTL = lowerlamps
GOSUB Drivemodule12
PAUSE subpause
lowerlamps = lowerlamps >> 1
NEXT
RETURN
Related Instructables
A USB Power
Arduino Home Make a Voltage 120V A/C Lamp Multitouch
Controled Plug Controlled
automation by Strip. With Flicker from Pinball
simon72post Opto-Scopic Resistor and LED Votive Instrument by
Isolation. by Use It by Biotele
Rotator by Candle Type 1 s9lucas
toymotorhead
bluedali73 (COB) by sr1sws
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
Advertisements
Comments
48 comments Add Comment
thanks
thanks
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
ry25920 says: Jun 19, 2009. 9:30 PM REPLY
Very good job. Mega details. Mega info. Mega rating 4.5 stars. ry25920
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
toastdore says: Mar 14, 2008. 4:09 PM REPLY
Hello,
I make a video very fast the camera is not stable
but I thing you like this.
please comment...
http://www.ipernity.com/home/42678?rev=31
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/
guyfrom7up says: Mar 9, 2008. 9:03 PM REPLY
grade A instructable, insane amount of detail, +1
A little side not, whenever possible, combine some very similar steps, not saying what you did was bad, it was awesome! It was just a little intimidating
saying "wow, this sounds like a cool idea... *click* OMG this thing has 31 steps 10 minutes later... "Wow, that was really detailed, I mean super and it was all
ewasy to understrand!"
http://www.instructables.com/id/Cheap--easy-opto-isolated-TTL-to-110V-light-contr/