TRANSISTOR AS A SWITCH - and producing a logical output.

Thread Starter


Joined Mar 1, 2007
Im currently working on a project to produce a white line following robot. There are three main parts, [1] the sensors [2] the pic microcontroller [3] the motors.

+++++ Specification of the sensors
Supply to entire circuit 6v DC
Output measured from sensors when on white line 6.1v DC
Output measured from sensors when on BLACK line is 2.4v DC

The problem that i am having however is producing a logical 0 and 1 that i can compare the voltages of the inputs from the sensors too. An option that i have is to use the ADCON (ADC) on the PIC chip to convert the values of the input accordigly. On the other hand, there is the possibility of using a series of transistors to produce a 0v(zero) and a 6v(one).

I want to use the transistor arrangement because of its simplicity compared to the ADCON on the PIC.

If anyone is able to help i would be most grateful


Joined Feb 24, 2006
There are specific comparator parts, such as the LM393 or LM339, that operate off of a single supply and have an open collector logic output. This means it is compatible with whatever logic Vcc you're using. You can use an op amp, but it's kinda like using a circular saw as a wood chisel, or a pair of pliers to drive a nail.