Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need help with transistor switch

Status
Not open for further replies.

Nora

Advanced Member level 4
Joined
Mar 31, 2006
Messages
115
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,296
Location
My garage, USA
Activity points
2,292
Hello-
I am using a PIC microcontroller, 18F452, 5V.
The maximum current source/sunk from any IO pin is 25mA.
The maximum current source/sunk by PORTC & PORTD combined is 200mA.
The maximum current source/sunk by PORTA & PORTB & PORTE combined is 200mA.

I am using all of PORTC (8 pins) to switch 100mA of light wire per each pin. I am not using PORTD at all.
The power to each of these outputs is switched on/off by a 3V regulator supply and controlled by the pins on PORTC. The 3V supply is on PORTB and is capable of 1.5A.

I am using all of PORTE (3 pins) to switch LEDs from the microprocessor. Each LED string needs 240mA and runs on a 12V supply.

My question is about the calculations for the transistor circuit, R1 or Rbase.
I have been using transistor TIP31, which says in electrical characteristics HFE is 10-25, depending on current draw. In the graphs HFE is shown to be as much as 110.
I have found that my calculations do not get good results. For example, I changed the Rbase on the 3V supply from 34ohms to 326k before it switched properly.
The LEDs switch fine without PORTC being connected, but as soon as the 3V supply is connected, they jump between saturation and cutoff (blinking).
I will fix this by increasing Rb significantly, but I don't understand what is going on.

Is this true that larger Rbase = smaller current on base = smaller ability to switch current on collector.

Maybe I am using the wrong formulas?
Ibmin = Iload (Ic)/HFEmin Ibmax = Ibmin*1.3
Rbase = Vswitch/Ibmax

Thanks in advance!
Nora
 

I neither understand, where you get the 34 ohms Rbase value (much too low) nor the 326k one (much too high).

Practically a value between 330 ohm and a few kohm should be suitable. With 34 ohm, you run into a special processor issue called RMW (read-modify-write) problem, if you use bit instructions to set the port bits. It's because the old port state is read back for all other bits except the one you intend to change. With 34 ohm load, the output is effectively shorted and you read "0" although the output state is "1". The problem is specific to processor that read the output pin rather than the output latch state, e.g. PIC 16/18.
 

    Nora

    Points: 2
    Helpful Answer Positive Rating
That explanation for the 34ohms is perfect, thank you FvM. It must have been why the PIC kept restarting when I originally had the 34ohm in?
I got the 34ohms like this:
ibase = iload(ic)/HFEmin still confused about which number to use for HFEmin
ibase = 800mA/10 (worst case HFEmin listed on data sheet)
ibasemax = 80*1.3 = 104mA
Rbase = Vswitch/ibasemax = 3V/104mA = 28ohms
What am I doing wrong here? The 326k was just trial and error until I got the PIC to stop restarting.
I've got a 22k resistor in R2. Working fine.

When I have the 3V supply connected, the LEDs blink no matter what base resistor (R17, R18, R25) I give them. If I disconnect the 3V supply electrically, the LEDs hold steady (as the code says they should).

I was thinking that the LEDs blink because they are between saturation and cutoff, but I don't know how to think about this.

Any ideas? Am I missing some connection between PORTE and PORTC?
Nora
 

In the above posted schematic, Rbase is 1.2k. That's reasonable.
 

But they don't hold steady on unless the 3V supply is disconnected. Any ideas why?
Blinking is cute, but unacceptable.
Nora

Added after 44 minutes:

Had a thought. The light wires are run with inverters, 200VAC, about 1500Hz.
Could the inverters be making my LEDs blink from noise?
Nora
 

So my first rule of troubleshooting electronics is to see if it is turned on and the power is making a good physical connection.

My second rule is to double check that I've designed that the power supply can handle the load.

I ignored the second rule and was running a 3-4A load off of a 300mA wallwart.
I've swapped power supplies and all is fine now.

:oops:
N_N
 

Hi all

Sorrry if it is a stupid question, but what are the state of RE0, RE1 AND RE2 after and before you connect 3V supply?

Best Francisco
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top