Adding and controlling a Samsung NX camera with the Pixhawk

It’s been great getting to know about the Pixhawk, its many unique and customizeable features, and especially, flying the quad. Recently, and with thanks to those on this forum who have helped, I’ve added the capability to fly automated missions. Very cool.

Now, my attention proceeds to the next step - using the quad for mapping purposes. Specifically, adding the capability of taking photos. I am not particularly interested in motorized gimbals, FPV capabilities etc. Rather, I am primarily interested in taking good quality photos. I have a Samsung NX camera that I purchased a couple of years ago for experimentation with close range photogrammetry. The Samsung NX has several features that make it well suited for photogrammetric use - 20.5 megapixel, with a large 1’’ BSI format sensor = 116 mm2 sensor size, and Wi-Fi connectivity. The body weight is 158 g, but with the Samsung 9mm fixed lens, it weighs around 240 grams. So, it is fairly heavy. I’m not sure my little quad will be able to fly it for more than a few minutes, if at all.

But, putting that aside, my immediate challenge is to understand how to control the taking of the pictures while the camera is in the air. I understand from reading this link that mission planner can be used to configure the Pixhawk to control the shutter of the camera. I am embarrased to say that I don’t know in this context the differences between a servo and a relay, or which one I would choose.

In general, I’ve discovered that there are many kinds of remote shutter controls available for cameras - including wired and wireless (bluetooth, infrared) varieties. The Samsung NX can also be controlled by a smartphone, via a IEEE 802.11b/g/n wireless network. However, the Samsung NX also contains a micro USB jack that is designed to allow for remote shutter control, and since I am not aware of the Pixhawk having wireless capabilities, I’m guessing that some sort of wired control using this micro USB jack might be the way to go.

I’d very much appreciate some hints or tips on getting this set up.

Thanks,
Al

I’m stuck on this. I’ve looked at the micro-USB jack on the camera, but I don’t have an understanding of how I connect the Pixhawk to this jack, if that is the best way to do this. Any ideas?

I see a video solution for Canon cameras that looks similar to what I imagine might work for the Samsung NX mini. However, this solution involves loading the CHDK to a Canon camera. CHDK is Canon specific (Canon Hacker Development Kit). I’m guessing it is inappropriate or impossible to load CHDK into Samsung camera. Is it even necessary? The Samsung NX mini already allows for remote shutter control. Maybe I don’t need special software?

BigAl-

Can you solder? There’s a way to do this if you’re handy, but you’ll have to cut open a USB cable and solder some pins to another board. The end result is a shutter adapter that connects between the camera and Pixhawk.

I suspected it was similar to my Sony NEX camera and found a link at the end of this post that documents how the USB port trigger works. That author went a little wild with the custom PCB and programming. But he sells them ready-made, and judging by recent comments he’s still in business. You might try that first if shipping from Finland isn’t an issue.

If not, Pololu (USA) makes the device you’d need to adapt the RC signal to the USB cable. It’s the last link in this post.

Don’t forget the 68k ID resistor. Those aren’t too hard to find, but depending where you live it may need to be mail ordered.

Let me know if this works for you. It sounds like a fun “hack”.

Edit:

Looks like the ID resistor isn’t necessary after all.

And just in case you have an NX2000.

James,

Thanks very much for your posts, and sorry for my delay in responding. I independently found much the same as you did. The internet is amazing. I have ordered and recently received a USB shutter switch device, and aim to follow the instructable for triggering the camera. Again, thanks for your help. I’ll let you know how it works out.

Al

I took apart the camera trigger. There are three wires in use between the trigger and the micro USB plug. They are as follows:

Red - GND
Yellow - PLS
White - AF

I need to get a plug which will fit into the Pixhawk, and the question becomes how to wire it. Thanks for the help.

Depending on the exact model of camera, you may need more than just a plug. I think you can test it by doing this.

Take apart the shutter so that you can individually connect the three contacts. What happens when you touch just GND and PLS together? Does it take a photo? On some models, apparently you have to connect AF to GND first, then you can connect PLS to ground. This happens normally by the mechanics of the remote trigger but it’s tougher to simulate electrically.

If it works when you connect GND and PLS, you should be able to connect the wires directly to the Pixhawk as a relay output. If you have to connect AF to GND first, then you’ll need something like the aforementioned remote shutter controller or a custom programmed Arduino or similar microcontroller.

1 Like

Hey James,

I’ve followed your suggestion. When I connect the GND and PLS, yes it takes a photo. If I connect AF to GND then it focuses. They appear to be two independently controlled functions. If I hold AF and GND together (to focus), I can add PLS, and it will take a photo.

I was reading about relays at http://ardupilot.org/copter/docs/common-relay.html#common-relay. It looks like the Pixhawk would produce power at 3.3V. I’m concerned that the power from the Pixhawk might cause some unintended consequence on my camera. I mean, the triggering of the camera is accomplished without requiring any voltage, just continuity between GND and PLS. So, it would seem I do not need voltage. What do you think? I was thinking that maybe this is why a resistor was used with one of the designs you suggested?

Also, do you have any opinion as to whether it is a good thing to invoke auto focus on a mission for mapping purposes?

Thanks for the help.

Al

As I read more about it now, I’m thinking that I might connect the camera to the pixhawk as a servo instead of as a relay. The page which describes servos http://ardupilot.org/copter/docs/common-servo.html#common-servo indicates the following:

The Pixhawk flight controller cannot provide power to the servos so an external BEC or ESC that can provide 5V should be used.

Unlike the relay option, in which the Pixhawk provides 3.3V power, the servo option provides no power from the Pixhawk. I’m thinking that this would avoid possible damage to the camera.

Just not sure exactly what happens when the servo is activated. Continuity between the signal wire and ground?

Triggering the camera actually does involve voltage, but that voltage is supplied by the camera. I’m curious what that voltage is. With the trigger attached to the camera and the camera turned on, what is the voltage between PLS and GND? (do not short the two when measuring) It’s probably either 5V or 3.3V.

It’s good to be mindful about hooking the camera up to strange devices. There’s no difference between the servo and relay options with regards to the “power” provided to the interface, however. The difference is that servos have a continuous signal (a series of pulses) and a relay signals once per event. In the end, you want something like a relay.

Once we know the voltage levels, we can come up wth an appropriate adapter circuit for the camera.

1 Like

Excellent idea. I will test the voltage between the PLS and GND wires, and will report results back to you here. Thanks.

I finally got around to testing the Samsung camera and the voltage between the various wires. It got busy and I wasn’t able to get to it for a while.

I get 3.3v between the PLS wire (+) and GND (-). Same between AF and GND.

I’m ready to take the next step. Thanks for the help.

3.3V is good. It matches the Pixhawk’s native voltage levels so all you need is a cable harness and configuration.

You’ll need a servo plug to attach to your USB shutter. You’ll want to connect GND on the servo plug to GND on the USB shutter. Then connect the plug’s signal line to PLS. For final install you’ll probably want to cut the metal leaves off the shutter and solder everything together but for initial testing you could just hold everything together.

Plug the servo plug into AUX5 port on the Pixhawk, in the standard orientation matching your ESC connections.

Then check the following parameters:

RELAY_PIN = 54 // Pixhawk AUX5
RELAY_DEFAULT = 1 // High on power up
CAM_TRIGG_TYPE = 1 // Relay
CAM_RELAY_ON = 0 // Low to activate
CAM_DURATION = 10 // Hold for a second when taking a photo (you may want to adjust this)

The easiest way to test this is to map a free channel to the camera trigger. Then when you toggle that channel it will activate the shutter. For example, to use channel 8, set the following parameter:

CH8_OPT = 9 // Camera trigger

That should be all. Basically, the relay function in the Pixhawk mimics the voltage resulting on the shutter contacts in the USB trigger.

1 Like

James,

Thank you for taking the time to guide me with this. I very much appreciate it. Seems like all I need is a servo plug and some time to make the connection. Not sure off hand where to get a servo plug, but I’m going to search.

Do you have any opinion as to whether it is appropriate to initiate an auto focus prior to the trigger action?

Thanks!

Al

I’d probably use Amazon or eBay for a servo plug if living in the US. Local hobby shops will have these, too. Most people will buy a servo extension and cut one end off. Some examples below.

Triggering focus will complicate things and probably isn’t necessary. If possible, the best way is probably to set the camera to manual focus and focus to infinity. Almost anything taken from the drone will be far enough away for acceptable focus there.

https://www.amazon.com/DYWISHKEY-30cm-Servo-Cables-Female/dp/B01MXHLF3O/ref=sr_1_4?ie=UTF8&qid=1493168025&sr=8-4&keywords=servo+plug
http://www.ebay.com/itm/10-pcs-12-30CM-300MM-Servo-Connection-Cord-Extension-Lead-Cable-USA-SELLER-/172628512127?hash=item2831760d7f:g:iskAAOSw5cNYfxUh

James,

Thanks again for your help with this. I got a 10 pack of servo plugs from Amazon.

This evening, I spent some time considering camera settings, and how I want it to be set when flying. The manual for the camera is very long, and there is quite a bit of flexibility in the design of the camera, most of which will not be controllable by the Pixhawk. So, I have chosen to take photos in “Smart Mode - Landscape”, which seems most appropriate for aerial photography (still subjects).

I also experimented some more with the auto focus and camera triggering to see how it might be affected by the servo circuit. I have decided to set the camera for a single auto focus before taking a picture. When I connect the PLS and GND wires, I confirmed that the camera focuses on the subject before taking the picture, and thus there is no need to separately control the focusing prior to taking a shot. Also, it doesn’t matter how long I hold the PLS and GND wires together - it will only take one shot whether connected for a small fraction of a second or for several seconds. So, your suggested setting of 1 second should work just fine.

I was reading through a manual related to aerial photogrammetry software that I have, and it suggests that the orientation of the picture (i.e. portrait or landscape) may affect the processing of the photos. Landscape is recommended, and switching between landscape and portrait is not recommended. So, I will have to mount the camera on the drone so that it will take landscape photos in flight.

I’m excited to build the simple circuit you have so kindly explained to me.

I’ll keep you posted.

Al

If you want to do mapping, you probably want to set it to full manual. Manual focus, shutter, aperture. The manual focus will reduce shutter delay and give better GPS correlation. Manual aperture and shutter will give consistent exposure so the images will blend properly.

You almost certainly want to take photos in landscape mode. This is doubly true because you cover a wider swath of ground for better coverage during the flight.

I’d hardly call it a circuit at this point. More of a harness. It’s just connecting four wires together to make a single pair. :slight_smile:

There is an option to set to manual. I like the idea of reducing shutter delay, and giving better GPS correlation. I’m not sure I know enough about aperture and shutter settings at the moment to be able to optimize these settings for aerial use. So, will require some experimentation and reading…