PIC as a switch

Thread Starter

Gems

Joined Sep 11, 2007
5
hi, im gems. im new in this forum i just have a problem with my project auto ranging multi-meter. In order to have an auto ranging, i use transistor as a switch.the base is connected to pic output, the collector is connected to the voltage im measuring, and the emmiter to ground. my input voltage is ranging from 0-250V, the problem is when the pic output is 5v the transistor doesn't triggered. i need any suggestions of what might be the possible device i may use as a switch. some says its very dangerous both to the PIC and the user.

Please help me...
 

beenthere

Joined Apr 20, 2004
15,819
If you have connected the transistor as you describe, then the measuring voltage was shorted to ground during the instant before the transistor's base fried. That is not the way to drive a transistor properly, and using it to switch a voltage to ground won't help you measure it.

It would be helpful if you could describe how you are doing the voltage measurement. A schematic of the circuit would be extremely helpful.
 

Thread Starter

Gems

Joined Sep 11, 2007
5
Here is my circuit design.

the switch is turn on every 3-5 seconds. when the RB4 (checker) cant read any input voltage in 3-5 seconds, the switch goes to the next and turn off the other. then all goes to the ADC (Analog to Digital Converter) of the PIC and display the measured voltage.
 

beenthere

Joined Apr 20, 2004
15,819
There are several problems with the circuit. The limiting resistors R4 - R7 are all tied straight to ground on the left side. That will be the potential no matter if any of the transistors is on or off. Without any values given, I can't tell if the resistor pairs (R0 - R4, etc.) are anything like correct values to reduce the input voltage.

There are no current limiting resistors in the transistor's base circuits. BJT's must have current limiting to keep base current from going too high. Either the transistors will fry, or the PIC's outputs will cook because of too much current.

How is the checker going to respond to a voltage between the levels for logic HIGH/LOW? If it dithers, you will get a bad range selection. It can't possibly work as is, due to the resistors being tied directly to ground. Without a pullup, RB4 is likely to be floating (assuming you have it set to be an input).

It is more conventional to make up a resistor string with the test voltage applied to one end, and the other at ground. One uses DIP relays to switch the junction between each resistor in the string to the ADC, starting from the lowest value (which is the resistor closest to ground). The resistor values are chosen such that the voltage dropped over the next larger resistor is several times that of the one under it. Choose values to suit the range of the ADC. You switch from the highest range (most resistance in series) and use the ADC value to tell you to switch to a lower range.
 
Top