« first day (1769 days earlier)   

2:09 AM
does anyone still chat?
@UbuntuUser can i see the quection page?
 
 
16 hours later…
6:29 PM
Hi all - I'm new to circuit design, but not programming. I'm trying to read from an Infrared detector (sparkfun.com/products/241) -- datasheet here: sparkfun.com/datasheets/Components/LTR-301.pdf
Would it be possible to use the digital GPIO to monitor the output of that?
Feels like I need to convert Analog -> Digital, but I read something that lead me to believe that I might not need additional circuitry.
Ideally, I set this up in such a way that it's a discrete 0 or 1, and then use an interrupt when the value changes (as opposed to polling)
 
Howdy
connect the phototransistor (like shown in the schematics) via a resistor to 3.3V not 5V
that way you should be able to directly connect it to the Pi's GPIO pin (in the schematics labeled "output")
 
@Ghanima so -- 3.3v+ -> resistor -> phototransistor -> output to gpio?
1k ohm?
 
it reads 10k
no need to significantly change that
 
Ah, ok
So, just use a 3.3v source instead of 5v?
What does that achieve?
 
drive the LED like shown in the schematics but the transistor from 3.3V
reason is this:
the maximum input voltage of the Pi's GPIO pins is 3.3V not 5V
so you want to limit the upper voltage level to 3.3V
 
6:44 PM
Makes sense. And will the output from the phototransistor be discrete? (0 or 1) ?
 
it sure is possible to have an output that is inbetween high and low
 
(0v or 3.3v)?
 
so it depends a little bit on the rest of your setup
i.e. have the phototransistor properly illuminated by the LED to have the transistor properly saturated
 
Here's the actualy application - this is a racetrack "finish gate". I need to know when a car is passing over the phototransistor, and throw an interrupt when it happens.
 
hmm
 
6:46 PM
Feel free to suggest a different approach.
(including entirely different hardware.)
In the end, I need accurate timing.
 
the thing with this setup is that it is fairly sensitive to ambient light
 
My old circuit (using a netduino) polled all 4 lanes. It was two slow (3.153s and 3.157s could be a tie.)
 
as the gap between the sender (LED) and the detector (phototransistor) gets larger your more prone to get trouble with ambient light
how did you read the detector with the *duino ?
 
Analog input
(hang on, github link incoming)
 
so you actually have a setup of the the LED / transistor pair up and running
... and with all that being attached to an analog input you could actually test its output levels for both cases
 
6:52 PM
It was completely analog with that code ... fluctuated all over the place between 80 and 1200 or so.
 
@LynnCrumbling btw: it doesn't need to be exactly 0 and 3.3 V
 
I think a difference of 500 was my magic number.
 
lower than 0.5 V is likely low and higher than 2 V is likely high
@LynnCrumbling but you have a number for "no car" and for "car" and you could calculate the voltage from that
 
Can I still use an interrupt, and set a threshold for the interrupt to fire only when it crosses that number?
 
that I do not know for sure, maybe they know better there: arduino.stackexchange.com
 
7:01 PM
Ah, ok.
Is there an "easy" way to get 5v -> 3.3v?
(My power source for all of that is 5v atm)
 
hmm, if you use a Pi, you could use the 3.3V from the GPIO connector for things like this transistor here
 
7:32 PM
Well, the physical location of the phototransistor will be about 15m away from the pi
It has its own 5v power supply to power leds + phototransistors atm
 

« first day (1769 days earlier)