Go Down

Topic: phototransistor detecting led (Read 944 times) previous topic - next topic

sandoz

Feb 24, 2013, 08:32 pm Last Edit: Feb 24, 2013, 08:42 pm by sandoz Reason: 1
i am trying to detect a blue led with a phototransistor
i used this scheme:


when i connect it to a powersupply with 5V, the output works normally with 0 being no light and 4-5V for full light on A1 connector

Now, when i connect it to +5, gnd and A1, the voltage on gnd and A1 is always around 4,07V, also when theres no light

What am i doing wrong?


edit: notice when i disconnect the analog connector from the arduino i get correct readings from my voltage meter

LarryD

I would use this layout instead:
The way you have it in your schematic isn't the same as how you have it wired up!

tkbyd

#2
Feb 25, 2013, 10:49 am Last Edit: Feb 25, 2013, 10:58 am by tkbyd Reason: 1
Does that do more than create a not-inverted signal? (Does it do that?) Not that it isn't an improvement, if that's what the re-wiring is for... but I wondered if there were other advantages? (Assuming my guess is right as to one of them is!)

But!... to address the original question...

a) Have you somewhere in your code done something to re-program the analog pin for something else? (They can be treated as "ordinary" DIO pins... and set as outputs. In which case, you MAY have fried that "input" by now.)

b) Try this... test the input as follows... The first resistor is to "protect" things, in case your analog input has somehow become low impedence... as it would be it it is being turned into an output.

Connect a 10k (or so) resistor to the analog input. From the other end of that go to the wiper of a potentiometer... almost anything will do... about 10k by choice. Connect the top and bottom of the pot to 5v and 0 volts. Try the pot at different settings. What do you see with a voltmeter? What do you see if you "look" at the pin with software.

Should shed light on things...?

(You can get around the need for a pot with a pair of resistors in series across 5v to 0v... again, about 10k, and for a "wiper", just use a flying lead and touch top (5v), bottom (0v) and "the middle"... where the resistors connect to each other.)

LarryD

Common Collector & Common Emitter
Quote
inverted signal?

Yes.  Not a problem, use software to invert the results.

http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/transwitch.html#c4
The way you have it in your schematic isn't the same as how you have it wired up!

sandoz

problem was that the ethernet card's sd slot uses A0 and A1

sandoz

is it possible to add a simple led that flashes everytime a pluse is detected?

tkbyd

Yes... but you have to write the software to make it happen.

Your "loop()" would have to "watch" the input from the photo-transistor, and turn the LED on (briefly, if you like) when a "positive edge" was seen.

Much easier just to have the LED on when the phototranistor is illuminated, off when it isn't.

Go Up