Sunday 13 December 2015

More Sony QX100 nonsense

Over the last week I have finally had a chance to work on adding a second mapping camera to the Solo drone. We went with the Sony as it was lightweight and used by Draganfly as one of their main multirotor cameras. I wasnt 100% sure about the model but after a bit of playing with it, its pretty cool.

Holy crap its light. I ordered a Imp-Concepts accessory bay mounting plate for the solo. When the QX100 is attached to the plate (with a bit of 5mm right angle nylon), the total weight it 250 g! This is well within the extra 300 g payload the vehicle can carry when it has the 3DR gimble attached. As we aren't using this, it means we can still run the gopro as a FPV (first person view) camera for flying.

Total weight of the QX100 + mounting/damping plate.

Python madness! While I have ordered a VP-Systems camcontroller to run the QX100 (takes 3x PWMs in ), I thought It would be a cool idea to see how easy it would be to control the camera with python via wifi. Turns out its pretty sweet, but not 100% sure how to implement it into the solo.

Getting it running via python was pretty easy, I should point out that my development is pretty much now in Linux using python 2.7 (actually I use the fantastic Anaconda python distribution). I found a pre-existing python conversion of the Sony remote API called pysony (props to Yeaji Shin for her work on this awesome bit of code).

I installed using pip, but there is also an pysetup script (in the download) and a github clone available. What was a bit vague was how the code was implemented and how to actually control the camera. My pain is your gain, so here is a brief introduction.

Firstly connect to the QX100 wifi network (will look like DIRECT-XXXX-DSC_QX100), use the password that is found under the battery hatch (see photo below)


Secondly, make sure you have pysony installed and working. You can check using import pysony in a python console. If it doesn't scream at you it is all good.

Try this:

1
2
3
4
import pysony
api = pysony.SonyAPI()
functions = api.getAvailableApiList()
print functions

The print output gives you the full list of what API functions your camera will support (I guess this code will also support any Sony camera that can use the API).

The list of supported API commands from the QX100

Now try this one. It sets the exposure mode to shutter priority with a shutter speed of 1/250 and using a python for loop, takes 10 photos in sequence.

1
2
3
4
5
6
import pysony
api= pysony.SonyAPI()
api.setExposureMode("Shutter")
api.setShutterSpeed("250")
for i in range(0,9);
  api.actTakePicture()

Easy as! As long as the brackets are there and the parameters are correct it will work. The API has recently been updated to include the QX100, so it gives you a few more features. Definitely have a good read through the API documentation for the parameter syntax. The PDF is in the SDK folder and is called "Sony_CameraRemoteAPIbeta_API-Reference_v2.20"

So now I have a lightweight camera on a vibration damping mount that can be triggered by python, I need to get it integrated into the solo. This is the stumbling block, as the Solo wifi network is 10.1.1.1 for the controller and 10.1.1.10. for the drone and the QX100 is 10.0.0.1. As the QX100 is an access point, it needs to be able to connect to the Solo network. That I think is the stumbling block. There was a great post from Jaime Machuca at DIYdrones, where he uses a Intel Edison to "bridge" the data from the solo to the QX. This might be an option. Might be time to splash out a tenner on a new Raspberry Pi Zero!!

An RPi Zero in all its mini-ness. Just needs wifi.



2 comments:

  1. still working on this project? I am also trying to mount it on a Phantom 2 Vision (5.8 GHz transmitter). I found a cheap wifi repeater which dramatically increases the qX100 range (150m or so) Drop me a line(sethmad at gmail dot com)

    ReplyDelete
  2. This has been very helpful. I have been struggling using Python with my QX100 for some time. Thanks to your clear explanation above I have now got pysony working with my QX100.
    Thank you

    p.s. Have you made any further progress?

    ReplyDelete