Dual cable (serial + USB) for Nikon coolpixes

As you probably know, Nikon Coolpix cameras can be controlled by software. At least, those that support the Nikon MC-EU1 remote shutter can be controlled through a computer using Gregory Pruden's TheForce, Vladimir Vyskocil's CoolCom or Aristarco's krinnicam. These programs require a serial cable (SC-EW3 Nikon part) to work, because MC-EU1 mode is serial.

On the other hand, some Coolpixes (the most recent ones; since 995) have also USB mass storage interfaces in order to download images. When you plug your USB cable (UC-E1 Nikon part), you can open Windows Explorer and transfer your images from the camera which appears as a removable drive. Since in USB mode we cannot control the camera using the serial MC-EU1 emulation (*), why not to build a sort of "switch" capable of selecting USB or serial mode as we desire?

(*) If you only have a UC-EU1 cable (USB), which is supplied with the camera, you cannot use MC-EU1 emulation. But is still possible to control the camera via a computer (with some limitations) with the UC-E1, try Aristarco's krinnicam software.

By using some simple parts I have built a dual cable with this sort of switching capability. The dual cable has on one end the camera connector (which is a proprietary design, you will not find it in electronic parts shops) and a USB type A male and a DB9 female connectors on the other end. So it is a sort of mix between a UC-EU1 (USB) and a SC-EW3 (serial) Nikon cables. In addition, it includes an electronic circuit that switches on and off the USB and serial segments, as driven by the DTR serial port signal. By the time of writing, the only software publicly available and capable of controlling the coolpix and automatically downloading the captured images by using this dual cable is krinnicam.

In the following paragraphs, we will show differents approaches (pros and cons) to build the switching circuit, you can select your preferred one. Then, we comment some points about the building of the cable itself.

Dual cable switching circuit: UC-E1 and SC-EW3 (un)plugging emulation circuit

This first design step is the most natural one, taking into account that our cameras can be damaged if we don't take precautions: the switching circuit should emulate the unplugging of a segment and the plugging of the other segment, when the computer instructs it to change the current mode.

Let's have a look at the USB, serial and camera connectors, figure 1.

dual connectors
Figure 1. USB, serial and camera connectors.

The first thing to note is that the camera connector has 8 pins, one half are for the USB cable, and the other half are for the serial cable. There is no pin shared between USB and serial. How the camera knows which cable (USB or serial) is being used? The answer is through the USB-detect and Serial-detect pins:

  • USB-detect connected to +5V (from USB type A connector) => USB mode
  • Serial-detect connected to GND (from serial connector) => serial mode

What if those conditions are met simultaneously? It may be model-dependent, but Jean Beaumier found that the USB mode has more priority that the serial mode in a coolpix 995 (we will use this later to simplify the switching circuit for a 995.) So, if you have another model and don't want to risk testing which has more priority by your own, the switching circuit should guarantee that these conditions are not met simultaneously.

Another thing we should take into account is related to grounding. Are USB and serial port grounds (GND) interconnected inside the computer? Can we assume they are the same electrical node? If we are not sure, we should not connect these grounds together. But, and the camera? Are USB-GND and Serial-GND the same electrical node inside the camera? Probably. In particular, if USB and serial port grounds are isolated into the computer and, at the same time, USB-GND and Serial-GND are connected inside the camera, we can face some problems. To avoid all those grounding problems, our circuit should guarantee that USB and serial ground will never be interconnected.

The switching circuit, as stated before, is driven by the DTR serial port signal as follows:

  • When DTR is positive, typically around +10V, the dual cable is in serial mode
  • When DTR is negative, typically around -10V, the dual cable is in USB mode

Jean Beaumier suggested this serial port signal and this behaviour for the dual cable after testing PhotoPC and TheForce under several Windows versions, assuring that while Photopc/TheForce is running, the cable is in serial mode, and when it finishes, the cable switches to USB mode. In other words, this behaviour has been selected to be compatible with PhotoPC and TheForce (TheDarkSide), so one can write scripts to automate shutting and downloading.

Taking into account all these points mentioned above, we designed the circuit depicted on figure 2.

dual connectors
Figure 2. switching circuit based on a electromechanical relay (click to see the full version).

To assure that USB and serial segments are electrically isolated, we used an optocoupler (U1). The LED section of U1 is driven directly by DTR, so we should select a very sensitive optocoupler to prevent too much current flow from DTR (which is usually very limited, implementation-dependent; around 3 mA max. if we don't want to push the serial port to its limits). D1 protects the LED when DTR is negative. The NPN transistor section of U1 drives a PNP transistor which in turn operates a electromechanical relay. This relay has three associated contacts: two normally open and one normally closed. This is a weird configuration for a commercial relay, so you will have to use two relays working in parallel instead. When the relay is idle, USB-detect and USB-GND are disconnected, while Serial-detect and Serial-GND are connected to the computer serial port ground, so the dual cable is in serial mode. When the relay is activated, USB-detect is connected to +5V and USB-GND is connected to the computer USB port ground, so the cable is in USB mode.

Condition
U1 (LED)
U1 (NPN)
Q1
Relay
Mode
USB end plugged, Serial end plugged (DTR positive)
ON
ON
OFF
OFF
Serial
USB end plugged, Serial end plugged (DTR negative)
OFF
OFF
ON
ON
USB
USB end plugged, Serial end unplugged
OFF
OFF
ON
ON
USB
USB end unplugged, Serial en plugged (DTR don't care)
don't care
OFF
OFF
OFF
Serial

The table also reveals that if one end (USB or serial) is not plugged, automatically the correct mode is selected.

Dual cable switching circuit: simplifying the relay-based circuit

Using a multimeter, we measured the resistance between the USB and serial port grounds in my computer, and it turns out to be extremely low (under 0.1 ohm), so we assumed that they are connected together inside the computer, as one can expect because they are likely to share the computer power supply. The resistance between USB-GND and Serial-GND on the camera is also very low. If we consider all these grounds as the same electrical node (as it is deduced from these tests), the relay-based circuit can be simplified to the one depicted in figure 3.

dual relay (2)
Figure 3. Switching circuit based on a electromechanical relay, simplified (click to see the full version).

This circuit behaves the same as the previous one, but it is completely different. Now the relay is powered by a PNP transistor (Q1, for example, a BC556) which is on when DTR is negative or not connected. If DTR is positive or the USB plug is not connected (and hence there is no +5V power in the circuit), Q1 and the relay are off. With R1 set to 10K and R2 to 22K, DTR current is small. D1 can be a 1N4148.

Condition
Q1
Relay
Mode
USB end plugged, Serial end plugged (DTR positive)
OFF
OFF
Serial
USB end plugged, Serial end plugged (DTR negative)
ON
ON
USB
USB end plugged, Serial end unplugged
ON
ON
USB
USB end unplugged, Serial en plugged (DTR don't care)
OFF
OFF
Serial

Here, if one end (USB or serial) is not plugged, automatically the correct mode is selected, just like the previous circuit.

Dual cable switching circuit: solid state switching

On a 995 (presumably the following is also applicable to other models, but not tested), USB-detect and Serial-detect can be activated (+5V and 0V, respectively) simultaneously. In that condition, the camera will be in USB mode. So if we just leave Serial-detect activated (0V) and switch on and off USB-detect (+5V and 0V, respectively), we effectively are able to change the mode using only one signal. What is more, this +5V/0V switching can be done using solid-state components.

The solid-state switching circuit that we designed is depicted on figure 4. Parts pinouts are shown on figure 5. This is the circuit I have built for my dual cable.

dual simple
Figure 4. Solid-state-based switching circuit (click to see the full version).

dual simple parts
Figure 5. Solid-state-based switching circuit - Parts pinouts.

This circuit uses a common optocoupler (U1, 4N35 or equivalent, see pinout in figure 5) to output +5V or 0V to the USB-detect line. This optocoupler isolates USB-detect from any damage that the rest of the components could suffer. The LED section of U1 is driven by a simple, general-purpose PNP transistor (Q1, BC556, see pinout in figure 5), and current-limited by R2 (390ohm). DTR serial port signal is applied to Q1 base through R1 (100Kohm), so DTR current is very low (around 0.15 mA max.). The following table summarizes the different operation conditions.

Condition
Q1
U1 (LED)
U1 (NPN)
Mode
USB end plugged, Serial end plugged (DTR positive)
OFF
OFF
OFF
Serial
USB end plugged, Serial end plugged (DTR negative)
ON
ON
ON
USB
USB end plugged, Serial end unplugged
OFF
OFF
OFF
Serial
USB end unplugged, Serial en plugged (DTR don't care)
OFF
OFF
OFF
Serial

The grayed-out row represents a non-useful condition. In this case, the dual cable cannot be used with only the USB end plugged.

Note the presence of D1 (1N4148) in the schematic: this diode protects the LED section of U1 when DTR is negative (around -10V) and +5V power is not being applied. In that conditions, Q1 base-collector junction and D1 are directly polarized, so D1 voltage drop (Va-k) will be around 0.5V, a value below the maximum reverse voltage which U1 LED can stand.

Of course, different solid-state designs can be made. For example, figure 6 depicts a more ellaborated solid-state switching circuit based on a CMOS analog switch IC (U2, 4066). This is, approximately, the approach followed by Jean Beaumier to design its "coolswitcher". This circuit, like the relay-based ones, automatically selects the appropriate mode if one end (USB or serial) is unplugged.

dual cmos
Figure 6. CMOS analog switch-based switching circuit (click to see the full version).

Here an optocoupler (U1) is used to isolate the CMOS switch from DTR:

  • when +5V power is not being applied to the circuit (i.e., the USB end is unplugged), U2 control inputs should not be driven (perhaps newer CMOS analog switch ICs don't complain with such a situation, but 4066 cannot be used that way);
  • if DTR were not isolated from U2, a component failure could potentially put a +/-10V voltage on the control input of U1, which is powered by +5V. This situation would violate U2 maximum absolute ratings, and worst, this sort of "overvoltage" may reach USB-detect.

Note that DTR is directly driving the LED section of U1. To prevent too much current on DTR, a sensitive optocoupler should be used. An alternative would be using a common optocoupler (such as 4N35 or equivalent, LED nominal current equal to 10mA) driven by a transistor; DTR would be connected to the base of this transistor, through a limiting resistor.

Building the dual cable

The electronic parts for the switching circuit are not hard to find. I used a little piece of uniprint circuit board to mount the components an make the connections. Building the circuit is probably the simplest task in the development of the cable. I used a spare 35mm-film plastic can to house the circuit (this is the future of film photography? Hope not!) as shown in figure 7.

dualcable detail
Figure 7. Switching circuit and its protective can.

I purchased a inexpensive, common USB cable (type A male-type B male) and cut the type B end, then I got the USB segment. I also purchased a DB9 female connector and 1 meter of cable (4 stranded wires plus shield) to build the serial segment. Then I soldered these segments to the switching circuit.

The hard task is the camera end. You need to get a connector for the camera. But you simply cannot go to the electronic parts shop and order it. It is a proprietary design. The only way to go is to purchase a UC-E1 or SC-EW3 Nikon cable (or just kill the UC-E1 supplied with the camera) and recover the camera connector from it. How to do that? Follow d.holmes instructions. Basically, you should use a precision cutter to -very carefully- eliminate the injected-plastic cover of the connector as shown on figures 8, 9, 10, 11 and 12.

connector
Figure 8. The camera connector.

cutting the connector
Figure 9. Cutting the camera connector.

connector opened
Figure 10. The camera connector, without its protective plastic cap.

peeling the connector
Figure 11. "Peeling" the camera connector using a precision cutter.

connector peeled
Figure 12. The camera connector, naked.

Once the contacts are visible, you can solder a 8-wire plus shield cable end to it, and the other end to the switching circuit. You may optionally use 8-pin miniDIN connectors as d.holmes did (or use two 4-pin miniDIN connectors if you find the 8-pin one very dense), between the camera connector and the switching circuit. This would enable you to build different segments (USB only, serial only, dual) that can be connected to the camera segment, using a standard connector.

Jean suggested that if one creates the dual cable from a UC-E1 cable, there is no need to "peel" the USB contacts of the camera connector. And what is more, there is also no need to solder the wires, they're already solded, just reuse a segment of the UC-E1 cable to connect the camera to the switching circuit. Only the serial contacts have to be soldered, to another segment of cable. So we would get two segments from the camera connector to the switching circuit, with minimum manipulation of the connector. Note that if one creates the dual cable from a SC-EW3 cable, the same idea can be applied.

Nevertheless, I couldn't be able to leave the already soldered wires intact. I cut one of them, and I ended up "peeling" the whole connector. Instead of using a 8-wire plus shield cable, I reused a segment of the SC-EW3 cable (which was the one I have spared to try the dual cable) and a segment of the USB cable (type A male-type B male) to make the connections between the camera and the switching circuit.

Once we have decided which kind of cables we are going to use, and have the connector "peeled", we are ready to solder. Do this very carefully or you will end up with the connector melted down. Jean suggested applying a little tin drop to both the connector contacts and the cable ends, and then solder them quickly. This worked very well for me (thank you, Jean). The results can be seen on figures 13 and 14.

soldered connector
Figure 13. Connector after soldering, USB side.

soldered connector (other view) ?>
Figure 14. Connector after soldering, serial side.

The dual cable, and details from the connector (protected with a plastic cap), is depicted on figure 15.

finished cable
Figure 15. The dual cable.

finished connector
Figure 16. The camera connector, finished.

Frequently Asked Questions (FAQ)

Q. Can I control my camera without building a special cable+circuit, and still download images to the PC (withouth changing cables)?
A. Yes, you can, try krinnicam. It features coolpix remote shutter control and downloading, everything through the USB cable supplied with the camera (UC-E1).

Q. I see differents circuits here but, which one should I build?
A. If you own a coolpix 995, you can build any of the solid-state circuits (figure 4, figure 6, Jean Beaumier's coolswitcher). Otherwise, you can build the simplified, relay-based (figure 3), or, if you are brave enough, you can try one for the 995.

Q. I built the dual cable following your instructions. Now, how can I control it?
A. You can use krinnicam (GUI/scripting), or write your own scripts using PhotoPC and TheDarkSide.

License

This electronic schematics are provided "AS-IS", with NO WARRANTY. The author is not responsible of any personal or material damage that could happen as a result of its use.

Acknowledgements

Dual cable development has been done in cooperation with Jean Beaumier who designed its own version of the cable and control box ("coolswitcher"). Without him I probably would not have returned to the dual cable and krinnicam projects. Thanks, Jean!

We based our work in the description of the UC-E1 and SC-EW3 cables by D. Holmes and Didier Cadiou. Thanks!

1 Comment