meta data for this page
This is an old revision of the document!
Syntax und Funktionen im Wiki
Hier noch Links zu
Fußnotentest 1)
Auswertung Gruppe 310 - Besenstiel
Der Versuch wurde durchgeführt von: Erin Feldkemper und Arthur Wohlfahrt
Die Wiki-Seite wurde angelegt am: @DATE@
In diesem Wiki soll die Durchführung des Besenstiel-Versuches im HomeLab dokumentiert werden
Aufbau 1
Zur Messung der Fallzeit haben wir uns für eine Lichtschranke entschieden
Schaltung
Computerprogramm
Das Zeitschrittverfahren oder auch Euler-Verfahren zur numerischen Berechnung der Fallzeit wurde mit Python realisiert. Code (samt Kommentaren) und resultierende Plots sind eingefügt.
Die verwendete Lichtschranke wurde mit dem Microcontroller-Board Arduino Uno realisiert. Der Programmcode dazu befindet sich am Ende dieses Abschnittes.
Zunächst zur allg. Berechnung des Winkels in Abhgkt. zur Zeit
- ExplizitesEulerVerfahren.py
- import numpy as np
- import matplotlib.pyplot as plt
- import math
- #Variablen und Konstanten
- tmax=2
- dt=0.01 #10 ms
- g=9.81
- l=1.45 # m
- tau=math.sqrt(2*l/(3*g))
- vPhi0=0 #zero initial phi-velocity
- phi0=0.25
- t=[]
- phi=[]
- vPhi=[]
- # initial values
- phi.append(phi0)
- vPhi.append(vPhi0)
- i=0
- #Explizites Euler Verfahren/ Iteration
- while True:
- vPhi.append(vPhi[i] +dt*math.sin(phi[i])/(tau**2))
- phi.append(phi[i]+dt*vPhi[i])
- i+=1
- if phi[i] >= math.pi/2:
- break
- # Berechnung Auftreffzeitpunkt
- tmax=len(phi)*dt
- print(tmax)
- #erzeuge Zeiten
- t=np.arange(0,tmax,dt)
- # Erzeuge eine Figure.
- fig = plt.figure(figsize=(9, 4))
- fig.set_tight_layout(True)
- # Plotte das Winkel-Zeit-Diagramm.
- ax1 = fig.add_subplot(1, 1, 1)
- ax1.set_xlabel("t [s]")
- ax1.set_ylabel("phi [rad]")
- ax1.grid()
- #ax1.plot(t, vPhi, ".b", label="Vphi")
- ax1.plot(t, phi, ".r", label="Phi")
- ax1.legend()
- plt.show()
- StartwinkelFallzeit.py
- import numpy as np
- import matplotlib.pyplot as plt
- import math
- #variables and constants
- tmax=2
- dt=0.01 #stepsize
- g=9.81
- l=1.45 # m
- tau=math.sqrt(2*l/(3*g))
- vPhi0=0 #zero initial phi-velocity
- #method to solve the diff-eq.
- def solver2(phi0,stepT):
- t=[] #generate lists
- phi=[]
- vPhi=[]
- # initial values
- phi.append(phi0)
- vPhi.append(vPhi0)
- i=0
- while True: #iterations according to Euler
- vPhi.append(vPhi[i] +stepT*math.sin(phi[i])/(tau**2))
- phi.append(phi[i]+stepT*vPhi[i])
- i+=1 #next step
- if phi[i] >= math.pi/2: # stick has reached ground at 90°
- break
- tmax=len(phi)*stepT #calculate elapsed time
- t=np.arange(0,tmax,stepT)
- return (tmax,t,phi) #return tupel with fall-time + time and angle arrays
- #initial angles
- initPhi=np.arange(0.25,1.3,0.05)
- def calcTs(step): #calc the fall time for different initial phi
- ts=[]
- for i in initPhi: #generate list of times
- ts.append(solver2(i,step)[0]) #first element in return tuple is tmax
- return ts
- steps=np.array([0.1,0.05,0.01,0.001])
- times=[]
- for m in steps:
- times.append(calcTs(m))
- # Erzeuge eine Figure.
- fig = plt.figure(figsize=(7, 5))
- fig.set_tight_layout(True)
- # Plotte das Diagramm.
- ax1 = fig.add_subplot(1, 1, 1)
- ax1.set_xlabel("phi0 [rad]")
- ax1.set_ylabel("T [s]")
- ax1.grid()
- ax1.plot(initPhi, times[0], ".b", label=f"dt={steps[0]}")
- ax1.plot(initPhi, times[1], ".r", label=f"dt={steps[1]}")
- ax1.plot(initPhi, times[2], ".g", label=f"dt={steps[2]}")
- ax1.plot(initPhi, times[3], "xm", label=f"dt={steps[3]}")
- ax1.legend()
- #anzeigen
- plt.show()
Arduino Code
- Lichtschranke.ino
- /*
- Control two light barriers, connected to pin A0 and A2 (arduino UNO)
- Indicator leds are connected to pin 12 and 13.
- Measure time in ms between to detections of the upper/lower light barrier.
- 27.12.2020
- */
- boolean dectUp = false;
- boolean dectLow = false;
- boolean timer = false; //timer running?
- int trigUp = 700;
- int trigLow = 950;
- unsigned long deltaT = 0;
- unsigned long t = 0;
- unsigned long deltaTU = 0;
- unsigned long tU = 0;
- void setup() {
- // initialize serial communication at 9600 bits per second:
- Serial.begin(9600);
- pinMode(12, OUTPUT); //indicator low
- pinMode(13, OUTPUT); //indicator high
- }
- void loop() {
- // read the input on analog pin 0:
- int valueLow = analogRead(A0);
- int valueUp = analogRead(A2);
- // print out the value you read:
- /*Serial.print(valueLow);
- Serial.print(" | oben: ")
- Serial.println(valueUp);
- */
- //delay(100); // delay in between reads for stability
- if (valueUp < trigUp) { // upper sensor
- //Serial.println("Ready");
- if (dectUp && timer == false) { //first light after dark and timer not running
- Serial.println("Rest");
- Serial.println(millis() - t);
- t = millis(); //start timer
- timer = true; //timer on
- Serial.println("Start");
- }
- digitalWrite(13, HIGH);
- dectUp = false;
- }
- else { // Dark UP
- //Serial.println("Detected");
- digitalWrite(13, LOW);
- delay(5); // detection break
- dectUp = true;
- timer = false; //timer off
- }
- //Serial.print("time-complexity: ");
- //Serial.println(millis()-tU);
- //tU = millis();
- if (valueLow < trigLow) { //lower sensor
- digitalWrite(12, HIGH);
- //Serial.println("Ready");
- dectLow = false;
- }
- else { // Dark LOW
- //Serial.println("Detected");
- if (!dectLow && timer) { //first dark after light
- deltaT = millis() - t;
- timer = false; //timer off
- Serial.print("Detected: ");
- Serial.println(deltaT);
- }
- digitalWrite(12, LOW);
- //delay(1); // detection break
- dectLow = true;
- }
- }
Computerprogramm
Vorgehen - Messung 2
Um die Fallzeit des Besenstiels mit der Länge l=1.28(m) zu bestimmen, wurden auf dem Boden eine Markierung neben den Schreibtisch gemacht um den Besenstiel immer vom gleichen Ort fallen lasse zu können. Auf dem Schreibtisch wurden 5 verschiedene Markierungen geklebt um verschiedene Winkel messen zu können (siehe Foto 1). Anschließend wurden mithilfe der App “iLevel” die Winkel bestimmt und pro Winkel werden nun jeweils 5 Fallzeiten manuell aufgenommen (siehe Tabelle 1).
Tabellen Versuch 2
98.0° | 115.4° | 127.3° | 136.8° | 143.4° | |
---|---|---|---|---|---|
1. | 0.93 | 0.69 | 0.91 | 0.65 | 0.64 |
2. | 1.07 | 0.64 | 0.65 | 0.83 | 0.46 |
3. | 0.97 | 0.79 | 0.56 | 0.75 | 0.37 |
4. | 0.99 | 0.7 | 0.63 | 0.48 | 0.49 |
5. | 1.09 | 0.76 | 0.74 | 0.53 | 0.49 |