Difference between revisions of "Entladung eines Kondensators"

From phyphox
Jump to navigation Jump to search
(Created page with "{{Infobox Experiment | Name = Acceleration Spectrum | Category = Tools | Sensors = Acceleration with g }} The experiment "Acceleration Spectrum" displays the frequency spe...")
 
(Erster Entwurf Kondensatorentladung)
Line 1: Line 1:
 
{{Infobox Experiment
 
{{Infobox Experiment
  | Name = Acceleration Spectrum
+
  | Name = Entladung eines Kondensators
  | Category = Tools
+
  | Category = Arduino library experiments
  | Sensors = Acceleration with g
+
  | Sensors = Voltage
 
}}
 
}}
  
The experiment "Acceleration Spectrum" displays the frequency spectrum as well as the peak frequency of acceleration data. You can choose the number of samples used for the spectrum. If you incease the number, the spectrum will have a higher resolution allowing for more precise frequencies. If you decrease the number, you will get faster responses to changes.
+
In diesem Experiment sollen die Schülerinnen und Schüler die Entladungskurve eines Kondensators messen. Dafür wird der analoge Eingang eines ESP32 (ein günstiger Mikrocontroller) verwendet. Der ESP wird mithilfe der Arduino-Bibliothek so programmiert, dass er die Daten an phyphox übertragen kann.
  
The maximum frequency in the spectrum is determined by the acquisition rate of the sensor (actually, it is half the acquisition rate). So, the spectrum will depend strongly on the device.
+
==Aufbau==
 +
Zuerst muss der ESP32 programmiert und verbunden werden. Die Spannung wird zwischen PINXY und GND gemessen.
  
==Requirements==
+
''Aufbauanleitung''
There are no hardware requirements. The accelerometer is used for this measurement.
 
  
==Setup==
+
Anschließend kann direkt losgelegt werden. Die entsprechenden Schaltbilder sind in den Arbeitsblättern zu finden.
  
There is no specific setup.
+
==Programmierung==
 +
Der ESP32 wird über die Arduino IDE programmiert. Es müssen die Definitionen für den ESP32 und die phyphox-Bibliothek installiert sein. Siehe dazu das Video unter [[:Category: Arduino library experiments]].
  
==Analysis==
+
Es ist darauf zu achten, dass jeder ESP32 eine eigene Kennung hat (diese wird in ''::start(ESP Voltmeter XY)'' festgelegt). Anschließend kann über das Plus-Symbol in phyphox ein Bluetooth-Experiment hinzugefügt werden, das Experiment wird dann automatisch geladen.
This experiments records the acceleration and keeps a history of the values. The Fourier transform is calculated over the last N samples, with N being chosen by the user. The peak frequency is the frequency of the maximum of the Fourier transform.
 
  
 +
<pre>
 +
#include <phyphoxBle.h>
  
==Problems and resolutions==
+
int ADC_GPIO = 25;    // ESP32
 +
//int ADC_GPIO = A0;  // Arduino Nano 33 BLE
  
* The frequency resolution is too low. The frequency resolution is limited by the length of the recording. By increasing the number of samples, you can increase the resolution, but this will also slow down the response to changes.
+
void setup() {
* The maximum frequency is too low. The maximum frequency is half the acquisition rate of the sensor (Nyquist frequency). So, the maximum frequency is a limitation of your device.
+
 
 +
 
 +
  // put your setup code here, to run once:
 +
  Serial.begin(115200);
 +
  PhyphoxBLE::start("ESP32 Voltmeter");
 +
 
 +
  PhyphoxBleExperiment Voltmeter;
 +
 
 +
  Voltmeter.setTitle("Voltmeter");
 +
  Voltmeter.setCategory("ESP32 Experiments");
 +
  Voltmeter.setDescription("This experiment will plot the measured voltage over time.");
 +
 
 +
  //View
 +
  PhyphoxBleExperiment::View firstView;
 +
  firstView.setLabel("Data"); //Create a "view"
 +
 
 +
  //Graph
 +
  PhyphoxBleExperiment::Graph firstGraph;      //Create graph which will plot random numbers over time
 +
  firstGraph.setLabel("Voltmeter");
 +
  firstGraph.setUnitX("s");
 +
  firstGraph.setUnitY("V");
 +
  firstGraph.setLabelX("time");
 +
  firstGraph.setLabelY("Voltage");
 +
 
 +
  /* Assign Channels, so which data is plotted on x or y axis
 +
    first parameter represents x-axis, second y-axis
 +
    Channel 0 means a timestamp is created after the BLE package arrives in phyphox
 +
    Channel 1 to N corresponding to the N-parameter which is written in server.write()
 +
  */
 +
 
 +
  firstGraph.setChannel(0, 1);
 +
 
 +
  firstView.addElement(firstGraph);            //attach graph to view
 +
  Voltmeter.addView(firstView);                //Attach view to experiment
 +
  PhyphoxBLE::addExperiment(Voltmeter);        //Attach experiment to server
 +
}
 +
 
 +
void loop() {
 +
  // put your main code here, to run repeatedly:
 +
  // measures the voltage as fast as possible, then calculates the mean over 100 values
 +
  int meas = 0;
 +
  for (int i = 0; i < 100; i++) {
 +
    meas = meas + analogRead(ADC_GPIO);
 +
  }
 +
 
 +
  meas = meas / 100;
 +
 
 +
  float meanvoltage = 3.3 * meas / 4095;
 +
 
 +
  //float voltage = 3.3 * analogRead(ADC_GPIO)/4095;
 +
  //delay(1);
 +
 
 +
  PhyphoxBLE::write(meanvoltage);
 +
 
 +
  //Serial.print("Voltage = ");
 +
  Serial.println(meanvoltage);
 +
 
 +
  delay(5); // approx 100Hz
 +
}
 +
 
 +
/*
 +
  Over serial with delay(10): approx 100Hz
 +
  Without delay: much higher
 +
*/
 +
</pre>
 +
 
 +
==Auswertung==
 +
Die Unterrichtseinheit gliedert sich in drei Teile: Zuerst wird eine einfache Entladekurve aufgenommen und die Spannung am Kondensator gemessen, dann wird der ''Strom gemessen'' und zuletzt der Spannungsverlauf bei verschiedenen Widerständen gemessen.
 +
 
 +
 
 +
==Probleme und Lösungen==
 +
 
 +
* test
 +
* test
  
 
[[Category:Arduino library experiments]]
 
[[Category:Arduino library experiments]]

Revision as of 17:10, 16 August 2023

Entladung eines Kondensators
Experiment Entladung eines Kondensators
Category Arduino library experiments
Used sensors Voltage


In diesem Experiment sollen die Schülerinnen und Schüler die Entladungskurve eines Kondensators messen. Dafür wird der analoge Eingang eines ESP32 (ein günstiger Mikrocontroller) verwendet. Der ESP wird mithilfe der Arduino-Bibliothek so programmiert, dass er die Daten an phyphox übertragen kann.

Aufbau

Zuerst muss der ESP32 programmiert und verbunden werden. Die Spannung wird zwischen PINXY und GND gemessen.

Aufbauanleitung

Anschließend kann direkt losgelegt werden. Die entsprechenden Schaltbilder sind in den Arbeitsblättern zu finden.

Programmierung

Der ESP32 wird über die Arduino IDE programmiert. Es müssen die Definitionen für den ESP32 und die phyphox-Bibliothek installiert sein. Siehe dazu das Video unter Category: Arduino library experiments.

Es ist darauf zu achten, dass jeder ESP32 eine eigene Kennung hat (diese wird in ::start(ESP Voltmeter XY) festgelegt). Anschließend kann über das Plus-Symbol in phyphox ein Bluetooth-Experiment hinzugefügt werden, das Experiment wird dann automatisch geladen.

#include <phyphoxBle.h>

int ADC_GPIO = 25;    // ESP32
//int ADC_GPIO = A0;  // Arduino Nano 33 BLE

void setup() {

  
  // put your setup code here, to run once:
  Serial.begin(115200);
  PhyphoxBLE::start("ESP32 Voltmeter");

  PhyphoxBleExperiment Voltmeter;

  Voltmeter.setTitle("Voltmeter");
  Voltmeter.setCategory("ESP32 Experiments");
  Voltmeter.setDescription("This experiment will plot the measured voltage over time.");

  //View
  PhyphoxBleExperiment::View firstView;
  firstView.setLabel("Data"); //Create a "view"

  //Graph
  PhyphoxBleExperiment::Graph firstGraph;      //Create graph which will plot random numbers over time
  firstGraph.setLabel("Voltmeter");
  firstGraph.setUnitX("s");
  firstGraph.setUnitY("V");
  firstGraph.setLabelX("time");
  firstGraph.setLabelY("Voltage");

  /* Assign Channels, so which data is plotted on x or y axis
     first parameter represents x-axis, second y-axis
     Channel 0 means a timestamp is created after the BLE package arrives in phyphox
     Channel 1 to N corresponding to the N-parameter which is written in server.write()
  */

  firstGraph.setChannel(0, 1);

  firstView.addElement(firstGraph);            //attach graph to view
  Voltmeter.addView(firstView);                //Attach view to experiment
  PhyphoxBLE::addExperiment(Voltmeter);        //Attach experiment to server
}

void loop() {
  // put your main code here, to run repeatedly:
  // measures the voltage as fast as possible, then calculates the mean over 100 values
  int meas = 0;
  for (int i = 0; i < 100; i++) {
    meas = meas + analogRead(ADC_GPIO);
  }

  meas = meas / 100;

  float meanvoltage = 3.3 * meas / 4095;

  //float voltage = 3.3 * analogRead(ADC_GPIO)/4095;
  //delay(1);
  
  PhyphoxBLE::write(meanvoltage);

  //Serial.print("Voltage = ");
  Serial.println(meanvoltage);

  delay(5); // approx 100Hz
}

/*
  Over serial with delay(10): approx 100Hz
  Without delay: much higher
*/

Auswertung

Die Unterrichtseinheit gliedert sich in drei Teile: Zuerst wird eine einfache Entladekurve aufgenommen und die Spannung am Kondensator gemessen, dann wird der Strom gemessen und zuletzt der Spannungsverlauf bei verschiedenen Widerständen gemessen.


Probleme und Lösungen

  • test
  • test