ASCOM Driver for Sony Cameras

Recently I moved to an area of the country where the night skies are much clearer. I can now actually see celestial objects bigger than the Sun and the Moon!

After purchasing a relatively cheap tracking telescope bundle I discovered that although my friends outwardly appeared to be interested, that didn’t translate to a desire to spend their evening stargazing – especially as temperatures dropped towards, and then below, freezing. So I thought I could at least show them the awesomeness from the comfort of their living room (or, more likely, their cellphone).

The telescope I purchased is advertised as having a camera port. As I am regularly “wowed” when viewing photos taken by amateur astro-photographers I thought I’d take some photos and see what I could accomplish.

Note on “advertised as having a camera port”. This is 100% accurate. Where it falls down is that the additional weight of a camera on the rear of the telescope plays havoc with the auto-guiding/auto-tracking feature. I solved that by using electrical-tape to attach an equivalent weight of AA batteries to the dew-shield on the front of the telescope. I also found that once my camera has been attached to scope, it prevents the scope from pointing high in the sky, as the camera ends up knocking against the mount.

Enter the Sony a6400 camera – it had just been launched, and from all reports it is a pretty kick-ass camera. I bought one, thinking I’d hook it up to this “APT” software I keep seeing.

That’s there things fell off the rails. The APT software has built-in functionality to connect to Nikon and Canon cameras, and via ASCOM it can connect to a number of others… but no Sony support in sight.

A partial solution

The a6400 camera is supported by Sony’s proprietary “Imaging Edge” software, and though that it is possible to get captures longer than 30 seconds. It also supports automated capture, although for undocumented reasons the setup of “number of shots/time between consecutive shots” is separate from the “how long should each shot be” setup.

Using the Remote software in imaging-edge I’ve been able to capture a number of photos that have been “wow” worthy – at least for me.

Sony also have an official Web API for their cameras, although when visiting the site they take great pains to point out that the API is no longer officially supported. Additionally it requires direct connection to the Camera’s WiFi access-point. My a6400 isn’t officially supported, and I was concerned that if I spent any time writing software against this API I might find Sony removes it from a later version of software.

Orion Nebula, taken using Sony a6400. 6 x 4-minute exposures.

The above (cropped) image was taken as 6 x 4-minute exposures using the Imaging Edge Remote software. The image was stacked using Deep Sky Stacker, and level adjusted using Photoshop. The Telescope used was a Willam Optics Redcat 51 with an Optolong L-enHance Light Pollution Filter.

Reverse Engineering

I found a project on GitHub written by someone who wanted a remote trigger that would work for Linux. The code essentially replays captured USB packets that were captured using a packet sniffer.
Note that this code wouldn’t work for me – but it provided a hint that it might be possible to automate the camera without having to rely on the Sony software.

Sony follow a standard, sort-of

After a little snooping of USB traffic, I was able to figure out the basics of communication.

There is a standard written by the Photography and Imaging Manufacturers Association (PIMA) known as PTP (Picture Transfer Protocol) [pdf]. In a very Microsoft-esque manner, Sony have added support in their cameras for the “required” part of the specification, which is essentially what Windows (and other OS’s) can use to download images/etc. (The camera also exposes the data as a USB “Mass Storage Device”). The other functionality of PTP that supports control of the device and capture of images/video/etc has been left out.

The Remote software makes use of some Sony-specific “vendor extensions” to PTP. The extensions mimic some of the official standard features with a Sony flavor.

What I’ve been able to find

My a6400 has something in the order of 63 different knobs (properties) that can be tweaked, pressed or queried.

These include things like:

  • What mode is the camera in (from the Dial on the top). i.e. “Auto”, “M”, “Movie”, etc
  • What are things like Aperture, ISO, Shutter Speed set to
  • What are various settings like White Balance, Shooting Mode, etc set to

Many of the settings can be changed, some via a list of possibilities, others via a simple “up/down” type rocker.

At this point, I’ve not really bothered to spend much time changing settings remotely – though I’ve done enough to confirm it is possible. My main focus (no pun intended) has been to figure out how to push the shutter button and then extract the photo once it is ready.

Alpha software

Beta software is generally “it should work, but we may not have all the wrinkles out of it yet”.

Alpha software isn’t generally at that point yet 🙂 It’s generally “try it at your own risk, we may make some major changes based on feedback”.

What I have on offer is Alpha quality. It was developed on a laptop running Windows 10 connecting specifically to APT.

Update: The driver now includes support (limited testing) for SharpCap and N.I.N.A (32-bit). (Feature availability differs between applications)

It consists of an installer that will install a basic ASCOM camera driver for Sony Cameras. The driver currently supports the following cameras – if you have a Sony Camera not listed here, and it works with the Sony Imaging Edge Remote software, contact me and we can get it added.

CameraSupportedLiveView
Sony a6000YesNo
Sony a6400YesYes
Sony a7YesNo
Sony a7rYesYes
Sony a7sYesYes
Sony a77iiYesYes

Due to the way ASCOM drivers work and the finnicky way Sony allows some settings to be changed, only the following functionality is currently exposed:

  • Live Preview (at 1024×680): This is the same live-preview as the Remote software provides (if supported by your camera). It allows the use of the digital zoom “focus assist” feature of the camera, and responds to changes in ISO/Shutter Speed made on the camera. This worked reasonably well with the Bahtinov mask assist feature in APT. (note that this feature requires APT 3.82 or later)
  • Full Resolution Photos: If the camera is set to BULB mode then APT (or other app) can control the exposure. You should manually set up the camera to the desired settings as no other control is currently available.
  • RGB or RGGB images (for full-res photos): The driver will extract the RAW data from the camera and either return an interpolated RGB image (based on some non-controllable defaults) or it can return an RGGB image which contains the actual un-debayered data from the camera. Note that in this mode it is up to you to debayer the image data. No exposure/gamma/white-balance meta-data is provided thru ASCOM, and the debayering option in APT doesn’t get the colors quite right.
  • (Optional) Save the RAW (ARW/JPEG) file direct from the camera to disk (this includes the most recent preview frame, stored as JPEG)

At the moment I’m working on exposing a simple API that will allow software like APT to support a more direct (i.e. not via ASCOM) connection to the camera, thus allowing some control/knowledge of things like ISO/Shooting-Mode/etc in addition to speeding things up. Once I have something workable I plan on making the code open-source so that others can contribute/enhance/participate.

For more info, please use the Contact page.

3 Comments

  1. Hi,

    I am setting up a second remote observatory out in Arizona in the desert and want to use another Sony A7Sii out there on the scope. I will use Arduinos to control roof rolling on and off and telescope power on and off. They use USB ports.

    Currently telescope control is through the POTH hub so a com port is being shared. How are you communicating with the camera? I wonder if it will interfere with the telescope? If you are basing it on reverse engineering of Imagine Edge which I currently use remotely, then i suspect it WONT.

    In any case I would be happy to test the ASCOM driver with our system that is active here in Connecticut and if it works we will use it in Arizona too.

    Let me know what I need to do man and NICE JOB… We have been also toying with getting into writing an ASCOM driver for the camera… Just not nearly as far along as you and hey, I just want it to work…

    One thing Imaging edge WONT do is support the focus assist. If it does I have no idea how as I have not found it. It is incredibly important for focusing a telescope remotely!

    I broadcast to the world on clear nights. Check it out at SkyTour LiveStream on youtube. We have a few thousand subscribers and building …

    Hope to hear from you soon,
    Marc Dantonio

    1. Doug

      Hi Marc,

      Thanks for reaching out!

      The driver communicates with the camera over a USB connection using the same protocol as the Sony Imaging Edge Remote software (but doesn’t actually use the Sony software in any way).

      Regarding focus assist, it all depends on the camera and the software you’re using. Not all Sony cameras support it :(, and not all astro software can be fooled into working with it.

      From the Sony compatibility chart, it appears the a7s models do support the live-view feature upon which I believe focus-assist is built. I’ve also been able to get APT (and NINA) to display the live-view screen, and that display does react to the zoom/pan controls on the camera. As yet I haven’t experimented with control of those settings over the USB connection – mainly because ASCOM doesn’t really have any way to control those settings.

      I’ll have a poke at it today and see if the camera responds to the commands and update here.

      I see you’ve sent me your contact info, so expect an email with install/config details.

      Thanks again,
      Doug

      1. Doug

        As promised, an update on Focus Assist.

        I did some testing today and was able to come to the following conclusions (at least for my a6400)

        * Sony may make nice hardware, but their camera software is lacking
        * I was able to toggle focus assist, and change zoom levels
        * I should also be able to move the selection box/zoom area

        ASCOM doesn’t support features like Focus Assist, however – we can work around that.

Leave a Reply

Your email address will not be published. Required fields are marked *