Lesson 25--Microduino & Operational Amplifier-- Inverting Scaling Operation

From Microduino Wiki
Jump to: navigation, search

Purpose

The tutorial offers the basic knowledge of operational amplifier and this example shows the inverting scaling operation circuit. By changing the resistance value of R1, R2, R3 and R4, you can watch the output result and understand the usage of direction scale operations.

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 downlaod 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.
ICL7660 One Negative pressure generation chip
10K Ω resistor Two By changing the related resistance, you can get different output voltage.
5.1K Ω resistor By changing the related resistance, you can get different output voltage.
20KΩ resistor One By changing the related resistance, you can get different output voltage.
10uf 16V capacitor Two Connected with the chip ICL7660, used as generating -5v voltage. The example adopts tantalum capacitor.(Electrolytic condenser will also be OK.)
Multimeter One For measuring output voltage. (The Vout-pin1’s negative pressure value in this example can be detected by the multimeter.)
Dry battery One cell sed as input voltage Vin in the example.
USB cable One Connect Microduino module and PC.
Breadboard One Various components gather here.
Jumper One box Connector

ICL7660

ICL7660 is the common negative pressure generation chip. Below is the schematic: S1, S3 and S2, S4 are gang switches, which are switches turning on or turning off at the same time. In the half cycle, S1 and S3 are closed and S2 and S4 are disconnected when voltage Vin charges C1 capacitor. In the other half cycle, S1 and S3 are disconnected and S2 and S4 are closed when C1 charges C2. Since the input electricity of C2 shows negative up and positive down, and the positive end of C2 connects GND, it indicates that the Potential of C2 in the negative terminal is negative.

7660sch.jpg

ICL7660 file download:File:ICL7660.pdf

Schematic

358ProtelSchInvert.jpg

LM358 is charged by the dual power. The pin 1 output voltage of LM358 is Vout-pin1=-Vin*(R2/R1). If there is the introduction of -5V power, the pin 1 of the LM358 won’t have negative pressure output. The voltage value can be measured by the multimeter. Vout-pin7=-Vout-pin1(R4/R3), the output voltage of pin 7 is positive, which is recognized by Microduino’s A0 port and can be output in the serial monitor of Arduino IDE. Besides, the output voltage of pin 7 can also be measured by the multimeter. The voltage to ground of the pin 2 and pin 3 in the example is 0V . And the noninverting scaling operation circuit can refer to: [1] The voltage to ground of pin 2 and pin 3 is not 0V. We should know that the voltage of the operational amplifier pin is different in different operation circuit.

Program

///A0  connect  amp358_7  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()
{
 anaValueSingleBa=analogRead(A1);
 anaVoltageSingleBa=anaValueSingleBa/1023.0*5;
 Serial.print("Single battery voltage  is  ");
 Serial.print(anaVoltageSingleBa);
 Serial.println("V");
 delay(1000);
 anaValueAmp=analogRead(A0);
 anaVoltageAmp=anaValueAmp/1023.0*5;
 Serial.print("Amp358_7  output  voltage  is  ");
 Serial.print(anaVoltageAmp);
 Serial.println("V");
 delay(1000);
}

Debugging

RealConnect358Invert.jpg
  • You can refer to the wire connection above and make sure it is all right.
  • Copy the program to Arduino IDE.
  • Compile the program and choose the right board and the related serial port.
  • Click Upload, open the serial monitor of Arduino IDE and watch the result. The output voltage of Vout-pin 1 can be measured by the multimeter.
358invertComOutput.jpg
  • Change the resistance value and watch the change of the output voltage value in the serial monitor. Eg. R3=2K and the other resistance keeps unchanged. Watch the output voltage and compare it with the formula.

Result

Build the circuit according to the schematic and you can see the output voltage in the serial monitor of Arduino IDE, then analyze the data.

Video