Shop OBEX P1 Docs P2 Docs Learn Events
Voltage to fit Propeller I/Os — Parallax Forums

Voltage to fit Propeller I/Os

EMHmark7EMHmark7 Posts: 93
edited 2012-11-27 13:08 in General Discussion
Hi,

I have a phototransistor in series with a variable 1M Ohm resistor at ground side, so I get the most voltage from the sensor at the point between them.
here are samples of voltages I can get, depending on the resistor:

Dark Switched On by a monitored led

034mV 180mV
045mV 260mV
055mV 160mV
070mV 214mV
016mV 300mV
036mV 700mV
400mV 1.5V

There are possible errors due to breadboard contacts, sensor positionning, the hytech device hiding the ambiant light (namely one dark sox).
Bottom of the line, I can get dark voltage from 034mV to 400mV and lit voltage from 160mV to 1.5V.
I have tried many technique I know (I do not know well electronics) in order to get 2 states that wil be recognized as a 0 and 1 by the Propeller.

I tried several things but without success. The chips I have are for 6V (a comparator with a reference voltage). (My sensor is powered by 3V). I have linked both GND.
I tried a solution found on this forum that uses 3 transistors, 2N3904, 2N3904 and 2N3906.
I tried to feed the base of a 2N2222 transistor. Does not work.
I even tried to put some pullup resistor. Most of the time, my results are about 3V and I cannot get the Low state. Anybody could suggest the most simple way to acheive it? Thanks.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-11-23 12:47
    The LM339 comparator will operate very happily at 3.3V. You'll need a pullup resistor (to 3.3V) on the order of 3.3K to 10K. You'll also need a voltage divider (between 3.3V and ground) with the tap connected to Vref for the LM339. Any voltage over Vref will cause the LM339 to signal high and under Vref will cause a low output.
  • EMHmark7EMHmark7 Posts: 93
    edited 2012-11-23 13:25
    Ok I will try it. I already tried with LM2900 (needs a min 4.5V) but the output looks like proportional to input and always hi.
    Anyway, I will try your solution.

    1) The first pullup resistor you are talking about is for where?

    2) By the way, do you know if there is a 3.3V version of the old 555 chip (for those who do not know, 2 comparator at 1/3 and 2/3 of source plus a latch to make shure we saw any short pulse)?

    Thanks for your assistance, your the one I was hoping to see. I need to make this machine work before I take my plane on december 24 because I need that machine in my trip! Time is running faster than me...
  • Mike GreenMike Green Posts: 23,101
    edited 2012-11-23 13:29
    Look at the datasheet. There are some examples of basic connections there. See how they have the pullup connected.

    There's a CMOS version (LMC555) of the 555 that operates down to 1.5V Vdd. You could certainly wire up a LMC555 to act as a window comparator for your phototransistor (at 1/3Vdd and 2/3Vdd) if you wanted.
  • EMHmark7EMHmark7 Posts: 93
    edited 2012-11-23 19:56
    I think you solution with LM339 is cleaner. I purchased it with some potentiometers. It Wooooooorks! I catched also that even if I set the right Vref, this may vary with time, or when the components are heating, etc. So, after a while, Output was always at 3V. So, I raised the vref and the low state reappeared. So, It's good that I keep the potentiometers in the final application.

    Thanks again.

    Is it just the moderator that can tag as Solved?
  • Mike GreenMike Green Posts: 23,101
    edited 2012-11-23 20:29
    You can mark any thread you've started as Solved. I think you have to go to the first message and click on Edit Post.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-11-23 20:39
    Phototransistors are extremely temperature-sensitive, so the behavior you're seeing is not unexpected. If it becomes an issue, you might consider using something like one of these:

    -Phil
  • ercoerco Posts: 20,259
    edited 2012-11-24 09:05
    Phototransistors are extremely temperature-sensitive, so the behavior you're seeing is not unexpected.

    Did not know that! That is weird, wild stuff, as JC used to say.
  • EMHmark7EMHmark7 Posts: 93
    edited 2012-11-24 14:07
    Phototransistors are extremely temperature-sensitive, so the behavior you're seeing is not unexpected. If it becomes an issue, you might consider using something like one of these:
    -Phil

    The problem is ,aybe mor of the low light LED I want to monitor so the difference is about less than 200mA, so I put my REF voltage that compares in the middle, so leaving less than 100mA that can vary. Tanks for the link, I'll investigate in the future for improvement.
  • ercoerco Posts: 20,259
    edited 2012-11-24 14:43
    Do the Propeller's input pins not have a fixed high/low transition voltage? One of my favorite things about the Stamp is that each pin acts like a comparator with Vref=1.4V. A phototransistor & the right series resistor can be set to trigger at nearly any light level. Even a photocell works reliably in a voltage divider configuration.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-11-24 17:23
    The Prop's pins do have a fixed threshold of "about" Vdd /2, although it varies from chip-to-chip and maybe even from pin-to-pin on a given chip -- but not by much. It's been my experience, though, that phototransistors are the weak link when you want to produce a known voltage from a certain amount of light. They tend to drift with temperature, which is why I suggested integrated light-to-voltage chips that incorporate a photodiode and amplification.

    -Phil
  • EMHmark7EMHmark7 Posts: 93
    edited 2012-11-24 18:57
    erco wrote: »
    Do the Propeller's input pins not have a fixed high/low transition voltage? One of my favorite things about the Stamp is that each pin acts like a comparator with Vref=1.4V. A phototransistor & the right series resistor can be set to trigger at nearly any light level. Even a photocell works reliably in a voltage divider configuration.

    But Erco, The thing was to get higher 1 value without raising too much the 0 value. I think i'ts difficult to divide a tension if there is no juice. Right now I am using a LM339 that pushes the output at the extremes. The sensor gain is at max with a 1M resistor. But I will experiment alternate solutions in the future, because the 0/1 gap is maybe too tight.
  • ercoerco Posts: 20,259
    edited 2012-11-24 20:07
    The Prop's pins do have a fixed threshold of "about" Vdd /2, although it varies from chip-to-chip and maybe even from pin-to-pin on a given chip -- but not by much.

    @PhiPi: Thanks, and IMO that's the "fudgiest" answer I recall from you recently. :)

    @EMHmark7: C'est si bon, n'est-ce pas? Agreed, there is an optimum series resistor value to get the biggest voltage swing over the desired range of light, which doesn't necessarily yield the right voltage for the uC high/low transition at the desired light level. I forget exactly where I saw it, but the Dagu Mr. General robot (http://www.dagurobot.com/goods.php?id=2 ) uses a big IR emitter/phototransistor array. To increase sensitivity, it uses multiple pairs of phototransistors in parallel, plus a resistor to give a bigger voltage swing.

    Edit: found it at http://www.destiny-electronic.com.my/userfiles/file/product/robotic/robot-learning-kit/1073512.pdf
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-11-24 20:35
    erco wrote:
    @PhiPi: Thanks, and IMO that's the "fudgiest" answer I recall from you recently.

    Mmmmmm! Fudgy goodness!

    th_drooling-homer-simpson.jpg

    Gahhgrrammmph!
  • ercoerco Posts: 20,259
    edited 2012-11-24 21:43
    Nuttin' wrong with fudge. At least people actually consume fudge.

    As opposed to the seven documented remaining fruitcakes in circulation which remain untouched, unopened, and endlessly regifted. :)
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-11-25 13:53
    I LIKE FRUITCAKE!

    If anyone receives a fruitcake in error this Holiday season, feel free to forward it to me. Address provided via PM.

    Thank You!

    P.S. I like fudge having spent the summers of my youth in Northern Michigan, the land of Fudge!!
  • ercoerco Posts: 20,259
    edited 2012-11-25 14:31
    mindrobots wrote: »
    I LIKE FRUITCAKE!
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-11-27 13:08
    Turtles and Fruitcakes are both better when soaked in Rum/Brandy/Bourbon.
Sign In or Register to comment.