[SOLVED] pic output is just 2.5v

Status
Not open for further replies.
Ok..thanks betwixt.i hope my circuit would be ready with your valuable suggestions..let me have a try.n soon i will update the status..
 

Hi...
I connected all the capacitors as you said..but the problem was still there..then i grounded the pin 38.then its working.am getting 5v output..everything is perfect.is that connection a wrong one..?or can i proceed...?
 

hello,


check and post configuration bits ..

RB5 has a specific function :
 

That's what I mentioned in post #12, it looks like you have the PIC in LVP mode and it is entering programming mode instead of normal execution mode. If you had nothing connected to RB8 before, it would be floating and could drift between modes according to static charge nearby. You select LVP mode in the configuration bits, please check them and if necessary, turn LVP mode off.

Brian.
 

Hi..i have checked it and i have turned it off..but its still the same and when i connect RB8 to ground its working.

- - - Updated - - -

I do have some more doubts..my circuit is an automatic water level controller.the sensors work through conduction method.so i have to pass certain voltage to the water continously so that the sensors conducts the voltage and send it to the pic as inputs.my doubt is that is sending about a 5 to 12v to the water a proper method...?or do i need to make it a lesser voltage...?if so how can i switch it to 5v so that it can be fed to the pic..?
 

Hi,

for your water level sensor you need protection diodes to save the microcontroller from demage.

Also applying continously DC voltage will damage your electrodes.
Activate it only a short time for the measurement. Best is to change polarity for each measurement.

Klaus
 

Ok..thanks..but how should i connect that protection diodes.....?
 

Hi,

like usual:

Two diodes:
*one from GND (anode) to signal (cathode)
*the other from signal (anode) to VCC (cathode)

I often use BAT54S, but it depends on expected currents.
An additional series resistor to the IC input improves performance.

Klaus
 

Post your code and schematic...

Is missing pullup resistor to MCLR???
 

My input to the pic from the sensor would be around 5 to 12v..can i use that voltage to switch a transistor which will give 5v to the pic...?

- - - Updated - - -

Yes i have connected that pull up resistor to mclr.
 

Your schematic would be a great help.

Are you trying to measure the voltage from your sensor or just detect if a voltage is present or not?

If you are just checking if it is present, are you saying the voltage is 5V switching to 12V or some other voltage switching to somewhere between 5V and 12V?

You need to be far more specific....

Brian.
 

I need to switch a 5v to the pic input pins using a transistor.but am having a 12v supply to the base..can i supply that 12v to the base through a 10k resistor to the base to switch the 5v
 

I need to switch a 5v to the pic input pins using a transistor.but am having a 12v supply to the base..can i supply that 12v to the base through a 10k resistor to the base to switch the 5v

For a 12V signal input, if you choose 100k ~1M series R , the result will not exceed the Vin max spec and be clamped at 5.2V from internal Schottky diode ESD latchup protection.

If any outputs are not at proper DC logic levels with proper load and no AC voltage (e.g. PWM) then you can consider that port as potentially damaged. (e.g. ESD)
 
Last edited:

Will the transistor work if the base voltage is just 2v....?
 

NPN common emitters need 10% Ic for base current. So using OHms law and 0.7V for Vbe, it can work up to demand current, then consider Darlington for more at 1.4V=Vbe
 

A normal transistor will only need about 0.7V between it's base and emitter to make it conduct. It is a current though, not a voltage you should be aiming for.
You still haven't shown us a schematic so I'm going to assume the transistor is a normal NPN small signal type and you have it connected:
Emitter to VSS
Collector to the PIC input and also a resistor of about 10K to VDD.

To make the transistor conduct in saturation you need about 10 times more base current than collector current/Hfe. Lets assume the transistor has a Hfe of 100, you haven't told us anything about the transistor but that would be a good 'ball park' figure. So if the collector is fed through a 10K resistor from VDD and you want the transistor to pull it's collector to ground (= logic 0 at the PIC input) it will pass 5/10000 Amps = 0.5mA. The base current is therefore 0.5mA/Hfe = 0.5/100 = 0.005mA but you want 10 times that to ensure it is fully saturated so we will aim for a base current of 0.05mA. The base resistor therefore has to be:
(<the voltage you are checking> - 0.7) / 0.05 with the result in K Ohms.
For example, if you are checking 12V the resistor is (12 - 0.7)/0.05 = 226K and you would normally use the next lower standard value which is 220K.

Brian.
 

Thanks guys..am late to reply due to some issues..i hadnt posted the schematic due to some technical issues.my transistor is BC547..circuit is almost ready.but i need to include the feature of high n low voltage cutoff..can i programm it in my pic18f4550...?
 

You can try to program the 'voltage cutoff' if you use an ADC input rather than a digital one but that makes it much more difficult with your transistor at the input. The voltage 'in' will do nothing up to about 0.7 then within the range of only a few hundred mV will go to 'full scale' reading. You really need to show how you have everythng connected to get better advice. Just sketch something on paper and scan/photograph it and post it here.

Brian.
 

I have my schematic as a proteus file..let me past a screen shot of it..

- - - Updated - - -

The circuit is an automatic water level controller..i have a program..but i need to include the feature of high n low voltage cutoff in my program...the sensors are connected to the digital pins..
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…