We know that Arduino allows to acquire data in the analog input. We can use Excel to store data in a sheet and display it in a graph using an application available on the network called PLX-DAQ (Parallax Data Acquisition), but this software doesn't work under Windows 10 and is no longer supported. So we can found a new version of PLX-DAQ re-written by NetDevil, an Arduino forum's member, to be able to be run on modern systems.
We want to measure the voltage variations from a trimmer. We take a device of any ohmic value and connect its two external pins respectively to 5V and GND pins supplied by Arduino. We pick up the voltage signal offered by the central pin, which varies according to the resistive divider that is formed while we turn its knob.
To collect data from our experiment, we can open the PLX-DAQ-v2.11.xlsm worksheet which contains a macro that allows us to save the data from the USB in Excel. To do this, we need to open PLX DAQ clicking on the respectively button and in the popup that the software opens we choose the USB Port to which Arduino is connected. Before clicking on the Connect button, we have to open Arduino IDE and use the sketch that is reported below, or use that is provided with PLX-DAQ software distribution.
#define sensorPin A0 // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor 0-1023
float sensorVoltage = 0; // variable to store the voltage coming from the sensor 0-5V
void setup() {
Serial.begin(9600);
Serial.println("CLEARDATA");
Serial.println("LABEL,t,A0");
}
void loop() {
// read the value from the sensor
sensorValue = analogRead(sensorPin);
// calculate voltage
sensorVoltage = sensorValue*5.0/1023.0;
// send value to USB
Serial.print("DATA,TIME,");
Serial.println(sensorVoltage);
// delay 100ms
delay(100);
}
Let's load this sketch in Arduino, which will send data read from the analog port A0 on the USB, associating them with the instant of acquisition time. We have programmed the Serial.print instructions according to the modality proposed by PLX-DAQ (see the reactive help for more details).
Arduino transforms all the signals that it receives on analogue pins into levels between 0 and 1023, so it is our task to enter in the sketch the calculations necessary to return the correct interpretation to the numerical values obtained. In this case the range 0÷1023 represents the voltages between 0÷5V, so we insert the instruction: sensorVoltage = sensorValue*5.0/1023.0
Before activating PLX-DAQ, we select column B and we assign a 2-Dline type graph to it. In this way, in addition to the data collection, we can see the temporary trend of the signal on the graph.
All versions of PLX-DAQ work good with Excel 2016.