HIGH and LOW constants without Arduino

Does anyone know how to make a circuit with basic electronic components (resistors, capacitors, transistors, etc.)(without Arduino, micro-controller, or IC) that turns on an led with 5v, once the voltage is above a certain point? Otherwise if the voltage is below the threshold it would give the led 0v.

kind of like this code:

int pot = 8;     // pot on analog 0
int led = 13;     // led to be lit once pot reading reaches threshold

int threshold = 500;     // reading from pot at which led lights

void setup() {
  pinMode(led, OUTPUT);

void loop() {
  // check pot voltage and light led if it is above the threshold
  if(analogRead(pot) > threshold){
    digitalWrite(led, HIGH);
  // otherwise set the led LOW
    digitalWrite(led, LOW);

I want to be able to make a circuit like this with an adjustable "threshold" without any IC.
It would help me a lot if anyone knows. I don't understand how micro-controllers, determine the a bit 1 or 0 according to the voltage.



Series diodes.


A comparator can be built from discrete transistors - at heart its just a long-tailed pair (differential pair).

When the base of one transistors is more than a few tens of mV higher than the other, most of the
current flows through it, not the other transistor.

Comparator chips increase the voltage gain by using active current source loads and a second
stage, so that the switching occurs within a fraction of a millivolt.

I was able to get it to work with an OP-AMP comparator. It works just as good as my Arduino.
Thanks for the help. :slight_smile: