Posted on

You Like Underwater Selfie?

Adding a programmable switch to MewPro helps us, for example, to take selfies underwater.

No one is eager to drill a hole in underwater housing. But sometimes you might dream if there were an extra switch for customizable functions in GoPro then some great photo/video of something great (or GPOY) could be shot.

In this post, a method to use a reed switch and a magnet with MewPro is addressed. No drilling into housing will be required.

Parts List

  1. MewPro system (GoPro Hero 3+ Black, MewPro, Arduino Pro Mini)
  2. reed switch
  3. magnet
  4. (bits of solder and wires)

reed-switch-and-magnet
⇧ center: reed switch (cost about 2USD), right: neodym magnet (cost less than a dime)

The reed switch will be closed when magnet field is applied. The neodym magnet has strong enough force even from the outside of housing.

Wiring is simple as the following figure:
reed-schematic
⇧ connect D5 and GND pins to either leads of the reed switch

WARNING: Reed switches are very fragile; contacts are sealed in a thin glass envelop. Don’t bend the leads of switch or you will easily destroy/crack the glass.

reed-soldered
⇧ electrical wires are twisted around the straight leads before they are soldered

reed-sw-back
⇧ reed switch w/ a prototype of MewPro in GoPro housing


MewPro Software Mods

In MewPro.ino find the lines

//********************************************************
// f_Switches: One or two mechanical switches
#undef  USE_SWITCHES 

and modify them to

//********************************************************
// f_Switches: One or two mechanical switches
#define USE_SWITCHES

This will enable the part of code in f_Switch.ino:

void switchClosedCommand(int state)
{
  switch (state) {
    case (1 << 0): // SWITCH0_PIN
      if (!ledState) {
        startRecording();
      } else {
        stopRecording();
      }
      break;
    case (1 << 1): // SWITCH1_PIN
      startRecording();
      break;
    default:
      break;
  }
}

The statements in case (1 << 0) are executed when SWITCH0_PIN (= D5 as defined in MewPro.h) becomes the GND level, that is, when the neodym magnet gets near enough to the reed switch. The code above does simple things: start recording in video mode (or release the shutter in still camera mode) at the first time it is called, and at the second time stop recording (or no operation in still mode).

If you change the part of code anything can be accomplished. For example, modifying or adding a line of delay(10000); before startRecording();

void switchClosedCommand(int state)
{
  switch (state) {
    case (1 << 0): // SWITCH0_PIN
      if (!ledState) {
        delay(10000);
        startRecording();
      } else {
        stopRecording();
      }
      break;
    case (1 << 1): // SWITCH1_PIN
      startRecording();
      break;
    default:
      break;
  }
}

enables self timer of 10000 milliseconds (= 10 seconds) in still camera mode. Note this self timer mode is usable also in underwater where Wi-Fi is not available.

Leave a Reply