 # To amplify milliVolts (say 10-100 mV) data into 0-5 Volts using Arduino UNO

I am working on electrochemical sensors, where I need to do following tasks using Arduino UNO

1. To convert the milliVolts's data from the two electrodes (i.e., their difference) which is in the range of 10-200 mV. I want to amplify this data to display it on LCD to a range of 0-5 Volts.

2. Based on the Voltage displayed, it should tell the concentration of solution in which are electrode sensors are dipped say 10/100/1000 ppm.

# I was using this type of code and made a differential circuit to take the electrode difference and amplify it and sending the output of LM358 to A0 pin.

``````#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

const int VOL_PIN = A0;
int Value;
float Volt;
float vold;

void setup()
{
lcd.begin(16,2);
delay(500);
Serial.begin(9600);
}

void loop()
{
Volt = ((Value * 4.9/1023.0));

lcd.setCursor(0,0);
lcd.print("Value =");
lcd.setCursor(8,0);
lcd.print(Value);
Serial.print("Value: ");
Serial.println(Value);

lcd.setCursor(0,1);
lcd.print("Volt =");
lcd.setCursor(7,1);
lcd.print(Volt);
Serial.print("Volt: ");
Serial.println(Volt);

delay(500);
}
``````

Some Arduino boards can set analog inputs as differential inputs with a gain. That is not often used, and there is no common code for it.
A classic solution is with a OpAmp, that is the theoretical solution that we learned at school.
But I think that the most straightforward solution is an external ADC.

This is an external ADC, but I don't know if that is suitable for your project: https://www.adafruit.com/product/1085

In what range are the voltages ? You only mentioned the difference.

Your sketch contains "4.9", that is wrong. Use either 5.0 or an internal voltage reference.

Raw signal from electrodes are in MilliVolts range (10-200 mV). I want this signal to be amplified to a range of 0-5 Volts.
Further display both the data onto a LCD i.e., both mV and Amplified Volt data.

When you amplify the signals in the range of 0...5V, then you use the Arduino with the 5V as voltage reference. That is not accurate.
You need a good voltage reference to be able to measure a voltage. That means you don't have to amplify the signals for the 0...5V range.

According to the datasheet of the ADS1115, one of the voltage references is 256mV. You can use it in normal mode or differential mode. It would be a good solution for your project.

@dharmesh93 Please follow the advice given in the link below when posting code . Use code tags when posting code here to make it easier to read and copy for examination

What impedance are we talking about? For instance pH electrodes are extremely high impedance and require specialized techniques.

You want to read the analog signals from the sensor and convert them to a voltage between 0 and 5V, correct? You'll want to use some thing to measure the incoming voltages. I recommend using the analog input to read the sensor voltages. Then you can use the map() function to relate the milli volt reading to a bigger volt reading.

@dharmesh93
1. Amplify your electrode volatge to about 4.5V using the following difference amplifiier (Fig-1) and then feed to A0-poin of UNO. Figure-1:

2. It is recommended that you use +/-5V supply to minimize CMRR. If -5V is not available, then you can try with single +5V supply and observe the result and then apply correction for the offset. There is a possibility that the circuit may oscillate due to high gain. In that case you can use INA101 type true Instrumentation Amplifier.

You can't use a 741 from +/-5V rails with a 0..5V logic chip, it won't have the voltage swing to get above about 2V, and it will fry the microcontroller if the output dips below 0V.

A rail-to-rail opamp would be needed - indeed an instrumentation amp is probably a wise choice - the source impedance of the electrodes is essential information though, nothing can be finalized without this.

I appreciate your comment and observation. However, I don't see how 741's output can swing below 0V when the elctrode output is always positive.

Moreover, data sheets of ATmega328P says that a pin can tolerate -0.5V (Fig-1).

Figure-1:

Its got +/-5V supplies - so its output can swing down to negative voltages - its best to provide hardware protection against this rather than hoping it won't happen - what about power up and power down transients? What about noise on the sensor wiring? If the output of the opamp goes below -0.5V it could be an expensive mistake.

At the least you can add a 10k resistor in series with the output - analog inputs are designed to work from 10k or less source impedances.