# Simulating binary code with transistors

Discussion in 'The Projects Forum' started by Ekonomista, Jul 11, 2014.

1. ### Ekonomista Thread Starter New Member

Jul 10, 2014
3
0
Hello all. I am currently on a project so I need your opinion am I doing it right and is there an easier way to do what I need.

The project is about using (NPN & PNP) transistors to do binary switching of 2 led. When I put +5V on the first transistor the circuit needs to turn on led1-led2 in this order (0-1, 1-1, 1-0, 0-0).

The led2 needs to be turned on in code (0-1) long enough to turn led1 to code (1-1) and then led1 needs to be on enough to turn off led2 in code (1-0).

It is important that every code (0-1...1-1...1-0) has a minimal gap between another code represented in "..." 1 millisecond or less.

I tried to figure it out by myself and ended up with this schematic but I don't know will it work. Later every base pin will have a resistor that I forgot to put in schematic.

Thanks for help. Cheers

2. ### DickCappels Moderator

Aug 21, 2008
2,768
669
It appears that you want to make a clockless LED sequencer. Without using a clock signal or delay elements, the circuit will do whatever it is going to do in a matter of microseconds. Unless I miss my guess, you want something like the circuit below, which is representative of the typical way it is done with discreet logic. You can simulate the functions with transistor rather than using ICs, but it would take a whole lot of transistors.

3. ### Ekonomista Thread Starter New Member

Jul 10, 2014
3
0
This is a very nice example of doing the code but in example the code is 3x and not 2x as I need it to be.

The whole idea was to try to use 1x digital pin of Arduino (it needs to be 1 because all pins will be in use) to start schematic and do complex switching that counts as 1 movement.

So in basic when I get +5V on first transistor one finished movement is when all 4x codes are executed (0-1, 1-1, 1-0, 0-0). This means that when I do all these 4x codes IC that is tracking the state of connections recognises that as a command.

Doing the codes in the opposite direction is again an another command something like X-axis that can go + or - depending on what the code is.

So if I need to have the command executed 100x times, the Arduino will do High/Low 100x on desired pin, but transistors schematic need to do every time of the 100x the 4x codes (0-1, 1-1, 1-0, 0-0) as fast as possible (0.25-1 millisecond preferred).

Can you tell me at least is my schematic good so if I place capacitors as delay parts will it do the exact switching as i need?

Thanks.

4. ### BobTPH Active Member

Jun 5, 2013
806
121
I cannot even look at your circuit the way it is drawn.

Redraw it in the standard way, with the +5 rail at the top, ground at the bottom, and information flow from left to right, and then maybe someone will look at it.

Bob

5. ### Ekonomista Thread Starter New Member

Jul 10, 2014
3
0
Here is the new and better explained version of my thinking and the steps I thought of how to make circuit do what I need.

Led positive pin is conected to transistor rails and not +5V external batery.

S0.
When there is no input voltage on S1 from Arduino digital output pin both leds will be off. (Code...led1-led2...0-0)

S1. The circuit gets +5V input to the first transistor T1.

S2. Transistor T1 gives negative voltage to the rails and goes to T2, T3 and led1. Because negative voltage is put on positive led pin, led1 is off.

S3. T2 gives +5V to T3 and he again gives it next to led2 and T4. Led2 will be on. (Code...led1-led2...0-1)

S4. T4 gives negative voltage to T5 and T5 gives +5V to led1. Because we have D2 positive voltage doesn't go to negative voltage of T1. Led1 will turn on. (Code...led1-led2...1-1)

S5. Positive voltage from T5 that has gone to led1 will continue to go to T2. Because we have D2 positive voltage doesn't go to negative voltage of T1. Because T2 is PNP it will go off because base is positive and break the +5v going to T3 and next to led2 and every next part. Led2 will go off.
(Code...led1-led2...1-0)

S0. Because circuit will start to turn itself off both led2 and led1 will turn off. (Code...led1-led2...0-0)

I hope this is a better explanation on what I figured out how to do it.

Thanks.

6. ### BobTPH Active Member

Jun 5, 2013
806
121
Even is the sequence you think should happen is correct, without any delay elements, it will happen in less than 1 microsecond. If you want help solving your problem, I suggest that you abandon this circuit and ask for help designing one that will do what you want.

Bob