Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC Microcontroller

Status
Not open for further replies.

gilardino

New Member
I am using PIC16F877A. My sensor output is 4.5V. I input this sensor to PIC. When i connect the output of my sensor to PIC, my output voltage is reduced to 1.3V. When i disconnect it to PIC, the output voltage goes back to 4.5V. Anyone know what happened? And how to keep the output voltage 4.5V to the PIC?

Thank you.
 
You have made the pin an output or the impedance of your sensor is too high and needs buffering.

Mike.
 
I have 2 different sensor. 1st sensor works fine. Second sensor is just as what i mentioned in my 1st post.
I have set the port as input port. What do you meant by need buffering? How do i achieve that?

Thank you.
 
I have 2 different sensor. 1st sensor works fine. Second sensor is just as what i mentioned in my 1st post.
I have set the port as input port. What do you meant by need buffering? How do i achieve that?

Thank you.

hi,
Can you tell us what the sensors are, ie: logic or analog outputs.?
 
**broken link removed**

IR line sensor. But using PIC MCU. I grounded sensor with same ground as PIC and using same power supply.
 
**broken link removed**

IR line sensor. But using PIC MCU. I grounded sensor with same ground as PIC and using same power supply.

I have looked at the circuit.

The cct sensors are via LM324 amps to the MCU, how have you got your IR sensor connected.?
 
Similar with the schematic. The only different is the microcontroller. In my testing i connect one of outputs of LM324 to PIC MCU and set it as input.
 
If i directly connect portb.f7 to 5V. It works.

void main()
{
TRISB=0x11111111; //portB as input
TRISC=0x00000000;

while(1)
{
if(PORTB.f7==1)
{
PORTC.f7=1;
delay_ms(3000);
PORTC.f7=0;
delay_ms(3000);
}
}
}
 
Why the voltage drops to 1.3V. Not enough current? mismatch?

From what little we know of the project its difficult to say what exactly the problem is.

The input of a PIC draws very little current, so the output impedance of the IR unit would have to be very high.

The PIC pin is misset as a LOW output.

The IR unit is faulty.

Can you post a sketch of how you have that IR connected to the PIC pin.?


EDIT:
If the LM324 becomes unstable and oscillates when the PIC pin is connected this could also be the cause.
 
Last edited:
1st, i have built the IR sensor in PCB board. So i tested the IR sensor only. Without detecting IR Light from emitter, output of LM324 is nearly 0V. When it detects, the output goes to 4.6V. So, basically it works fine. Then it is similar with the sketch. When i connect to PIC, without detecting IR light, output is 0V, when detect, it only shows 1.3V. When i take out the jumper wire from input PIC, without detect is 0V, after detect is 4.5V. Is it this skecth that u want?
 

Attachments

  • sketch.GIF
    sketch.GIF
    13.6 KB · Views: 207
1st, i have built the IR sensor in PCB board. So i tested the IR sensor only. Without detecting IR Light from emitter, output of LM324 is nearly 0V. When it detects, the output goes to 4.6V. So, basically it works fine. Then it is similar with the sketch. When i connect to PIC, without detecting IR light, output is 0V, when detect, it only shows 1.3V. When i take out the jumper wire from input PIC, without detect is 0V, after detect is 4.5V. Is it this skecth that u want?

hi,
That sounds like its connected OK.
I'm beginning to suspect the LM324 is becoming unstable when connected to the PIC PORTB.7

One way to check for this would be to connect a 330R or 470R at pin 1 of the LM324 [as close as possible] and then connect the wire from the PIC to the free end of the resistor, so that the resistor is in series.

The other cause of instabilty could be, do you have any decoupling on the LM324 +5V rail.?????
 
Last edited:
Thanks, What is the purpose of the series resistor 470R? What do you mean by decoupling on LM324+5V rail?Sorry, i do not understand.
 
Thanks, What is the purpose of the series resistor 470R? What do you mean by decoupling on LM324+5V rail?Sorry, i do not understand.

The resistor will help to isolate the LM324 output from stray capacitance in the outgoing wiring.

The LM324 should have a 10nF or 100nF cap from +5V to 0V, as close as possible to the LM324.

BTW: what are the other 'free' pins of the LM324 connected too.??

When the resistor is in place, rerun your meter tests with a high and low... measure at each end of the resistor
 
Last edited:
Other pins all connected since i use total of 4 IR sensors. 10nF or 100nF is from 5V supply connected to gnd?

Yes, the cap is from +5V to Common 0V [Gnd]

Lets know what you measure on both ends of the resistor.
 
on both ends, are the same 1.3V.

Finally, i can make it work adding a transistor. So i connect output of sensor to transistor (base), collector to 5V and emitter to PIC. The voltage at the PIC is 2.5V which give logic 1.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top