# Lesson 24--Microduino & Operational Amplifier--Noninverting Scaling Operation

Noninverting Scaling Operation Circuit Demo

## Purpose

The tutorial offers the basic knowledge of the operational amplifier. The example adopts the noninverting scaling operation circuit, which amplifies one dry cell battery to a certain ratio and detect the two voltage signals with Microduino.

## Equipment

Microduino-Core is the 8-bit single-chip development core board with Atmel ATmega328P as the core, which is an open and Arduino Uno compatible controller.

Microduino-USBTTL is the program download module, capable of connecting with Microduino-Core or Microduino-Core+ and making the modules communicate with the computer. It uses MicUSB as the download interface, which is also the smallest part of Microduino. Microduino is just as small as a quarter. Besides, the download cable is just like the USB cable of most smart phones, easy to use.

• Other Hardware Equipment
 Related hardware Number Function LM358 One As a dual operational amplifier, easy to achieve the mathematical operation circuit. 10K Ω resistor Three By changing the related resistance, you can get different output voltage. Dry battery one cell Used as input voltage Vin in the example. USB cable One Connect Microduino module and PC. Breadboard One Jumper One box Connector Various components gather here.

### LM358 Operational Amplifier

LM358 is a common chip, which contains two independent operation amplifier circuits inside. The operational amplifier A adopts pin 1 as the output end, pin 2 as the inverting output end and pin 3 as the noninverting input end. The operational amplifier B chooses pin 7 , pin 6 and pin 5 as the output end, inverting output end and noninverting input end respectively. The operational amplifier A and B share the same power end (Negative pin 4, positive pin 8). The chip can achieve both single and dual power supply, outputting the maximum voltage of 32V and +Vcc=+16V or -Vcc=-16V respectively. In the example, the negative of the battery connects with LM358 to the ground and the operational amplifier has single power supply for option.

LM358文档下载: File:358pdf.pdf

### Dry Battery

The dry battery is very common in our lives, whose electrolyte is non-liquid. That is why it gets the game. The dry battery can be supplied to the flashlight, radio, camera and electric toys. Here in the example is the AA battery. A cell of dry battery has a voltage of about 1.5 V, a cell of storage battery about 2V and the phone battery about 3.7V.

## Schematic

The output voltage of the LM358's pin 1 is Vout=Vin*(1+R2/R3). The noninverting scaling operation circuit owns high-input and low-output resistance. (High-input resistance means little influence on the signal source and low-output means strong load capacity.) Notably. No matter how we change the values of R2 and R3, the output voltage of the LM358's pin 1 won’t be higher than that of the power. (The voltage of the power in the example is 5V.)

## Program

///A0  connect  amp  output
///A1  connect  single battery  output
int  anaValueSingleBa;  //single battery  value  map(0--1023)
int  anaValueAmp;  //amp  value   map(0--1023)
float anaVoltageSingleBa;  //single battery  voltage
float anaVoltageAmp;  //amp  output  voltage
void  setup()
{
Serial.begin(9600);
}
void loop()
{
anaVoltageSingleBa=anaValueSingleBa/1023.0*5;
Serial.print("Single battery voltage  is  ");
Serial.print(anaVoltageSingleBa);
Serial.println("V");
delay(1000);
anaVoltageAmp=anaValueAmp/1023.0*5;
Serial.print("Amp  output  voltage  is  ");
Serial.print(anaVoltageAmp);
Serial.println("V");
delay(1000);
}

## Debugging

• Connect according the image above and make it right.
• Copy the program to Arduino IDE.
• Compile the program and choose the right board and serial port.
• Click Upload and after the upload, just open the serial monitor of Arduino IDE, then watch the result.
• Change the resistance of R2 and R3, you can see the output voltage change in the serial monitor. Eg.: (R2=5K,R3=10K) The output voltage will be accord with Vout=Vin*(1+R2/R3).
• No matter how you change the resistance of R2 and R3, the output voltage of pin 1 will never be higher than that of power.
• The voltage of the dry battery is about 1.5 V and we can get a lower voltage by resistive subdivision. You can try to connect 0.5V voltage to pin 3 of the operational amplifier and watch the output in the serial monitor.

## Result

Just build the circuit according to the schematic After program download, you can watch the output voltage in the serial monitor of Arduino IDE. Contrast Formulae: Vout=Vin*(1+R2/R3) for ease of analyzing experimental data.