Created by Breandan P O'Shaughnessy
Status: Active

Android App and Firmware Step 7 of 7

My android app takes care of all the hard work of creating a mobile device interface for this sketch.  To begin you need to download the free version of Toothfairy here, or if you like it you can download the paid version for a dollar.  You will now need to download the arduino library here.

Install the arduino library the normal way, by unzipping, and copying to the libraries folder of your arduino install.

You will now need the sketch for the intervalometer.  Copy this source code into your arduino environment in a new sketch.  You will want to unplug the HC-06 module from the breadboard when you are uploading, since it interferes with the use of the serial port.

#include <BlueDentist.h>

#define AFinterval 10000
#define AFPin 11
#define shutterPin 12
#define baudRate 9600

unsigned long lastAFMillis = 0;
unsigned long lastShutterMillis = 0;
long timer = 0;

BlueDentist *myBD;
BDNumField *interval;
BDBTN *shutter;

void snapPhoto()
  digitalWrite(shutterPin, HIGH);
void runAF()
  digitalWrite(AFPin, HIGH);
  digitalWrite(AFPin, LOW);
void keepAwake()
    if(millis()-lastAFMillis > AFinterval)
    lastAFMillis = millis();
void timeLapse()
  if(millis()-lastShutterMillis > timer)
    lastAFMillis = millis();
    lastShutterMillis = millis();

void setup() {
  // put your setup code here, to run once:
  pinMode(AFPin, OUTPUT);
  pinMode(shutterPin, OUTPUT);
  digitalWrite(AFPin, LOW);
  digitalWrite(shutterPin, LOW);

  myBD = new BlueDentist(9600);
  interval = new BDNumField("int");
  shutter = new BDBTN("snap");

void loop() {
  // put your main code here, to run repeatedly:
  if(shutter->getPresses() >0)
  timer = interval->getVal();
  timer *= 1000;
  if(timer > 0)
 // Serial.print("testing");


  • snapPhoto() just writes high to the shutter release pin, then waits 100 ms and sets it low again
  • runAF() does the same for the autofocus pin
  • keepAwake() checks if nothing has happened for 10 seconds, if so it triggers AF just to keep the camera awake
  • timeLapse() checks if the interval between photos has passed, and if so calls snapPhoto()
  • setup() contains all the code for our bluetooth interface setup, and sets the pinModes for the two output pins
  • loop() checks if the shutter button on the android app has been pressed, and if so shoots a photo, then it calls keepAwake().  It then grabs the current interval from the android app, and if it's not set to 0 it calls timeLapse().  Finally it also runs myBD->run() which is the service function for the bluetooth interface, to keep it updated.