Monday, June 17, 2013

Friday, May 10, 2013

Automatically taking photos of the sunrise over Mt. Rainier

The view from my bedroom window
I wish I had done this earlier and not when I have 2 more weeks left in the house before I move to a place that does not have a perfect view of Mt. Rainier from the master bedroom window. I've connected this shutter release cable for the 5D to an opto-isolator chip which is then connected to one of the GPIO pins on my pcDuino. Whenever I want to wakeup the camera I set the GPIO pin high for 500ms to wakeup the camera. Then I use gphoto2 to capture the image. The following script will be run at sunrise every morning.
#!/bin/bash

function wakeup {
        echo waking up camera
        #half-press of the shutter button to wake the camera via optoisolator chip connected to shutter release port of camera
        /home/ubuntu/sample/core/gpio_set 7 1
        #hold the button for 500ms
        /bin/sleep .5s
        #release the button
        /home/ubuntu/sample/core/gpio_set 7 0
        #wait for the camera to wake up
        /bin/sleep 2s
}

function takephoto {
        echo taking photo
        /usr/bin/gphoto2 \
        --camera="Canon EOS 5D Mark III" \
        --folder=/store_00010001/DCIM/100EOS5D \
        --capture-image
}


#write images to card
#/usr/bin/gphoto2 --camera="Canon EOS 5D Mark III" --get-config /main/settings/capturetarget
/usr/bin/gphoto2 --camera="Canon EOS 5D Mark III" --set-config /main/settings/capturetarget=1

#loop 90 times and sleep 120 seconds between each photo
x=1
while [ $x -le 90 ]
do
        echo Taking photo $x of 90
        wakeup
        takephoto
        echo Sleeping for 120 seconds
        /bin/sleep 120s
        x=$(( $x + 1 ))
done

#write images to ram
/usr/bin/gphoto2 --camera="Canon EOS 5D Mark III" --set-config /main/settings/capturetarget=0
The output looks like this:
/usr/local/bin/camera.sh
Taking photo 1 of 90
waking up camera
taking photo
New file is in location /store_00010001/DCIM/100EOS5D/3Q1A2080.CR2 on the camera
New file is in location /store_00020001/DCIM/100EOS5D/3Q1A2080.CR2 on the camera
Sleeping for 120 seconds
Taking photo 2 of 90
waking up camera
taking photo
New file is in location /store_00010001/DCIM/100EOS5D/3Q1A2081.CR2 on the camera
New file is in location /store_00020001/DCIM/100EOS5D/3Q1A2081.CR2 on the camera
Sleeping for 120 seconds
Taking photo 3 of 90
waking up camera
taking photo
New file is in location /store_00010001/DCIM/100EOS5D/3Q1A2082.CR2 on the camera
New file is in location /store_00020001/DCIM/100EOS5D/3Q1A2082.CR2 on the camera
Sleeping for 120 seconds
Taking photo 4 of 90
waking up camera
taking photo
New file is in location /store_00010001/DCIM/100EOS5D/3Q1A2083.CR2 on the camera
New file is in location /store_00020001/DCIM/100EOS5D/3Q1A2083.CR2 on the camera
Sleeping for 120 seconds
Taking photo 5 of 90
waking up camera
taking photo
New file is in location /store_00010001/DCIM/100EOS5D/3Q1A2084.CR2 on the camera
New file is in location /store_00020001/DCIM/100EOS5D/3Q1A2084.CR2 on the camera
Sleeping for 120 seconds

Monday, March 25, 2013

How to sync the contents of your old Linux server to your new one

Make sure that both systems are running the same version of the same Linux distribution. Shutdown any processes that are not necessary on both servers(everything but SSH). Then run this command as root on the new server:


rsync root@oldserver.jasongarland.com:/ / -av --exclude '/proc/' --exclude '/etc/hosts' --exclude '/etc/fstab' --exclude '/etc/mtab' --exclude '/etc/network/' --exclude '/dev/' --exclude '/sys/' --exclude '/var/run/utmp' --delete


Note: This will erase anything on the new server that doesn't exist on the old one. Also note that I have only tested this method with Debian and Ubuntu.

Tuesday, February 19, 2013

Laser cut Nixie Tube clock powered by Arduino





http://www.thingiverse.com/thing:52252



I bought all the goodies to make a nice Nixie clock from Taylor Electronics, but I didn't have a nice case for it. It took me about 6 hours to design, cut, and re-cut parts until I had something I was happy with. I disabled the I2C master on the first TES 1361 SmartNixie board and replaced it with an Arduino Nano board connected in the unused RTC connector on the bottom of the backplane board. I poll the GPS RTC board via I2C to get the time and then send command over the I2C bus to the SmartNixie boards to display the digits.





Laser cut parts from 1/8 acrylic (The stuff I bought from Home Depot ended up being 2.2mm thick and not 3.175mm(1/8") so this drawing was designed for 2.2mm, but that isn't hard to change.)


Order these parts from http://www.tayloredge.com/storefront/index.html


1 x 1392 - 6 Digit IN18 Clock Backplane

6 x 1361 - SmartNixie IN18

1 x 1375 - SmartNixie GPS RTC

1 x 1364 - SmartNixie HVPS-H

1 x Active GPS Antenna

1 x Power Plug



I ordered my IN-18 tubes from super-gene on ebay: http://myworld.ebay.com/super-gene/

6 x IN-18 tubes



12V power supply and Arduino Nano can be ordered from Amazon here:

http://www.amazon.com/Wall-Adapter-Power-Supply-12VDC/dp/B006GEPUYA
http://www.amazon.com/Arduino-ARD-NANO30-Nano-v3-0/dp/B003YVL34O



Arduino Sketch: