Introduction: How to Make a Simple 2 Bit Data Selector
I'm very new to electronics but also very passionate about it.This is my second electronics project.
I'm a programmer and currently don't know much about the math that goes behind my projects,
however i treat transistors and ic chips as little modules and functions. Then i build the circuit,then i hope it works. i completed three projects so far, they all worked,so i guess it is time i share them.
People with electronics experience,feel free to comment,criticize and make suggestions.
This project is an upgraded model of my first project which used relays.
The idea is:
to be able to select between 2n devices,using n data select lines.
this time i have 2 data select lines which will in turn provide me with 4 different outputs.
(i designed one with 6 data select lines,however i don't have time or the resources to build the circuit yet)
suppose you have single data line, and you want to send different data to different devices at any order.so you need a switching circuitry that does this for you.this is what this device is all about.
it can be used to switch between devices,in my case, this can be used to switch between 4 stepper motors.however the motors can't be run simultaneously with this setup. but this isn't problem,as you can solve this problem by switching data lines rapidly,creating the illusion of simultaneous action.
coz my parallel port or my parallel port cable sucks,that i have only 6 data lines to use.
the steppers i have use 4 control cables.leaving me with only one motor to work with.
so i tried to find a way to use the last 2 data lines i have,to switch between motors.
then i came up with this idea. with this,it is possible to control 4 steppers with 6 data lines.
Step 1: Step 1
how does this work?:
in this particular case of controlling 4 stepper motors, all you do is split the control signal into 4. (you have 4 cables for each data line,16 cables total).
then you use the outputs of our device to open/close a particular motor's input.
Step 2: Step 2
with this device,we will be able to switch between 4 different devices.
we have 2 data select lines.
A and B. and below is the table for all the possible inputs:
| A | B |
| 0 | 0 |
| 0 | 1 |
| 1 | 0 |
| 1 | 1 |
(you can consider 1 as +5V,and 0 as 0V sent to the device's corresponding inputs)
what output do we need?
| O4 | O3 | O2 | O1 |
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 1 | 0 | 0 | 0 |
for A=0 and B=0 --> O1=1
for A=0 and B=1 --> O2=1
for A=1 and B=0 --> O3=1
for A=1 and B=1 --> O4=1
it explains itself:
not A and not B is O1
not A and B is O2
A and not B is O3
A and B is O4
more garbage here:
A' & B' => O1
A' & B => O2
A & B' => O3
A & B => O4
i think now everything is clear.
we need to find a way to invert A and B,
so that we make 4 inputs out of 2, A,B,A' and B'
then "AND" them,ie place them serially
Step 3: Step 3
how is this done?
well the first electronic component,i learned after resistors was transistors.so i remind you and i repeat again,i don't have much to offer other than imagine these devices and try to make them based on basic working principles of transistors and resistors etc...
SO,even if this device works perfectly with the parts that i have,you might fry stuff,if you don't do the math. i had like 40 NPN transistors,so i wasn't afraid of losing any,and luckily i didn't.
a transistor fried,is nothing compared to a fried motherboard of a computer,so be careful before you hook up stuff to your parallel port,especially if it is my design :)
this is my warning,i am not responsible if you damage your equipment,or hurt yourself (i would feel bad though)
well,we need two NOT gates. to make A 0 when it is 1 and 1 when it is 0 etc..
we also need 4 AND gates.
we can do this whole thing with transistors.
or we can simply use 2 little chips. (you can do all types of combinational logic,you can use NAND,or NOR gates or you can go with only one type of gate and do everything there,including the NOT gate,but this one is going to be simple,and straight forward)
the AND gate is pretty simple:
just connect two switches serially.
+5V-----\ /-------\ /-----> A & B
| A | B
(of course you have to repeat this for each combination of inputs,luckily you only have 4)
the NOT gate is as easy,
| A' 1k
Step 4: Step 4
after you have your AND and NOT gates, (i recommend using IC chips, like 4081(AND) and 4009(NOT))
they will occupy less space and be more reliable.
mine is a hybrid,
it has 2 transistor NOT gates with 4 transistors and one 4081 AND gate.
after you have your gates ready,all you do is,go back,read the theory of how this thing works,
and wire it up. that's it.
summary is: invert A and B, then combine A,B,A',B' in a way that fits your needs
parts i used are:
(5) 1K ohm resistors ($ ?)
(4) 4.7K ohm resistors ($ ?)
(4) 2N3904 NPN transistors ($0.35)
(1) 4081BE Quad 2 input AND gate ($0.75)
(1) tiny perf. board ($0.50)
this thing cost me about:
this was my first instructable,and i fear it is messy and might be hard to follow,sorry about that
my next instructable will be about my third project, driving a stepper motor with only 2 cables.
one for the pulse,the other for the direction.
you can combine it with the 6 input version of the device explained here and control 64 motors with one parallel port (in theory :))