simulate this circuit – Schematic created using CircuitLab

Electronical novice (but Advanced Idiot) here. Trying to interface a phototransistor to a Microchip PIC I/O pin. Per the phototransistor's datasheet, I'm feeding +5V into the collector and have a resistor between the emitter and GND. When the emitter isn't connected to the PIC, a voltmeter on the emitter reads nicely between near-0V to +5V with varying light exposure. But when I tie the emitter to the PIC, that range drops to a maximum of less than +0.5V. Changing the resistor value or swapping the resistor to the collector side (emitter then is to GND) and measuring there doesn't seem to make a difference. Setting the pin up for ADC or not doesn't either. TRIS definitely has it set as input though. Looking online, seems like lots of circuits showing the hardware as I have it. Is it something about the PIC? I'm sure it's something dead simple. Suggestions? Rebukes?

  • 1
    \$\begingroup\$ Please provide a link to the datasheet for the phototransistor you are using, and draw a schematic of your circuit using the built-in schematic editor. Also, specify the resistor value(s) that you have tried. \$\endgroup\$ – Elliot Alderson Jan 14 at 21:16
  • 1
    \$\begingroup\$ Do you have any other modules enabled in the PIC? Some modules will override the TRIS settings if they need to use those specific pins. \$\endgroup\$ – Phil G Jan 14 at 21:16
  • \$\begingroup\$ @ElliotAlderson I've tried various ones from (a much too low) 10 ohm all the way up to 1 meg. Even used a multi-turn precision 1 meg pot in case there was a sweet spot. \$\endgroup\$ – Drone601 Jan 14 at 22:03
  • \$\begingroup\$ Remove your circuit and connect a 1.0K - 4.7K resistor from the PIC pin to Vcc. If the PIC pin is set to an output, it will sink 1 - 5 mA and be low without overheating. \$\endgroup\$ – AnalogKid Jan 14 at 22:25
  • \$\begingroup\$ If you have not made any mistakes, it's possible you've physically damaged the port pin circuitry and it is now shorted to ground. \$\endgroup\$ – Spehro Pefhany Jan 14 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.