Lesson 26--Microduino & Operational Amplifier--Differential Ratio Operation
Microduino & Operational Amplifier--Differential Ratio Operation
ContentsPurposeThis tutorial offers the basic knowledge of the operational amplifier, adopting differential ratio operation circuit. By changing the input voltage and watch the output result, you can have a better understanding of the usage of the differential ratio operation circuit. EquipmentMicroduino-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.
Adjustable DC power supplyWe often see the adjustable DC power supply in the lab. By adjusting the button of the potentiometer, the output voltage will change along with the adjustment of the button, which will often be shown on the LED display screen. The maximum voltage and current value allowed by the adjustable DC power supply will be different according to various needs. The most common adjustable DC power supply can be classified into two: One is the switching power supply, which has high output efficiency but has turbulence. The other is the linear power supply, which has a stable output and lower efficiency. This example adopts the 0-60V adjustable DC power supply with the maximum current output of 20A. (Switching power supply) SchematicWhat will you do if you want to measure the voltage of a 24V-battery and output the voltage value via Microduino? The first thing you think of may be lowering the voltage to one-tenth by resistive subdivision. (That is 2.4V, which can be recognized by Microduino analog interface.) Yes, that works! By the resistive subdivision, the measured negative voltage terminal needs to be connected with Microduino's GND end. By LM358 differential ratio operation circuit, this example can also achieve the measurement of the voltage(24V) without connecting the negative end of the voltage and Microduino's GND end. In the example, Vout=Vin*(R2/R1) provided that R1=R3, R2=R4. If R1=R3=3M, R2=R4=30K, you can detect a relatively higher voltage in the circuit. (The editor has used the parameter testing 400v DC voltage.) (Notes: The 3M resistor is cascaded by 1M and 2M resistors. Mind your safety when testing the high voltage.)
program///A0 connect amp358 output
int anaValueAmp; //amp value map(0--1023)
float anaVoltageAmp; //amp output voltage
void setup()
{
Serial.begin(9600);
}
void loop()
{
anaValueAmp=analogRead(A0);
anaVoltageAmp=anaValueAmp/1023.0*5;
Serial.print("Amp358 output voltage is ");
Serial.print(anaVoltageAmp);
Serial.println("V");
delay(1000);
Serial.print("The actual voltage is ");
Serial.print(anaVoltageAmp*10);
Serial.println("V");
delay(1000);
} Debugging
ResultBuild the circuit according to the schematic. After the download, you can watch the output voltage in the serial monitor of Arduino IDE. By analyzing the output data in the serial monitor, you can see the differential ratio operation circuit can measure the input voltage. Although the actual serial output voltage exists some errors and Microduino's 5V end is lower than 5V., there is anaVoltageAmp=anaValueAmp/1023.0*5 statement in the program. If you connect Microduino's 3V3 end to the analog quantity REF end and then modify the program, you can reduce the error.
Video |