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 flashArduino NanoNPN TransistorUSB Mini BBreadboardJumpers

Software

Arduino IDEUSB 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 collectord3 => Transistor baseTransistor emitter => PC cable aPC 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. 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’)

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.