Escolar Documentos
Profissional Documentos
Cultura Documentos
Goal: To measure and display the gain of a non-inverting amplifier using an Arduino Board
interfaced with 16x2 LCD Display.
Parts Required
1. Arduino Board
2. USB Cable
3. LM 741
4. 1k Ohm Resistor
5. 10k Ohm Potentiometer
6. 5k Ohm Potentiometer
7. Digital Multi-meter (DMM)
8. Wires
Procedure:
a. Non-inverting Amplifier circuit
Document1 Page 1 of 6
The Pin 7 and Pin 4 of LM 741 (Figure
2) are connected to the external power
supply of +15V and -15V respectively.
Please take care not to short any of the
Analog Input pins and the Digital I/O
pins of the Arduino board with the
external power supply. The ground of
the external power supply must be
connected to the ground bus of the
Arduino board
#include <LiquidCrystal.h>
int opampInputPin = 4; // Analog Input Pin to measure the Vin - input to the OPAMP
int opampOutputPin = 0; // Analog Input Pin to measure the Vout - output of the OPAMAP
Document1 Page 2 of 6
int opampInputValue = 0; // variable to store the Integer Value of Vin - input to the OPAMP
int opampOutputValue = 0; // variable to store the Integer Value of Vout - output of the OPAMAP
float opampInput = 0; // variable to store the actual value of Vin - input to the OPAMP
float opampOutput = 0; // variable to store the actual value of Vout - output to the OPAMP
void setup() {
lcd.begin(16, 2);
void loop(){
lcd.clear();
if(opampOutput <5.0){
opampInputValue = analogRead(opampInputPin);
opampInput = ( ( float(opampInputValue)/1023 ) * 5 );
opampOutputValue = analogRead(opampOutputPin);
gain = (opampOutput/opampInput);
lcd.setCursor(0,0);
lcd.print("Vin :");
lcd.print(opampInput);
lcd.setCursor(0,1);
lcd.print("Vout:");
Document1 Page 3 of 6
lcd.print(opampOutput);
lcd.setCursor(12,0);
lcd.print("Gain");
lcd.setCursor(11,1);
lcd.print(gain);
else{
lcd.setCursor(12,1);
lcd.print(gain);
delay(250);
// if OPAMP output is greater than 5, which can't be measured by the Arduino Board
else{
//blink
lcd.noDisplay();
delay(250);
lcd.display();
delay(250);
opampOutputValue = analogRead(opampOutputPin);
Document1 Page 4 of 6
c. Display amplifier input, amplifier output and gain
In order to display the measured values you will have to wire the 16x2 LCD display (Figure 4) to
6 Digital Output pins of the Arduino board.
Wire the pins according to the following assignments:
LCD 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Arduino
GND +5V GND 12 GND 11 - - - - 5 4 3 2 +5V GND
Board
The input voltage Vin of the non-inverting amplifier can be changed by varying R3(5k Ohm
Potentiometer). The change in value of Vin is displayed real-time in the LCD Display.
Av = Vout/Vin = 1 + (R2/R1)
The value of R1 (1k Ohm) is fixed. The gain of the non-inverting amplifier can be changed by
varying R2 (10k Ohm potentiometer). The change in value of Av is displayed real-time in the
LCD Display.
Document1 Page 5 of 6
Please note that the Arduino analog Input pins can’t measure values beyond +5V. To obtain a
range of gain Av values you can change the input voltage Vin by changing the value of R3(5k
Ohm Potentiometer). Whenever your amplifier output is greater than +5V the LCD display will
blink Vout > 5V, change the value of Vin by changing R3 or change the value of Av by changing
R2 to make Vout less than or equal to 5.00V
Set the input voltage of the non-inverting amplifier (Vin) to different values between 0.01V and
5.00V, change the gain (Av) by varying R2. Measure the value of R2 using DMM, calculate the
theoretical value of gain (Av) and record the practical value of gain (Av).
g. Questions:
i. Explain how do you measure/calculate the following using the Arduino Board?
a. Input Voltage(Vin)
b. Ouput Voltage(Vout)
c. Gain(Av)
ii. What are the maximum and minimum gain values of the non-inverting amplifier that
can be measured using this Arduino board set-up?
iii. Can the Arduino board be used to measure gain of an inverting amplifier?
GOOD LUCK!
Document1 Page 6 of 6