Analog sensor in High and Low with basic components (no ic)

Hello dear all

I’m a pretty good user of Arduino. But my knowledge in basic electronics is lacking sometime.

I have an IR sensor coupled with an IR led to detect the distance. The phototransistor returns analog values according to the distance of my finger. But I’d rather have an all or nothing (High or low) result beyond a certain threshold. For example if the voltage at the output of the phototransistor is greater than 0.5 volts then I send 5 volts and otherwise I remain at O volts. I can not use IC or microcontroler to do thatbecause I have to multiply this assembly plenty of times. I thought I could do this with two transistors coupled but it does not work. Any ideas ?

best
Antonin

. For example if the voltage at the output of the phototransistor is greater than 0.5 volts then I send 5 volts and otherwise I remain at O volts

You'd at least need a transistor and you might need a little more than 0.5V to turn-on the transistor. (Also, a single-stage transistor is normally an inverter.)

The "perfect" solution is a comparator. A comparator switches output-states when the analog input is above or below an analog reference. (But a comparator is an IC or a bunch of discrete components.)

Hi,
If you are reading it in through an analog input, do your threshold detection in software.
No extra hardware needed.

If you do need the threshold adjustable, put a pot on another analog input to read threshold setting.

Tom... :slight_smile:

If you do use hardware the device that does this job is a comparator.

Thanks for your answer

TomGeorge:
Hi,
If you are reading it in through an analog input, do your threshold detection in software.
No extra hardware needed.

If you do need the threshold adjustable, put a pot on another analog input to read threshold setting.

Tom... :slight_smile:

no sorry Tom I need to replicate several times the circuit in a small gap for cheaper as possible.

MarkT:
If you do use hardware the device that does this job is a comparator.

Do you know if I could use a small and cheap component to do this ?

And other detail ... hum :slight_smile: ... I use this circuit to open and cut the data signal for several WS2812 LED trought a transistor. If I use a button everything work well but not with the IR sensor.

Hello
someone contact me by PM and told me than I didn't respect the rules without explanation of my project. So I hope to be more precise now :

In my project I use a teensy (but could be an Arduino too) to send the same WS2812B data to a plenty of WSLED (x512) and I pair on each LED a IR sensor (DIY sensor just an ir led coupling to an IR phototransistor) to send trough a transistor (for each LED) a signal to cut or not the data . The system works pretty well when the object stay in front of the IR sensor but when I remove the object and the distance increase the data is corrupt due to the low voltage on the base and the LEDs take a random color. I have to avoid this. I need to find a way to cut radically the signal send by the phototransistor when it's not enough to let the transistor transmit correctly the data.

I can't use a plenty of µcontroller due to the quantity of LED the price will explode. And I also would like to manage the smaller size as possible of PCB around the LED.
I can't cascading the IR sensor and analyse each distance data just to cut or not the data because the final design of the LEDs will not be in matrix shape but more like a maze.

here is a picture of my current tiny PCB than I have to reproduce plenty of time
photo transistor IR --> transistor base
data pin out from teensy --> transistor col
transistor émet --> WS2812 data input

I hope to be more clear like that