Martin Foot

Controlling a Sony Alpha SLR Remote Release With a Microprocessor

I wanted to control my old Sony Alpha SLR with an Atmel AVR. It turns out it’s very easy to do.

I repurposed a cheap Alpha remote trigger cable from amazon.co.uk (about £3) for this, but you can also make your own connector. See this instructable by Brad Justinen that shows how to mimic the Alpha remote release connector using a 4 pin internal CD-ROM drive audio connector.

"Sony Alpha Shutter Release Cable"

Other parts required:

  • An optoisolator or relay (relays are more difficult to use)
  • 3 single line header pins
  • Some solderboard
  • A soldering iron and solder
  • A drill
  • A cable tie or some glue
  • A saw

Step 1: Remove the casing around the trigger button

I used a junior hacksaw to chop off the bottom end completely. After doing this you should see three wires. The mechanism simply connects two of them together to focus and then the third to take the photo.

Once the bottom is off, you should be able to use some side cutters to chop off the three wires or de-solder them.

"Step 1"

Step 2: Remove the casing around the cable

I used the junior hacksaw again to chop carefully around the end with the cable. The aim is to keep the rubber cable tensioner as part of the cable, not to chop the cable off.

After doing that, you should have something that looks like this:

"Step 2"

Step 3: Make the breakout board

I drilled a hole in the solderboard big enough to fit the camera cable, then two smaller holes either side. I fed the cable through and used a cable tie to hold it in place. This allows there to be some tension and tugging without the solder connection breaking. I then soldered each of the three cables into the board and a single row of three headers to connect to a breadboard for prototyping.

"Step 3"

Step 4: Wire up the optoisolator

Using an optoisolator means that you can’t accidentally send any current through the camera’s remote release trigger port. It’s likely to be protected but there’s still the chance that it could be damaged if this happened.

The single optoisolator DIL package has four pins. I connected the input side from one of the AVR’s digital out pins to ground, and to the output side I attached the white and yellow cables (focus) to one pin, and the red cable (shutter) to the other. Simply by putting this pin to the HIGH state in the microprocessor I can take a photo with the SLR. Note that you may need a resistor here depending on the optoisolator and the amount of current your chip can drive.

My use case is for time-lapse photography, which is why I wired the two focus pins together. I will set my camera up manually, set to manual focus, then connect the cable. As the camera is in manual focus mode, having the two focus pins connected does nothing.

Setting Up a Personal Wiki With AWS and Gollum

This post explains how to get a personal wiki using Gollum running on Amazon Web Services (EC2) on a micro instance with the free usage tier.

For a long time I’ve been using TiddlyWiki as a personal wiki for note taking. I used DropBox to sync the wiki html file between machines. I have wanted to upgrade this for a while for a system that has proper versioning and better syntax highlighting. I’ve also wanted to test out using AWS as I think it will be a useful experience for the future.

Step 1 - Get a domain name.

Any domain name will do. I recently learned about Internationalised Domain Names, which are URLs that contain language-specific Unicode characters. Browsers interpret the Unicode characters in a system called Punycode, which encodes the Unicode characters into a restricted ASCII character set, allowing DNS entries for IDN sites in the ASCII character set.

For instance, hover your mouse over the following URL in a modern browser and you will see a domain beginning with xn--: ☁→❄→☃→☀→☺→☂→☹→✝.ws

I had a browse through a Unicode character table, found a glyph that I liked (it looks like a skull with a monocle), then found the punycode URL for the character, then registered it with NameCheap. Despite the name, the customer support was very good.

I now had the URL http://%E0%AF%90.com.

Step 2 - Set up an Amazon Micro Instance

I signed up for the free usage tier of AWS, started up a micro instance, assigned an elastic IP to the instance, then pointed the DNS A record to that IP using NameCheap’s DNS server.

I used all of the default settings, and the micro instance image is the Ubuntu 13.04 server image. The next step was to install all required dependencies and Gollum itself:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install vim build-essential ruby ruby-dev libxslt1-dev git-core libxml2-dev
sudo gem install redcarpet gollum

The Gollum wiki has a list of other gems that you might find useful for different types of language markup and syntax highlighting. After the dependencies had been installed, I opened up TCP port 4567 on the web server security group, and created the wiki itself:

mkdir wiki
cd wiki
git init .

I added a file at config.ru to enable HTTP Basic Auth on the Rack application, based on the file I found here.

require 'rubygems'
require 'gollum/app'

use Rack::Auth::Basic, "Restricted Area" do |username, password|
   [username, password] == ['user', 'password']
end

gollum_path = File.expand_path(File.dirname(__FILE__))
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:wiki_options, {})
run Precious::App

I could then see the server running with HTTP basic auth (see more authentication options for Rack::Auth here) on port 4567, after running the following:

rackup -p 4567 config.ru

Hitting <Control+Z>, then running the following will let you log out of the session and the server will continue to run.

bg
disown

You can install an Upstart script to have Upstart manage your Gollum process. A quick Google found one that looks like it will do the trick here.

Note: This git repository has no remote, so this is your only copy. I suggest using an EBS volume to store your git repo, or for instance a nightly Cron job that pushes to another server.

The Immortal Cell Line of Henrietta Lacks

Henrietta Lacks was a poor tobacco farmer from Virginia who was diagnosed with and subsequently died of cervical cancer in 1951. During radiation treatment for her cancer at the John Hopkins Hospital - one of the few hospitals at the time to treat African American patients - a small part of the tumour was cut off and sent away for testing without her permission (permission was not required at the time). Soon after it was discovered that given the right conditions, the cancerous cells would grow and divide outside the body. Previous attempts at cultivating human cells all resulted in the cells dying after a few cell divisions. A scientist named George Gey began a cell line from the extracted tumour cells that was the first immortal cell line ever produced, and was known simply as HeLa. The cells have been used by scientists ever since due to their ease of use in testing, and were involved in experiments that have revolutionised modern medicine, including cloning, genetic mapping, and the development of the polio vaccine.

Rebecca Skloot, author of the book The Immortal Life of Henrietta Lacks, recently published an article in the New York Times after a team of European scientists published the genome sequence of the HeLa cells without the consent of the Lacks family.

The story of the HeLa cell line is a fascinating one, and I remember that the virology podcast This Week In Virology had an episode a while back where they interviewed Philip Marcus, who was the first person to clone HeLa cells. The episode and interview are embedded below, and are well worth a listen.

As well as the links included above, Skloot’s post prompted some interesting discussion on ethics and privacy of the genome which makes for interesting reading. I would recommend taking a look at the posts below:

The Tutor Crowd Corrects Graffiti Typos in Guerrilla Marketing Scheme in London

This news from one-on-one online English language tutor/student matchmaking company The Tutor Crowd is most welcome after somebody recently tagged a bus shelter that I have to walk past every day with the the following:

["Bomb th'A SISTEM" - South London youths at their finest]

The company have begun correcting spelling and grammar in graffiti tags around London, sticking up small sticker adverts for website. They have even created a Tumblr blog showcasing some of the mistakes people have been making. Some of the examples are pretty funny:

As somebody who is fascinated by the graffiti and street art scene in London, what I find most interesting is that in many cases you can see they have tried to be non-destructive with the edits. It looks like they’re using some clear circular stickers to stick over the errors and are writing their corrections on them. This means that even if people don’t like the ads covering their masterpieces, they can still tear them off with no irreparable damage. Smart.

Via The Verge.

Light Painting Workshop With the Trampery

Yesterday I attended a light painting workshop that was hosted by The Trampery. I had been wanting to get a chance to use my DIY light stick in anger and so I spoke to the Trampery team and we organised a small light painting workshop for residents at their amazing shared working offices in Shoreditch. The turn-up wasn’t as high as I was expecting but we had a great deal of fun, and a smallish group meant that everybody could participate to the full. Below I’ve included a few of the images that we made:

Light Painting With the Raspberry Pi

I recently came across some images from Flickr user TxPilot, who has created a light painting wand controlled by an Arduino and has used it to create some stunning photos such as the one below.

This seemed like a brilliant idea, so I set about making my own. I used a Raspberry Pi rather than an Arduino as prototyping was faster and easier, and it allows me to do a bunch of things that the Arduino would not. The basic idea is that you provide an image file and the light stick will show that image file column by column. If you mount your camera on a tripod and hold the shutter open while moving the light stick along, it reproduces the image in a light trail. The images below show an example input file, and the kind of thing you can produce with it:

Source image:

A simple gradient fill of rainbow colours

Results:

Light stick example

Light stick example

The Pi is using a cheap USB wifi dongle and runs a DHCP a server. When it boots, it sets up an ad-hoc wireless network and boots a small Python web application that provides a control interface to the light wand. This allows anybody with a computer or smartphone to connect to the network, upload an image to the Pi, and control the playback of that image on the light stick. The whole thing runs from a portable battery that’s designed for charging your devices while you’re away from a plug for a long time.

Technical Information

A screenshot of the web app from an Android device

The Raspberry Pi runs a small Python application written using the web.py framework. It uses Twitter Bootstrap for style, layout, and responsive design, and the RPi.GPIO Python module for communicating with the lights. The source code for the Python application can be found here. The lights themselves consist of a flexible strip of 32 individually addressable RGB LEDs.

The Pi communicates using the GPIO pins via SPI to the LED strip, but the RPi outputs 3.3v on these pins. I didn’t have any transistors to hand so I used couple of NOT gates in a 7404 hex inverter chip to bump the logic level to 5v. I don’t need to read from the strip, the 3.3v is higher than the switching voltage for the hex inverter, and the GPIO frequency is pretty low so the 7404 was fine for the job.

You can see an image of the web interface on the right. It is very simple, and consists of a few buttons that control the state of the application (these are shown and hidden at the appropriate times to stop you pressing the wrong thing), a file upload form and a gallery of existing uploaded images. Clicking an image in the gallery will start playing it.

Parts List and Cost Breakdown

The list of parts can be found below (shipping not included):

I also spent about £6 at a local DIY store for a 1m section of ¾” clear PVC pipe and 1m of stiff plastic pipe thing that stops it from bending. I used these to construct a clear backbone+shell for the flexible light strip that is entirely waterproof. Total cost comes to about £100 incl. postage. Add a little more if you need prototyping boards and components. The Raspberry Pi GPIO breakout kit is a good choice for connecting the Pi to a breadboard.

Note: The Anker USB power supply is a good choice because it has both a 1A and a 2A output, both rated at 5v. They market this because it can charge your devices faster, but at ~20 mA per LED for a 1m 32-LED strip + ~500mA for the RPi + the wifi dongle, the 2A connection is necessary for this build.

Light Painting With London Photographic Meetup Group

I recently had the chance to go to a light painting workshop that was hosted by the London Photographic Meetup Group. They have constructed their own tools and take groups of around 10 people to come and do some light painting.

While cold, it was surprisingly fun. There’s no real requirement except a tripod, but a cable shutter release helps. There’s no required knowledge either, so anybody can come and enjoy themselves.

Here are some examples of the kinds of things they can do:

blue swirly light thing

green swirly light thing

blue swirly light thing with person

man walking dog

Introduction to Genetics and Evolution

One of the things that I wanted to do in 2012 was to learn more about genetics and the process of evolution. I never had much of an interest in biology until I took a course by (Dr Klaus-Peter Zauner) at university on how engineering principles can be applied to, and indeed derived from, biological processes. Fascinated by the fact that we’re ever closer to understanding the systems and pathways that control growth and interactions within the body, and the knowledge that we are already able to design systems to perform tasks for us, I now see biology as one of the ultimate goals for engineering. I would highly recommend anybody who has a computer science or engineering degree/background to read into this. As a software engineer I’m constantly learning new things. There’s always something interesting to read or learn about… but it’s usually not an entirely new frontier. Biological computation is just that.

In the interests of learning, I recently completed a 10 week free online course called the Introduction to Genetics and Evolution by Professor Mohamed Noor and his assistants at Duke University in North Carolina. It equated to 1–2 hours a week so was not too much of a commitment, but was a lot of fun. The course is running again shortly and I would thoroughly recommend it to anybody willing to learn.

Here’s an example of a species we studied called the Lampsilis Mussel when studying camouflage and the extend that evolution can be observed in the wild. Just a fascinating taster of some of the course material!