DIY Photography

Your one stop shop for everything photo-video

  • News
  • Inspiration
  • Reviews
  • Tutorials
  • DIY
  • Gear
Search

Submit A Story

How to trigger your studio flash from a computer using an Arduino

May 2, 2017 by Josh Beckwith 1 Comment

  • Share
  • Tweet
  • Flipboard
  • WhatsApp

I needed a way to trigger a flash from an Electron app, but there wasn’t anything out there that suited my needs. At first I thought there would be a flash with a simple bluetooth interface, and there is. Unfortunately none of these flashes have a public API, and some even go to the trouble of encrypting their bluetooth messages. What the heck?!

I don’t have much experience with Arduino development, or electronics in general, but the market forced me into it! Fortunately this project is about as simple as it gets. If this is your first time tinkering with Arduino, it’s a good place to start.

Ingredients

Hardware

  • Strobe flash
  • Arduino Nano
  • NPN Transistor
  • USB Mini B
  • Breadboard
  • Jumpers

Software

  • Arduino IDE
  • USB Drivers (you can skip this if you bought an official Arduino board)

Wiring on the breadboard

We need to connect the PC cable to the 5v current, but block it with a transistor so we can control when the flash is triggered.

  • 5v => Transistor collector
  • d3 => Transistor base
  • Transistor emitter => PC cable a
  • PC cable b => gnd

Here’s what that looks like on the breadboard.

I bought the cheap Chinese boards, which don’t come with the pins connected. If you got the same one, you’ll need to solder them on in order to connect it to the breadboard. You only need the side pins, and not the set of 6 on the end.

Strip the wires of your PC cable. I used an exacto knife and my fingernails, but you could also use a wire stripper tool. Double check to make sure you’re cutting the correct end of the cable (NOT the end that plugs into the flash).

Sending and receiving messages

The Arduino Program

Open up the Arduino IDE and paste this program into the editor.

Connect the board to your computer using the USB cable, and upload the program to the board.

void setup() {
  Serial.begin(9600);
  pinMode(3, OUTPUT);
  Serial.println("arduino board is running");
}

void loop() {

  while(Serial.available() > 0){
    int cmd = Serial.read();
    if(cmd == 11){
      digitalWrite(3, HIGH);
      digitalWrite(3, LOW);
      Serial.println("got flash command");
    }
  }
}

We are setting pin 3 as an output (you can use any pin, but I used 3), and checking for the “11” message. I picked 11 arbitrarily. Any number will work. When the command is received, it toggles the voltage on pin 3 from HIGH to LOW. This will allow the 5v current to pass through the transistor, which will trigger the flash.

Why not send a string as a message? For some reason, Arduino has a hard time processing strings sent through the serial port (via Serial.readString()). In my case, it was taking a full second to parse the word “flash.” Sure, using strings in your code will make it more readable, but it’s not worth the latency.

The Node / Electron Program

const serialjs = require(‘serialport-js’)

var port
function start(_port){
  port = _port
  port.on('data', (data) => {console.log('data', data)})
  port.on('error', (err, data) => {console.log('error', err, data)})
}
serialjs.open( '/dev/cu.wchusbserial1420', start, '\n')

// ...later, send a message to trigger the flash

port.send(new Buffer([11]))

Finishing up

After testing everything on the breadboard, I dismantled everything and soldered all of the connections together. I used to hot glue to secure the board inside of a raspberry pi case.

Update

After writing this, a few people have suggested I use an optocoupler in place of the transistor. The transistor actually passes current to the flash, but we don’t actually need that. The circuit just needs to be connected in order to trigger the flash. An optocoupler will do that without passing any current.

With that in mind, it might also be possible to just connect a digital pin directly to the PC cable. I’ll have to try this out when I find some time.

About the Author

Josh Beckwith started his career as a graphic designer, illustrator and photographer. In his junior year at SCAD, he became obsessed with generative design, which got him into programming graphics. Now he works at Tool of North America, creating commercials, website, VR and installations. He’s also one of the developers responsible for Light Paint Live. You can find out more about Josh and see his work on Positlabs, Codepen and Github. This article was also published here and shared with permission.

 

FIND THIS INTERESTING? SHARE IT WITH YOUR FRIENDS!

  • Share
  • Tweet
  • Flipboard
  • WhatsApp

Related posts:

how to trigger nikon from canon pocket wizard flex tt5 how to trigger canon from nikon pocket wizard flex tt5 tutorial jp danko toronto commercial photographerPocket Wizard Flex TT5: How To Trigger Nikon Flash With Canon or Trigger Canon Flash With Nikon Godox release first iPhone studio portraits using the new A1 flash trigger Test Your Flash Duration With An Arduino And a 50c Diode Default ThumbnailDIY – Universal Sound and Optical Slave Flash Trigger

Filed Under: DIY Tagged With: arduino, flash, Flash Triggers, Josh Beckwith

Guest Author: from diyphotography.net

About Guest Author

We love it when our readers get in touch with us to share their stories. This article was contributed to DIYP by a member of our community. If you would like to contribute an article, please contact us here.

« How to make it as a photographer
Anticipating the moment and seeing the shot before it happens »

Submit A Story

Get our FREE Lighting Book

DIYP lighting book cover

* download requires newsletter signup

Recent Comments

Free Resources

Advanced lighting book

Learn photography

Recent Posts

  • Hands on with the Saramonic WiTalk
  • Another tourist falls off a cliff while taking a selfie
  • Stop doing these dangerous photoshoots
  • Meta launches new Ray-Ban smart glasses despite original’s poor reception
  • First look at Godox new LiteFlow reflector system

Udi Tirosh: from diyphotography.netUdi Tirosh is an entrepreneur, photography inventor, journalist, educator, and writer based in Israel. With over 25 years of experience in the photo-video industry, Udi has built and sold several photography-related brands. Udi has a double degree in mass media communications and computer science.

Alex Baker: from diyphotography.netAlex Baker is a portrait and lifestyle driven photographer based in Valencia, Spain. She works on a range of projects from commercial to fine art and has had work featured in publications such as The Daily Mail, Conde Nast Traveller and El Mundo, and has exhibited work across Europe

David Williams: from diyphotography.netDave Williams is an accomplished travel photographer, writer, and best-selling author from the UK. He is also a photography educator and published Aurora expert. Dave has traveled extensively in recent years, capturing stunning images from around the world in a modified van. His work has been featured in various publications and he has worked with notable brands such as Skoda, EE, Boeing, Huawei, Microsoft, BMW, Conde Nast, Electronic Arts, Discovery, BBC, The Guardian, ESPN, NBC, and many others.

John Aldred: from diyphotography.netJohn Aldred is a photographer with over 20 years of experience in the portrait and commercial worlds. He is based in Scotland and has been an early adopter - and occasional beta tester - of almost every digital imaging technology in that time. As well as his creative visual work, John uses 3D printing, electronics and programming to create his own photography and filmmaking tools and consults for a number of brands across the industry.

Dunja Djudjic: from diyphotography.netDunja Djudjic is a multi-talented artist based in Novi Sad, Serbia. With 15 years of experience as a photographer, she specializes in capturing the beauty of nature, travel, and fine art. In addition to her photography, Dunja also expresses her creativity through writing, embroidery, and jewelry making.

Copyright © DIYPhotography 2006 - 2023 | About | Contact | Advertise | Write for DIYP | Full Disclosure | Privacy Policy