Tag Archives: trigger

Maker Wedding: XBee remote relay as photobooth RF camera trigger

XBee Button Relay Photo Trigger RF

If I didn’t have XBee’s kicking around from some other fanciful endeavour I probably would’ve purchased an inexpensive Aputure remote trigger for the photobooth at my wedding reception — but instead I decided to make an RF camera trigger system from parts I had around, mainly two XBees and a relay. XBee’s are great little wireless mesh transmitter/receivers, much like Tomax and Xamot what you do to one is instantly reflected by the other, so you need only connect a pin to high on the transmitting XBee and the same pin on the receiving XBee will go high — perfect for remotely triggering a relay.

crimson twins

The plan was to have one XBee with a simple pull-down button which would trigger a relay on the receiving XBee and whaddya know — it worked. The receiver relay was attached to a wired camera remote (Canon TC-80N3) I already had from a previous project which allowed the relay to trigger both a Canon Rebel XT and, after splicing in the original connector, a Canon 5D Mark II.
XBee Button Relay Photo Trigger RF
With this setup, two AA batteries for both the transmitter and receiver lasted for days. The only issue I found was that the Rebel XT needed about a 500 millisecond signal whereas the 5D Mark II would trigger instantly on a contact of any duration, I thought about a capacitor, timed-delay relay or 555 solution to keep the relay open longer, but never got around to implementing any solution — after all the 5D would capture the shot if not both cameras.

To be honest, this project survived to the night before, but I decided to scrap the photobooth entirely from the wedding reception to reduce complexity — the lighting turned out to be insufficient and, as the groom, I had no time left to deal with the camera setup. That being said, the theory is sound and it worked quite well for days in my living room, taking shot after shot of me and my fiancée lounging on our couch.

xbee-relay

Video: Triggering lights with guitar frequency levels

EQTrigger

Had an idea after catching this post on Hack a Day, why not use the frequency level values to trip a 120 volt relay? So I ordered some parts and did it. The audio analyzing chip, the MSGEQ7, is easily accessed using DFRobot’s DFR0126, which, being in Canada, I got from RobotShop. Connecting the breakout board to an Arduino Nano was a 5 minute job, sample code and a library is linked from the DFRobot product page. I initially used a potentiometer to input the threshold levels for the relay, but then realized I could use a momentary switch to sample the desired threshold and then use that to compare the real-time input to.

The circuit is simple, when a button (momentary stomp) is depressed, and we all get depressed sometimes, the code saves the input values from the audio analyzer. There are seven frequency bands it records, but I found only three or four of them are applicable to guitar, so ignore the lowest and perhaps the highest two. After a threshold has been recorded simply check the input against the recorded levels and trip the relay (or not).

I gave the thresholds a grace of 5 (on a theoretical input range of 0-1023), I may add a pot for this adjustment as it may vary based on guitar signal types. The result is quite versatile, you could have the relay turn off a mellow light and turn on a spastic light when the signal goes loud. If you pay close enough attention to EQ bands and levels you could trigger various lights based on a variety of guitar effects. This setup would also allow, albeit in a roundabout way, you to engage a guitar effect based on the frequency band levels, as long as the effect will pass-through without power then connecting it to the relay would engage the effect — or you could redesign this circuit to route some audio signals based on the input levels.


The pedal I stomp in the video is the MP-1 fuzz from Inductor Guitars, the EQTrigger pedal is connected to the extra output on a Boss TU-2 tuner and is reacting auto-magically to the change in guitar signal when I play louder or engage the fuzz.



Parts List

eqtrigger
Okay, so I didn’t spend a lot of time working out a clean circuit diagram — at least I didn’t use as much electrical tape in the diagram.

Arduino Sketch


#include <AudioAnalyzer.h>
Analyzer Audio = Analyzer(4,5,0);

int FreqVal[7];
int FreqThreshVal[7];

int switchPin = 3;
int switchValue = 0;

int relayPin = 2;

void setup()
{
  pinMode(relayPin, OUTPUT);
  pinMode(switchPin, INPUT);

  for(int i=0;i<7;i++)
    FreqThreshVal[i] = 512;

  //Serial.begin(57600);
  Audio.Init();
}

void loop()
{
  Audio.ReadFreq(FreqVal);//return 7 value of 7 bands pass filiter
                          //Frequency(Hz):63  160  400  1K  2.5K  6.25K  16K
                          //FreqVal[]:      0    1    2    3    4    5    6  

  switchValue = digitalRead(switchPin);  

  if(switchValue == HIGH)
  {
    for(int i=1;i<5;i++)
    {
       FreqThreshVal[i] = FreqVal[i];
       /*
       Serial.print(max((FreqVal[i]-100),0));

       if(i<6)
        Serial.print(",");
       else
        Serial.println(" SET ");
        */
    }
  }
  else
  {
    boolean thresholdMet = true;

    for(int i=1;i<5;i++)
    {
       //Serial.print(max((FreqVal[i]-100),0));

       if(FreqVal[i] < FreqThreshVal[i]-5)
         thresholdMet = false;

       /*
       if(i<6)
         Serial.print(",");
       else
         Serial.println(" READ ");
         */
    }  

    if(thresholdMet == true)
    {
      //Serial.println(" MET ");
      digitalWrite(relayPin, HIGH);
    }
    else
    {
      digitalWrite(relayPin, LOW);
    }
  }
}