Monday, January 20, 2014

Raspberry Pi is a sissy

Yesterday i was just done repairing my free fall experiment and moved the 3.5 inch TV screen to the inside. By that i learned that acrylic glas can melt by a jigsaw. So i took my Proxxon (aka dremel) and a KT70 xy-stage and found out a router can melt acrylic as well :-(. Solution was to take of 0.2 mm each cut that the acrylic can cool down after cutting. Sometime i will rebuilt this to a CNC-machine. This is how it looks:


I figured out another usecase for the Capische: Stop motion. Like in timelapse photography you can set up a predefined path the camera will work its way though but the cool thing is that you trigger the movement to the next frame and trigger the photo by hitting a defined key on the bluetooth keyboard.


Then i just wanted to test a new version of the slider-program when i fried my pi by just connecting the easydriver via a sub-d port you can see on the picture. Seems like the raspberry pi cannot handle voltage-peaks. Ends up with a raspberry that can be used as a heater. The only thing it does is that the CPU heats up. I now have 3 raspberries lying around here i cannot use. 2 of them are bricked and at one (Model A) the TV-Out doesnt work any more. So if you want a raspberry pi for deco-purposes, let me know. A new one is ordered and tomorrow i can test it.

Here is the script i wanted to test out (please excuse the bad python but i am just about to test if everything works). It is supposed to move make a panning move and a move on the slider in timelapse.

import RPi.GPIO as GPIO
import time
import ConfigParser

#get the electric configuration
config = ConfigParser.RawConfigParser()
config.read('/home/pi/capische.conf')
Electric={}
options=config.options('Electric')
for option in options:
  try:
    Electric[option]= config.getint('Electric',option)
  except:
    print "Error in configfile"
    quit()

moveaccel= config.getint('Dolly','moveaccel')
movesteps= config.getint('Dolly','movesteps')
movedecel= config.getint('Dolly','movedecel')

timetowait=config.getint('Camera','timetowait')
timetowaithdr=config.getint('Camera','timetowaithdr')

maxsteps=1000

#start by setting everything to 0

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
for i in Electric.values():
  GPIO.setup(i,GPIO.OUT)
  GPIO.output(i,False)

#Pano-Easydriver wake up
GPIO.output(Electric['movesleep'],True)
GPIO.output(Electric['pansleep'],True)
GPIO.output(Electric['trigger'],False)

#nach Rechts drehen
GPIO.output(Electric['pandir'],True)

#accelerate
for i in range (0,moveaccel,20):
   for j in range (i):
     GPIO.output(Electric['movestep'],True)
     time.sleep(0.001)
     GPIO.output(Electric['movestep'],False)
     time.sleep(0.001)
     if (j % 200 == 0):
       GPIO.output(Electric['panstep'],True)
       time.sleep(0.001)
       GPIO.output(Electric['panstep'],False)
       time.sleep(0.001)
   GPIO.output(Electric['trigger'],True)
   time.sleep(1)
   GPIO.output(Electric['trigger'],False)
   time.sleep(timetowait)

#konstant
for i in range (0,movesteps,595):
   for j in range(595):
     GPIO.output(Electric['movestep'],True)
     time.sleep(0.001)
     GPIO.output(Electric['movestep'],False)
     time.sleep(0.001)
   for k in range(3):
     GPIO.output(Electric['panstep'],True)
     time.sleep(0.001)
     GPIO.output(Electric['panstep'],False)
     time.sleep(0.001)

   GPIO.output(Electric['trigger'],True)
   time.sleep(1)
   GPIO.output(Electric['trigger'],False)
   time.sleep(timetowait)

#decelerate
for i in range (movedecel,0,-20):
   for j in range (i):
     GPIO.output(Electric['movestep'],True)
     time.sleep(0.001)
     GPIO.output(Electric['movestep'],False)
     time.sleep(0.001)
     if (j % 200 == 0):
       GPIO.output(Electric['panstep'],True)
       time.sleep(0.001)
       GPIO.output(Electric['panstep'],False)
       time.sleep(0.001)
   GPIO.output(Electric['trigger'],True)
   time.sleep(1)
   GPIO.output(Electric['trigger'],False)
   time.sleep(timetowait)

#send Dolly-Easydriver to sleep
GPIO.output(Electric['movesleep'],False)
#send Pano-Easydriver to sleep
GPIO.output(Electric['pansleep'],False)

The config-file looks like this:
[Electric]
pandir=4
panstep=3
pansleep=2
movestep=15
movesleep=18
movedir=14
tiltdir=27
tiltsleep=10
tiltstep=22
trigger=11

[Dolly]
moveaccel=500
movesteps=90000
movedecel=500

[Camera]
timetowait=20
timetowaithdr=12
pan.fullturn.steps=8000
tilt.fullup.steps=4000
#focal length of 28mm (equal)
pan.steps=900
tilt.steps=700
 
 
Raspberry Pi is a Trademark of Raspberry Pi Foundation

No comments:

Post a Comment