lucian_vdo
Published

Arduino Variable Gain Amplifier

Use an Arduino board to control different gain coefficients from an operational amplifier.

IntermediateShowcase (no instructions)12,053
Arduino Variable Gain Amplifier

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
General Purpose Quad Op-Amp
Texas Instruments General Purpose Quad Op-Amp
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Resistor 4.75k ohm
Resistor 4.75k ohm
×1
Resistor 2.21k ohm
Resistor 2.21k ohm
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Resistor 100 ohm
Resistor 100 ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

capture_UnjjlKWDLA.JPG

Code

vga.ino

C/C++
void setup() {
  pinMode(2, OUTPUT);// to pin 1C
  pinMode(3, OUTPUT);// to pin 2C
  pinMode(4, OUTPUT);// to pin 3C
  pinMode(5, OUTPUT);// to pin 4C
  Serial.begin(9600);
}

char cmd;

void loop() {
  while (Serial.available() > 0) {
    cmd = char(Serial.read());
    
    if (cmd == '0') {
      digitalWrite(2, 1);
      digitalWrite(3, 0);
      digitalWrite(4, 0);
      digitalWrite(5, 0);
    }
    if (cmd == '1') {
      digitalWrite(2, 0);
      digitalWrite(3, 1);
      digitalWrite(4, 0);
      digitalWrite(5, 0);
    }
    if (cmd == '2') {
      digitalWrite(2, 0);
      digitalWrite(3, 0);
      digitalWrite(4, 1);
      digitalWrite(5, 0);
    }
    if (cmd == '3') {
      digitalWrite(2, 0);
      digitalWrite(3, 0);
      digitalWrite(4, 0);
      digitalWrite(5, 1);
    }
    if (cmd == '4') {
      digitalWrite(2, 1);
      digitalWrite(3, 0);
      digitalWrite(4, 0);
      digitalWrite(5, 1);
    }
    if (cmd == '5') {
      digitalWrite(2, 1);
      digitalWrite(3, 0);
      digitalWrite(4, 1);
      digitalWrite(5, 0);
    }
    if (cmd == '6') {
      digitalWrite(2, 1);
      digitalWrite(3, 1);
      digitalWrite(4, 0);
      digitalWrite(5, 0);
    }
    if (cmd == '7') {
      digitalWrite(2, 0);
      digitalWrite(3, 1);
      digitalWrite(4, 0);
      digitalWrite(5, 1);
    }
    if (cmd == '8') {
      digitalWrite(2, 0);
      digitalWrite(3, 1);
      digitalWrite(4, 1);
      digitalWrite(5, 0);
    }
    if (cmd == '9') {
      digitalWrite(2, 0);
      digitalWrite(3, 0);
      digitalWrite(4, 1);
      digitalWrite(5, 1);
    }
  }
}

Credits

lucian_vdo

lucian_vdo

1 project • 12 followers

Comments