Trigger camera shutter with mach4?

Hi All,

I would like to be able to trigger my Canon 5d mark IV camera at certain points in the g-code, as in when the A-axis hits a certain multiple of a set number of degrees(eg 180, 360, 540…) This would allow my timelapses to have uneven intervals and could create some cool effects where the piece looks like it is standing still while material is being removed, or where a 3d zoetrope animates properly as it is being cut.

I am wondering if there is an efficient way to do this within mach4, and what method of connecting a shutter release to the camera would be easiest to accomplish.

I dont know if any of these are possible, but here are the possible solutions I see:

  1. Use a custom macro inserted into the g-code that sends an instruction to an arduino that then triggers a shutter release.

  2. Constantly send A axis value to arduino somehow, The arduino then decides to release the shutter when within a certain angle range, and waits a certain number of seconds before sending another signal to the shutter release. This option is preferred as I don’t have to modify existing g-code to include macro commands.

I imagine I could rip the cord off of one of these to wire it up to the arduino: https://www.usa.canon.com/shop/p/timer-remote-controller-tc-80n3?color=Black&type=New

Also there is a possibility that someone has hijacked EOS utility in a way that the arduino step could be skipped and the camera could be controlled via usb.

Eager to hear anyone’s thoughts on the easiest way to accomplish something like this.

Both would be pretty easy.

For #2, you would probably have to insert code into the PLC script to read the A axis position and send it out. The first part is pretty straight forward (to me), but the “sending it out” to USB is not simple for me since I haven’t done something like that before.

Also, putting something like that in the PLC code risks causing some instability in mach4, but you never know until you try it.

1 Like

Thanks so much Jim.

I think I figured out a good way through dragonframe, a stop motion software that is able to directly control the camera (as well as a camera slider for moving timelapses). This would let me skip the arduino step and just control via one computer running mach with a “sender” program and one computer running dragonframe with a “listener” program:
https://www.dragonframe.com/ufaqs/using-the-simple-interface-to-receive-notifications-and-send-commands-to-dragonframe-via-serial-or-tcp/

I somehow need to create a bridge between the computer running mach4 and the computer running dragonframe, chatgpt says to do something like this-- no idea how accurate this is:

and on the other pc:

And just for reference this is the sort of cut I am trying to get better timelapses of: https://www.instagram.com/p/C1AP8FAOndM/?hl=en

Cool video!!! Really cool video!!!

Would this work? Edit your G Code file with the “Search and Replace” command in a word processor. When the program reaches the angle where you want to take a photo, you would have added the pause command (G04?) at that point after that line of G Code, then trigger your camera manually then run the program from that point. Just a simple idea. Of course, it is not automated.

1 Like

Thanks! Manual in this method would definitely work – but the one in my example video does 127 A-axis rotations, even if it only takes one frame every pass thats a lot of stopping and starting over 3 hours! I think automated is the only way to go.

You would probably get blisters on your trigger finger with the manual method !!! Post some more photos when you get it all figured out! Time lapse is my favorite camera mode !!!

1 Like

I can’t comment on the Python part, but off the top of my head the Lua part for the PLC script looks good.

I’m really surprised there is enough out there on Mach4 for Chat GPT to do that well. I’m gonna have to start looking into using that.

You’ll get a 50mS refresh rate on the values due to the PLC script if you have it running at the default speed.

And that is a really cool timelapse video.

Jim

1 Like

Thanks- really good to know that its in the right ballpark!

I will update here if I can get any part of it working.

Too bad there aren’t any extra outputs on the breakout board. The shutter cable is literally just a 3 pin connector with ground, focus and shutter. You could connect a relay and tie it to a g-code command. It would be as simple as closing the relay to connect the shutter pin to ground.

You could reconfigure the 120v outlet relays to do it if you aren’t using those.

Yes, that would be great.

Right now I think the usb solution is the best given the opportunity to control a camera slider as well as release the shutter, but I just got the data cable (usb-rs232 null modem -usb) so I haven’t had time to figure out if its going to work yet.

If that method ends up falling through for whatever reason I will definitely look into reconfiguring that relay, I am currently not using it.

I actually think the easiest method would be to put a small trigger on the a-axis like glue on a little piece of metal angle… Then hook up a hall effect switch on a bracket such that every time it passed it took a picture. Then you’re not dependent on Mach at all. Simple Arduino to connect the hall effect sensor to the trigger for a camera. One angle and anytime it past that location it would trigger a photo. Or you could put triggers in multiple locations depending on how you wanted it to look. Hardly any programming. Simple

1 Like

Thats a great idea! That would definitely be the simplest solution for a scenario where the desired rotation angle is periodic around 360 degrees. For the “make this look stationary” scenario it would be perfect.

However for some of these I am going to want an obscure number due to my zoetrope math, e.g. S(n)​=n*29.14° where the desired angle isn’t divisible by 360° given the rotation rate of the turntable I am using/the camera’s framerate for the “after” video.

There’s a simple DC circuit from the breakout board to the relay that fires the relay, just tie in there. Careful with voltages so you don’t fry your camera - it’s 5v or 12v signal, I can’t remember. Modify the post processor to insert an existing relay-on/off macro (M07, M08, M09) at your desired A-axis position.

You wouldn’t even have to touch anything inside the control box. The remote shutter trigger just looks for the shutter pin to connect to the ground pin.

You could literally just connect the ground pin on the remote shutter cable to the hot leg of the relay power input and the shutter pin to the hot leg of the relay power out.

Opening and closing that would trigger the shutter.