Pages: [1]   Go Down
Author Topic: phototransistor detecting led  (Read 922 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: February 24, 2013, 02:42:54 pm by sandoz » Logged

Offline Offline
Faraday Member
**
Karma: 69
Posts: 2874
The last thing you did is where you should start looking.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would use this layout instead:


* Photo.jpg (86.48 KB, 527x395 - viewed 42 times.)
Logged

The way you have it in your schematic isn't the same as how you have it wired up! That goes for me too.

Sussex UK / CT USA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1028
Forums forever
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.)
« Last Edit: February 25, 2013, 04:58:17 am by tkbyd » Logged

Offline Offline
Faraday Member
**
Karma: 69
Posts: 2874
The last thing you did is where you should start looking.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

The way you have it in your schematic isn't the same as how you have it wired up! That goes for me too.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Sussex UK / CT USA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1028
Forums forever
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: