20180123 arduino condensatore breadboard01

I propose a new measurement experiment using Arduino, working as DAQ (data acquisition instrument). I proceed as described in the articles Arduino and Excel with PLX-DAQ and Voltage divider measurements with PLX-DAQ: I mount my circuit on breadboard powered by the Arduino board at 5V. I propose to analyze the charge and discharge of a capacitor and collect data in a Excel spreadsheet.
In this lab test, I use the following devices: 1 capacitor 3300µF (electrolytic), 1 resistor 1kΩ,1 switch, 5V Arduino supply.

I write the Arduino sketch reported below.

#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
int cont = 0;

void setup() {
  Serial.begin(9600);
  Serial.println("CLEARDATA");
  Serial.println("LABEL,t,COUNTER,V-CONDENSATORE");
}

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.print(cont++);
  Serial.print(",");
  Serial.println(sensorVoltage);
  // delay 100ms
  delay(100);
}

The figure below shows a measurement test with data collection in Excel and a 2-Dline type graph to represent voltage measured on capacitor.

20180123 arduino condensatore breadboard02

 


Advertising

Advertising

Advertising

We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.