12v 0v and 5V switched supply voltages

Discussion in 'The Projects Forum' started by bodhayannandi, Nov 16, 2013.

1. bodhayannandi Thread Starter New Member

Nov 16, 2013
8
0
I have made a circuit to generate 12V, 5V and 0V signals for parallel programming, It worked fine when simulated in pspice but, when I tried it on breadboard it does not give 12V it gives 9V or so, The other signal levels(0 and 5V) are fine but not the 12v level, I dont understand this. This are the logic combinations i am using

for 0v PORTXn=1 PORTXn+1= 0
for 5v PORTXn=0 PORTXn+1=1
for 12V PORTXn=0 PORTXn+1=0

when both The transistors are turned off it should draw not more than 15nA of current according to the data sheet but it draws 6mA from source. Here is the circuit i have used the BJT is BC548

• switch(0,5,12V)1.PNG
File size:
20.8 KB
Views:
48
Last edited: Nov 16, 2013

Apr 5, 2008
18,990
3,758
Hello,

I found your post in the "completed projects" forum.
As it says it is only for completed projects.

Bertus

PS I have removed you double posting on the other thread in there.

3. bodhayannandi Thread Starter New Member

Nov 16, 2013
8
0
Sorry about that but, where to post questions...

4. MikeML AAC Fanatic!

Oct 2, 2009
5,444
1,073
Here is a more useful simulation. There are four states of two ports. This shows all four.
Look at the supply current I(V3).

What is connected to V(out) when you are measuring 6mA?

Not a very good design; it puts out Vpp during bootup....

• D41.jpg
File size:
200.4 KB
Views:
36
Last edited: Nov 16, 2013
5. bodhayannandi Thread Starter New Member

Nov 16, 2013
8
0
Hello Mr. MiKeMl. Thanks for replying. V(out) was open(no connection) I have measured the supply current, i.e. i connected an ammeter in between 12.5V supply and R2 and found the current to be 1.08mA not 6mA sorry about that(it was from a previous reading with R2=500ohm and R4=400ohm), while base of both the transistors were given logic 0(actually something around 0.3V to be precise, as this is the logic 0 that the Atmega8 device gives at its output pin).

Last edited: Nov 16, 2013
6. Alec_t AAC Fanatic!

Sep 17, 2013
9,173
2,163
Why connect it there? If you mean the left-hand end of R2 that would have applied ~12.5V to PORTXn and could have blown the Atmega. If you mean the right-hand end of R2 the only thing to limit current would be the base-emitter junction of Q1, plus the ammeter resistance. That could have blown either Q1 or the ammeter.

7. bodhayannandi Thread Starter New Member

Nov 16, 2013
8
0
I saw the simulation results. If could've achieved something even close to this i would have been more than happy. But when i try it on breadboard the source current is nowhere near that, which is rated in the datasheet of BC548(15nA)

8. bodhayannandi Thread Starter New Member

Nov 16, 2013
8
0
No Mr. Alec_t, I reffered R2 from Mr. MikeMl's post of the circuit diagram

9. ScottWang Moderator

Aug 23, 2012
6,480
1,001
To see the attached circuit, and check that does it has any problem.

File size:
4.9 KB
Views:
60
10. bodhayannandi Thread Starter New Member

Nov 16, 2013
8
0
Thanks, that was a great help.. But what i can't understand still, why was there 1.08mA current taken from the source in the first place even though the microcontroller outputs logic 0 from its port to both the transistors, both the transistors should have been cut-off and cut-off current should not be more than 15nA.

11. MikeML AAC Fanatic!

Oct 2, 2009
5,444
1,073
Most likely a bad transistor, one wired upside down, or other wiring error.

12. ScottWang Moderator

Aug 23, 2012
6,480
1,001
1. I was modified and added two resistors(R5,R8) to the circuit to avoid the Q3,Q4 floating when Q1,Q2 was off.

2. This circuit control is different from yours.
a) 00 -- output is low. (5V and 12.5V control are low(0V))
b) 01 -- output is 5V. (5V control is hi)
c) 10 -- output is 12.5V (12.5V control is hi)

3. To avoid the output pin will output 12.5V when the power is on, so if there is no any hi at the inputs then the output will be low, the output pin will be pulled low by R10(3.9K), no any current output.

• 0-5-12V-Sw_ScottWang_AAC.gif
File size:
5.2 KB
Views:
47
Last edited: Nov 16, 2013
13. bodhayannandi Thread Starter New Member

Nov 16, 2013
8
0
Thanks, now i get it...

14. bodhayannandi Thread Starter New Member

Nov 16, 2013
8
0
Hello Mr. scott wang first of all thankyou for this wonderful circuit. The circuit is fine except for the value for R8 and R5 they are too high such that when Q2 and/or Q1 is in cut-off, the cut-off current turns on Q3 &/or Q4 using 1K resistor fixed this problem. Thankyou.

15. ScottWang Moderator

Aug 23, 2012
6,480
1,001
Nice, you could correct the value to suit what you need.

bodhayannandi likes this.