I am seeking for a measurement method to read an Analog input using an Arduino Mega. My setup includes some RF instrumentations such as signal generator and power detector. Basically, I feed the power detector with a cw signal, which provides an output in DC voltage type. This DC voltage is in the Millivolts order (checked using Multimeter). However, when the arduino analog input and the ground is connected, serial monitor prints only 0 mV.
To solve this problem, I have tried a few ways as follows:
Checking the arduino's all analog input pins whether operational or not. (I have tested using a DC power supply, accurate results are printed properly, thus, arduino board is ok.)
Checking all the wirings and the connections. (When the multimeter is connected to the same jumper endings, shows the correct value, but, when the arduino is connected, prints only 0 mV.)
Finally, here is the code I have been using:
const int analogPin = A0; // Analog pin to read the voltage
const float referenceVoltage = 5000.0; // Reference voltage in millivolts (5V for most Arduinos)
void setup() {
Serial.begin(9600); // Start serial communication
}
void loop() {
int rawValue = analogRead(analogPin); // Read raw ADC value
float voltage = (rawValue * referenceVoltage) / 1023.0; // Convert to millivolts
Serial.print("Raw ADC Value: ");
Serial.print(rawValue);
Serial.print("\tVoltage: ");
Serial.print(voltage, 2); // Print voltage with 2 decimal places
Serial.println(" mV");
delay(1000); // Delay for better readability (adjust as needed)
}
You say you are measuring a voltage in the millivolt range, the ADC goes from 0 to 1023, split that up across 5V and you get steps of about 5mV. If your signal is less than 5mV you are going to see zero.
Yes I am aware that the resolution value is not that high. However, my reading should vary within 0mV-600mV range (Expected outcome is defined in datasheet, and tested via multimeter).
Your detected RF signal may be pulsating at the carrier frequency.
You multimeter does some form of averaging and is giving you a reading, however the Arduino only takes an instantaneous reading.
You might just be unlucky in that the Arduino happens to sample at a low point in the waveform.
Try connecting a capacitor between the Arduino input and GND, so that you are forming a peak detector with the detector. Value does not need to be very high at radio frequencies - try say 10nF to 100nF sort of range.
Not really, when the input signal amplitude is increased, you can clearly see the oscillations. In this case (under normal conditions), adding a capacitor would help me but it did not. Most reliable measurement method is using multimeter according to the manufacturer. Considering their test setup, multimeter would be enough to test device and DC output.
By any chance, could the issue root from a possible "RF instrument - Arduino" mismatch?