Dies ist eine alte Version des Dokuments!
Kameraslider
—- datatemplateentry project —- template : templates:project # Kurzer Name des Projekts name : Kameraslider
# Bilddateiname relativ zum Ordner projekte: # Wenn (noch) kein Bild vorhanden, bitte none.png lassen imgname_img90 : Kameraschlitten/Bild_1.jpg
# Links zu Seiten der Mitglieder, die am Projekt beteiligt sind, also intern:mitglieder:hubert (mehrere mit Komma getrennt) person_pages : intern:mitglieder:markus
# Start- und Enddatum im Format JJJJ-MM-TT start_dt : 2015-12-15 end_dt : 2016-03-01
# Aktueller Status des Projekts, z.B. fertig, in Arbeit, eingestellt, Idee, … status_ : fertig
Einführung
Bei diesem Projekt handelt es sich um einen Kameraslider zur Montage einer Kamera (Spiegelreflex, Kompaktkamera, GoPro/Actioncams,…) um eindrucksvolle Zeitraffervideos zu erstellen.
Aufbau
Der Schlitten läuft auf zwei parallel gelegten Edelstahl Stangen welcher über einen GT2 Zahnriemen mit einem Schrittmotor angetrieben wird. Die Steuerung erfolgt auf einem Raspberry Pi auf dem ein Skript mit freier Eingabe der Variablen (Belichtungszeit der Kamera, Schrittzahl bis zum nächsten Foto, Geschwindigkeit und Richtung) läuft.
Programmablauf
Das Python-Skript frägt am Anfang die benötigten Informationen wie oben genannt ab. Danach kommt die Initialisierung, damit der Schlitten an das Ende der Schiene fährt. Es folgt das Abfahren der Positionen bis zum anderen Ende der Schiene. Des weiteren sind Funktionen wie das automatische wegfahren des Schlittens vom Endanschlag und Schalterentprellung mittels Software im Skript integriert.
- Die Entprellung ist für einen sauberen Programmablauf notwendig, da evtl. Funktionen mehrmals aufgerufen werden.
Materialliste
- 2x Edelstahlstab Durchmesser 8mm
- 4x Aufnahme 8mm
- 4x Schraube M5 Länge 80mm mit Muttern
- 2x Linearlager Durchmesser 8mm
- 2x Endschalter Öffner/Schließer (nur Schließer benötigt)
- 2x Riemenscheibe für GT2 Riemen
- 1x Schrittmotor
- 1x Pololu
- 1x Axiallager 5mm (Umlenkrolle)
- 1x Stab 5mm (Achse für Umlenkrolle)
- 1x Spannungsversorgung min. 12V
- Xx Diverse Kabel
Videos
https://www.youtube.com/watch?v=K3MUMkPOfkY
Code
- script_final_version_1.1.3.py
####################################################### ## Script by Markus Buecher ## GPIO Pins for Raspberry Pi B+ and 2B ####################################################### #This script is written to use an A4988 Stepper Driver like an Pololu, a Stepper Motor, #2 Endswitches and to trigger an Relayboard to trigger a camera with its remote connector. #Please pay attention while connecting your camera to the remote connector. This could cause #damage to your camera. Use this script at your own risk!! Have fun from __future__ import division import time import RPi.GPIO as GPIO #Deactivate warnings GPIO.setwarnings(False) #Configure the GPIO-Pins to Input and Output: #GPIO Number = Pin-Number at Board GPIO.setmode(GPIO.BOARD) #Variables zeit=int(raw_input("Exposure time: ")) dire=int(raw_input("Direction(right=1, left = 0): ")) numStep=int(raw_input("Steps: ")) sps=int(raw_input("Steps per Second: ")) tick= 1 / sps a=15 b=16 #Input GPIO.setup(15, GPIO.IN, pull_up_down = GPIO.PUD_UP) #Switch right GPIO.setup(16, GPIO.IN, pull_up_down = GPIO.PUD_UP) #Switch left #Output #Output for Stepper GPIO.setup(35, GPIO.OUT) #DIR GPIO.setup(36, GPIO.OUT) #STEP #Output Trigger GPIO.setup(29, GPIO.OUT) #Trigger stopFlag = False def initStep(): counter = 0 print("Initialising...") global stopFlag while not stopFlag: GPIO.output(36, GPIO.HIGH) time.sleep(tick) GPIO.output(36, GPIO.LOW) time.sleep(tick) def initStop(a): ctr = 0 global stopFlag stopFlag = True print("Stop") while (dire == 1 and ctr < 200): GPIO.output(35, GPIO.HIGH) GPIO.output(36, GPIO.HIGH) time.sleep(tick) GPIO.output(36, GPIO.LOW) time.sleep(tick) ctr = ctr + 1 while (dire == 0 and ctr < 200): GPIO.output(35, GPIO.LOW) GPIO.output(36, GPIO.HIGH) time.sleep(tick) GPIO.output(36, GPIO.LOW) time.sleep(tick) ctr = ctr + 1 def normalStop(b): ctr = 0 global stopFlag stopFlag = True print("Finished!") while (dire == 1 and ctr < 200): GPIO.output(35, GPIO.LOW) GPIO.output(36, GPIO.HIGH) time.sleep(tick) GPIO.output(36, GPIO.LOW) time.sleep(tick) ctr = ctr + 1 while (dire == 0 and ctr < 200): GPIO.output(35, GPIO.HIGH) GPIO.output(36, GPIO.HIGH) time.sleep(tick) GPIO.output(36, GPIO.LOW) time.sleep(tick) ctr = ctr + 1 if (ctr == 200): exit() def trigger(): print(" ") print("Taking Photo!") print(" ") time.sleep(0.5) GPIO.output(29, GPIO.LOW) time.sleep(zeit) GPIO.output(29, GPIO.HIGH) time.sleep(0.5) def step(numStep): print("Continue") counter = 0 while (counter < numStep): GPIO.output(36, GPIO.HIGH) time.sleep(tick) GPIO.output(36, GPIO.LOW) time.sleep(tick) counter = counter + 1 if counter % 100 == 0: print(counter) def right(): GPIO.output(35, GPIO.HIGH) def left(): GPIO.output(35, GPIO.LOW) def switch(m): GPIO.add_event_detect(15, GPIO.FALLING, bouncetime = 500) GPIO.add_event_detect(16, GPIO.FALLING, bouncetime = 500) if (m == 1): GPIO.add_event_callback(15, initStop) GPIO.add_event_callback(16, initStop) elif (m == 0): GPIO.add_event_callback(15, normalStop) GPIO.add_event_callback(16, normalStop) def init(): if (dire == 1): switch(1) left() initStep() elif (dire == 0): switch(1) right() initStep() def rightMainLoop(): right() step(numStep) trigger() def leftMainLoop(): left() step(numStep) trigger() init() time.sleep(3) raw_input("Finished initializing. Press any Button to continue...") print ("Wait!") while (dire == 1): GPIO.remove_event_detect(15) GPIO.remove_event_detect(16) switch(0) rightMainLoop() while (dire == 0): GPIO.remove_event_detect(15) GPIO.remove_event_detect(16) switch(0) leftMainLoop()