NT Camera

From STorM32-BGC Wiki
Revision as of 07:47, 12 August 2019 by OlliW (talk | contribs) (→‎Gitup Git2)
Jump to navigation Jump to search

The information on this page refers to firmware v2.43 and higher.

The NT Camera module allows us to remote control a camera.

It thus serves a similar purpose as the various RC camera remote control modules, such as CAMremote, CamCntrl, IR Remote Shutter Controller, and all the other commercial and DIY solutions. However, instead of listening to e.g. a servo PWM signal, the NT Camera module listens to the data on the NT bus. It is thus usually connected to the NT bus near the camera NT IMU module, which results in extremely clean wiring schemes (see here).

In fact, dedicated NT Camera modules have not yet emerged, but the NT Camera function is integrated into the NT IMU firmware. That is, the NT IMU module itself can be used as NT Camera module (if it exposes the releated pins to the user, which many of the available NT IMU modules do).

In addition, the NT Camera module also serves as a "PWM Out" module. That is, it outputs an additional servo PWM signal, which is an exact mirror of the PWM output signal available on the main STorM32 board when the Pwm Out Control parameter is enabled. This additional PWM signal can come in very handy and enables all sorts of fancy things (e.g. motor zoom).

Historically, the STorM32's remote camera control started with an IR LED controller on the v1.x main STorM32 board, and many of the camera models supported by the STorM32, such as the Sony Nex, are related to this. The NT Camera concept was introduced later, and extended to also provide e.g. PWM output signals or serial UART signals to control cameras such as the Gitup Git2 or Runcam Split. The subsequent introduction of the MAVLink Camera component has brought unprecedented cool camera control features to the user - but also made things substantially more complicated to understand. This article may thus not do well in answering all questions, and the reader is welcome to the rcgroups discussion threads.

Concept and Overview

Parameters

The NT Camera is related to a number of parameters, which are located in various places in the GUI.

In the [GUI:Functions] tab we see:

  • Camera Control: Enables the function and selects the primary input.
  • Camera Control2: Selects a secondary input, which is used by some camera models.
  • Camera Model: Selects the camera model.
  • Camera Setting #1: Function executed then the primary input value is High.
  • Camera Setting #2: Function executed then the primary input value is Low.
  • Time Interval: Setting this to 0 (off) will result in one photo being taken. If set to other than 0 photos will be taken continuously. The time period is from the start of the first photo to the start of the second photo, etc.
  • Camera Port: Allows to change the UART port used for communicating with cameras which use a serial interface.

In the [GUI:Interfaces Tool] dialog, accessible via the [GUI:Experts Only] menu, one finds further relevant parameters, which are associated with the MAVLink Gimbal and MAVLink Camera components:

  • Mavlink Configuration: Enables the MAVLink Gimbal component.
  • Mavlink Com Port: Selects the com port used for the MAVLink communication.
  • Mavlink System ID: Sets the system ID for both the MAVLink Gimbal and Camera components (default = “1”). A value of “0” enables autodetection.
  • Mavlink Component ID: Sets the component ID of the MAVLink Gimbal component (default = “154” = MAV_COMP_ID_GIMBAL).
  • Mavlink Version: Sets the used MAVLink protocol version. Must be set to “Mavlink2” if the MAVLink Camera component is used.
  • Mavlink Camera: Enables the MAVLink Camera component and sets its component ID.

Processing Scheme

The STorM32 camera remote control is based on three elementary camera control operations, SHUTTER, VIDEOON and VIDEOOFF. These are supported by all camera models, and can be triggered by various sources: an input signal, a script, a serial command, a MAVLink message to the MAVLink Gimbal component, or a MAVLink message to the MAVLink Camera component. The NT Camera module translates these elementary commands into the corresponding output signals as required for the specified camera model. The output signals can be PWM, low-high-low pulses, UART Tx and Rx, or whatever is required.

In addition, some camera models (currently the “Runcam Split Mini2” and “GoPro Hero5”) provide a much richer set of features and functions, which the STorM32 makes accessible to the user via the MAVLink Camera Protocol microservice provided by the MAVLink Camera component. This "richer set of features and functions" is in fact most cool and not easily explained in one sentence. It for instance allows the user to access many if not all camera settings from ground control stations such as QGroundControl, like it is known for DJI drones or the 3DR Solo.

Storm32-nt-ntcamera-processing.jpg

NT Camera Support by NT IMU Modules

As mentioned in the introduction, the NT Camera is integrated into the NT IMU firmware. The NT IMU module provides these three signals on its EXT port pins:

  • EXT-3: Camera PWM signal, or Uart Tx
  • EXT-2: Camera pulse signal, or Uart Rx, or special purpose
  • EXT-1: Pwm Out servo PWM signal (with ca. 60 Hz frequency)

The "Pwm Out" signal on pin EXT-1 is related to the Pwm Out Control function and not further discussed here. See Advanced Functions: Pwm Out.

The "Camera" signals on EXT-3 and EXT-2 are related to the Camera Control function, and depend on the Camera Model setting. For most camera models they are configured to output a PWM servo signal on EXT-3 and a pulse signal on EXT-2:

  • The PWM signal can directly feed cameras which can be triggered by such signals, such as the Gitup Git2 or Foxeer Legend, or can be connected to common RC camera remote control modules, such as those mentioned in the introduction. The frequency of the PWM signal is ca. 60 Hz.
  • The pulse signal consists of a 50 ms low/high/low pulse and can be used for all sorts of purposes. For instance, it could be connected to a semiconductor relais to drive an IR LED or shorten some pins on a USB remote.

The EXT-3 and EXT-2 pin can also assume other functions however. For instance, for the Runcam camera they are configured to operate as Tx and Rx UART signals.

The matrix looks as this:

camera model EXT-3 EXT-2
Sony Nex, Canon, Panasonic, Nikon, Git2 Rc PWM pulse
CAMremote Rc PWM PWM2 passthrough
Pwm PWM passthrough PWM2 passthrough
Runcam Generic Tx special purpose
CAMremote UART Tx pulse
Runcam Split Mini2, GoPro Hero5 Tx Rx

Comment: For hardware reasons the NT IMU modules cannot drive IR LEDs, and the IR LED remote control option is thus not available with them.

Pin Assignment on the v1.x and v2.x NT IMU Modules


The "big" v1.x and the v2.x NT IMU modules expose the additional EXT port pins:

Storm32-nt-imu-v10-docu-02.jpg Storm32-nt-imu-v21-docu.jpg

Pin Assignment for the CC3D Atom and Atom Mini


Both the CC3D Atom and Atom Mini have six servo outputs labeled PWM1 to PWM6. They are assigned as follows to the EXT port pins:

  • PWM2 = EXT-1 = Pwm Out servo PWM signal
  • PWM3 = EXT-3 = Camera servo PWM signal
  • PWM4 = EXT-2 = Camera pulse signal
Storm32-nt-imu-cc3datom-docu-03.jpg CC3D Case Label.jpg

Gitup Git2

The Git2 can receive a PWM signal on its Micro HDMI port to control video recording and photo triggering. The details can be found on the Gitup site. In general, a 3 position switch will be used on your transmitter: The middle position shoudl be set to 1500 µs and will do nothing. Low position, < 1250 µs, will start recording video when switched. High position, > 1800 µs, will take a photo when switched. If your transmitter channel is setup as 0%, 50%, 100% (or -100, 0, 100) for Low, Mid, and High you should be fine.

Links:

Cable Information


Gitup does have a Remote Shutter cable available. If you choose to make your own please follow the pinouts for the Micro HDMI (type D), not Mini or full size because they are different (see here).

  • Signal In: Micro HDMI Pin 2 (Usually marked as Utility or Reserved on a pin out)
  • Signal Gnd: Micro HDMI Pin 4 (Marked as TMDS Data2 Shield, or any other shield pin. Even the connector case works)
Git2 Micro HDMI Pinout.jpg

Just as a note, the Git2 uses its Mini USB port for both Video Out and Power In to charge or power the camera. While Gitup also provides this cable the FPV Cable made for the GoPro works as well. At the time of this writing Gitup is working on a combo board / cable, which will contain both the HDMI and USB connectors.

Cable and Camera Function Test


Once you have your cable and transmitter configured as above connect your receiver, or flight controller, and test it out. It should work before moving onto the next section.

Comment: Leave your transmitter as configured for the duration of this instruction. If it passes function test of the above it will work as described below.

CC3D NT IMU, STorM32 and Git2 Camera Integration


Notes:

  • This section will be based on the use of the Mini CC3D Atom and has been tested. Other NT IMU modules with integrated NT camera function should be similar.
  • This is only one example of the many available options from the STorM32.
  • Your STorM32 and NT IMU need to be correctly communicating. Gimbal not necessarily needs to be configured or "tuned".
Control Overview

The STorM32 and NT IMU firmware makes use of two functions found in the [GUI:Functions] tab of the o323BGCTool GUI:

  • Camera Control: We will use this.
  • Pwm Out Control: Future / other use.
Wiring
  • Connect your receiver, or flight controller, to one of the seven STorM32 RC ports (RC-0 through RC2-3), or any other input channel (see Inputs and Functions).
o323BGCTool GUI Setup

Under the [GUI:Functions] tab use the column for Camera Control and set as follows:

  • Camera Control = “Rc-0” (Or whatever port you connect up to the STorM32 above)
  • Camera Model = “Git2RC”
  • Camera Setting #1 = “shutter”
  • Camera Setting #2 = “video on/off”
  • Time Interval: Setting this to 0 (off) will result in one photo taken when switched from Mid to High. If set to other than 0 continuous photos will be taken. The time period is from the start of the first photo to the start of the second photo, etc.

Foxeer Legend 1

This should work as for the Gitup Git2, with identical settings. This has not yet been tested though.

CAMremote

The CAMremote from VP-Systems is a highly functional and versatile camera remote controller. The STorM32 supports it by two camera models, “CAMremote Rc” and “CAMremote UART”.

CAMremote RC

The CAMremote provides several settings where the shutter and video on/off can be controlled via a PWM signal on the CAMremote's CH0 input. In combination with the NT Camera module several configurations are possible, the most generic one would be to use either of these:

  • CH0 = Record/AF/Shoot
  • CH0 = Record/Shoot

The EXT-3 pin on the NT IMU module should then be connected to the CH0 input on the CAMremote.

The PWM2 passthrough output on the NT IMU module, or pin EXT-2, can then be connected to the CAMremote's CH1 to invoke additional features, such a manual focus, zoom in/out, and so on.

Comment: This has been tested using NT IMU firmware v0.28 and "RC receiver (CH0=Record/AF/Shoot, CH1=SmoothZoom, CH2=Alt)-mode" on CAMremote 3.0.9. In case the shutter does not trigger a photo on the camera it might be necessary to increase the focus time to give the camera time to focus.

The disadvantage of using the CAMremote with PWM input signals is that one only can toggle between VIDEOON and VIDEOOFF, and not directly set VIDEOON or VIDEOOFF, so that the actual recording state might be lost by the user.

CAMremote UART

The CAMremote also provides a serial UART interface, which provides access to a much richer set of features and functions than with the control via PWM signals.

The EXT-3 and EXT-2 pins on the NT IMU module should be connected to the Tx/Rx inputs on the CAMremote, respectively.

Currently, the STorM32 supports the 'shoot', 'recon' and 'recoff' commands.

This brings the great advantage that VIDEOON and VIDEOOFF are now set directly, and not only toggled as with the PWM input, so that the actual recording state is always known to the user.

Links

RunCam

The NT Camera can control a RunCam Split Mini2 by communicating to it via the cameras serial port. It probably works for all similar RunCam cameras too, but this is untested.

Set these parameters in the [GUI:Functions] tab:

  • Camera Model = “Runcam Generic” or “Runcam Split Mini2”
  • Camera Port = “default”

If you also want the MAVLink Camera features, then in addition set these parameters in the [GUI:Interfaces] menu:

  • Mavlink System ID: usually can be “0”
  • Mavlink Version = “Mavlink2”
  • Mavlink Camera = “Camera1”
Storm32-nt-ntcamera-runcamsplitmini2.jpg

GoPro Hero5

The NT Camera can control a GoPro Hero5 by communicating to it via Wifi (it probably works for all similar GoPro cameras too, but this is untested).

This thus requires an additional Wifi module, such as the ESP8266, Arduino MKR1000, or ESP32. The MKR1000 is however quite pricey and very large, I currently use a ESP32. The Wifi module needs to be loaded with a particular firmware; the Arduino sketch and C files are open source and available in my github repo (link see below)(currently only the ESP32 is supported, but you are of course welcome to adapt it to e.g. the ESP8266).

If you want to know more details about the technical inside, you may read this post. The Arduino sketche and C files (and other relevant material) are open source (GLP-v3): https://github.com/olliw42/goprohero.

WARNING: Both Wifi and most radio control systems work in the 2.4 GHz range, and interferences may thus happen and compromise your remote control signal quality. Unfortunately I could not find any competent report or analysis on the web; all reports which I could find say it works based on purely anecdotal evidence. So, please, be alerted! In order to avoid issues as much as possible I have at least ensured to set the Wifi's module transmit power to the lowest possible level.

The Wifi module (loaded with the Arduino sketch) is connected via its serial port to the NT Camera module, e.g. the EXT-3 and EXT-2 pins on your NT IMU module (see NT Camera Support by NT IMU Modules). Alternatively, the Wifi module can be connected to the UART or UART2 ports on the main STorM32 controller, which often can be the most convenient setup, as it much simplifies wiring.

Comment: Wifi modules generally need to be powered from a strong, stable power source, since current draw can be high (not on average, but in the spikes). So, do not use the NT bus 5 V powerline, unless you have ensured that it is of sufficient high power.

Set these parameters in the [GUI:Functions] tab:

  • Camera Model = “GoPro Hero5”
  • Camera Port: Set it to “default” if the Wifi module is connected to the NT Imu, otherwise chose the UART or UART2 port.

If you also want the MAVLink Camera features, then in addition set these parameters in the [GUI:Interfaces] menu:

  • Mavlink System ID: usually can be “0”
  • Mavlink Version = “Mavlink2”
  • Mavlink Camera = “Camera1”

Huzzah32-EPS32 Breakout Board

The connection diagram for a NT Imu v2.x and an Adafruit HUZZAH32–ESP32 Breakout Board can look as this:

Storm32-nt-ntcamera-huzzah-esp32.jpg

Comment: The HUZZAH32–ESP32 breakout board was the best option I found price and size wise. It's a cute board, with however a nasty flaw: see [here], where also solutions are provided.