Shop OBEX P1 Docs P2 Docs Learn Events
Problems with phototransistor (Process Control Text) — Parallax Forums

Problems with phototransistor (Process Control Text)

RyGuyRyGuy Posts: 7
edited 2009-10-26 02:13 in Learn with BlocklyProp
I'm working on chapter 4 of the Process Control text and I am having an unusual problem. Well, at least it seems unusual to me....

The readings I am getting from the phototransistor are weird when the collector node is connected to Vin (+) on the ADC08031 chip (pin 2). The readings are always between 0.12V-0.18V.

While I was trying to troubleshoot the problem I disconnected the two circuits and measured the voltage across the phototransistor with a multimeter. It worked perfectly. It was giving me close to five volts when my was hand far away and dropped as I brought it closer.

So, I thought the problem was with the ADC... but I reconnected a potentiometer to the ADC circuit in place of the phototransistor circuit and it too worked perfectly. Both circuits work on their own, but do not work together.

If I had to guess, I would think something is wrong with the ADC chip. Probably something to do with the input impedance being screwed up, but it seems to work fine with the potentiometer.

Anyway, do any of you have any ideas or similar experiences?

Thanks

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-10-16 01:42
    When the phototransistor is connected to the ADC, do you also have a pullup from the collector to Vdd? If not, you need one. (I assume the emitter is connected to Vss, right?)

    -Phil
  • RyGuyRyGuy Posts: 7
    edited 2009-10-16 04:09
    Yes, and yes. I've rebuilt the circuit three times and I'm 99% sure the circuit is right.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-10-16 04:17
    What is the value of the pullup resistor?

    -Phil
  • RyGuyRyGuy Posts: 7
    edited 2009-10-16 15:07
    The pull-up resistor is 10K.

    I've attached the schematic for the circuit from the text.
    425 x 660 - 25K
  • RyGuyRyGuy Posts: 7
    edited 2009-10-16 15:37
    Here is a picture of my circuit.

    Like I said, all I have to do is disconnect the blue wire connecting the phototransistor to pin 2 of the ADC and the phototransistor works properly when I measure the voltage with a multimeter.

    I am thinking something is wrong with the ADC, but I can't track one down at the local electronic shops or Digikey and the shipping charges to Canada are outrageous if ordering from the parallax store. I was hoping it was something wrong with the circuit...

    Post Edited (RyGuy) : 10/16/2009 3:42:45 PM GMT
    875 x 737 - 87K
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2009-10-16 16:27
    What is the state of Stamp pin P8? If it is a low output, that might explain your result. To test that, you can either disconnect the jumper to pin 8. and/or run a program that certainly sets that pin to INPUT.

    Also, be sure that the Vdd power to the chip is plugged into a Vdd socket at the end of the BOE.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • RyGuyRyGuy Posts: 7
    edited 2009-10-16 18:24
    Pin 8 is set as an input. This part seems to be working properly. If disconnected from the ADC, the LED will turn on when I bring my hand near and off when I move it away. When connected to the ADC, the LED is permanently on because the voltage is stuck around 0.18V.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-10-16 19:14
    Remove the ADC chip, and measure the resistance between the breadboard holes where pins 2 and 3 were. Do the same between pins 1 and 2. I don't see any obvious wiring errors, but there could be a short in the breadboard itself.

    -Phil
  • allanlane5allanlane5 Posts: 3,815
    edited 2009-10-16 19:45
    If you had the ADC inserted upside-down, this would happen.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-10-16 23:23
    Your schematic shows the ADC's pin 1 going to P13, but your photo show the ADC's pin 1 going to P12.

    (The ADC's pin 1 could be connected to V_ss instead, no I/O connection necessary.)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-10-17 02:09
    PJ,

    That wouldn't produce the behavior he's seeing, though. It would just prevent him from reading the chip if he's using P13 as a chip enable — or not: who knows where P12 might be floating.

    -Phil
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-10-17 03:55
    I think that the best way to find out what's going on is to construct the circuit in accordance with the schematic.

    The datasheet states:· "A conversion is initiated by first pulling the /CS line low.· This line must be held low for the entire conversion.· The converter is now waiting for a start bit and its MUX assignment word."

    [noparse][[/noparse]So, maybe keeping the /CS low isn't a great idea, but leaving it floating/not_LO is right out.]

    RyGuy, what's your progress?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-10-17 20:41
    The difficulty he's having, though, (as I read it) is not that he can't read a conversion value, but that the measured (by a voltmeter, presumably) phototransistor collector voltage is too low when the collector is connected to the ADC's input pin. There is nothing in the ADC's datasheet to suggest that there should ever be more than a few microamps of input leakage current under any conditions. So I doubt that the state of the /CS pin has a bearing on the current situation (so to speak smile.gif ), although it will certainly influence the chip's operation once he gets to that point in his testing. But, as far as I can tell, he's not that far yet.

    -Phil
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-10-17 22:22
    Been down this·"I'm doing everything right and nothing wrong, is Ground·the same as·V_ss,·I'm not using batteries afterall and·found out my wall-pack is an AC_output sort, don't have the resistors so I connected everything to ground which I'm sure is OK, I don't know what else to do so I connected everything backward and it still doesn't 'work'" road too many times before, Phil.·

    As far as I'm concerned, till the circuit as constructed and the schematic are in agreement then there's nothing much worth talking about.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-10-18 07:36
    It would be nice to see some code, too, just to verify for our own benefit that P8 isn't being pulled low. But the OP seems to have disappeared. In any event, the ball's in his court now.

    -Phil
  • RyGuyRyGuy Posts: 7
    edited 2009-10-19 21:46
    Hey guys, sorry to disappear on you, but I was away for the weekend. Thank you for all of your help so far.

    I rewired the circuit to make it neater for the picture and put that wire in the wrong spot. I've fixed that problem, but didn't have any affect on the behaviour of the circuit.

    I also tested the resistance in the breadboard as suggested by Phil and did not see any shorts in the breadboard.

    The code that i have been using is attached.


    I rebuilt the circuit with a potentiometer in place of the phototransistor and I was wrong earlier about it working properly. If I set the potentiometer to 3.5V at the tap without pin 2 of the ADC connected and then connect pin 2 the voltage shoots down to 0.55V. For 4.5V, connecting to pin 2 drags it down to 1.44V. I thought it was working properly before because I was able to get 5V out of the tap, but that was only with the potentiometer wide open.

    It looks like the problem is pin 2 of the ADC trying to drag any voltage applied to it to zero.

    I am thinking the best way to solve this problem would be to swap in another ADC chip and see if that fixes the problem. It would at least eliminate another possible source of the problem if that doesn't work. Like I said before though, I am having trouble tracking down that exact chip. Could any of you recommend another ADC with similar operation which might be more widely available?

    Again, thanks for all of your help.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-10-20 00:27
    Swapping in a new ADC sounds like your only option at this point.

    -Phil
  • allanlane5allanlane5 Posts: 3,815
    edited 2009-10-20 16:09
    Yes, the input of the ADC should be pretty high resistance (like 10 Megohms). It really shouldn't have the effect you're describing if it wasn't "blown".
  • RyGuyRyGuy Posts: 7
    edited 2009-10-26 02:13
    Alright, I've got an update on this. I bought a different ADC and the circuit now works.


    Unfortunately the only ADC I could find was the ADC0803LCN, which sends the output to 8 individual pins instead of sending the 8 bit output through 1 pin. Not too big of a problem, but now the breadboard is a mess of wires and I need to use 8 pins of the stamp to read the output. Though, after dealing with the frustration of the circuit not working, I have no problem dealing with this.

    Thanks for all of your help and advice.
Sign In or Register to comment.