Two Position Foot Pedal Shutter

by keebie81 in Circuits > Cameras

1186 Views, 10 Favorites, 0 Comments

Two Position Foot Pedal Shutter

Main.jpg

I have always wanted to have a foot pedal operated camera shutter. But all solutions I saw only had one trigger. Using a foot pedal with potentiometer I can set a half press for focus and full press to take the picture.

As the foot pedal is pressed the resistance changes and the voltage read by the board changes. Using this information we can set ranges for different actions to happen.

Supplies

Foot Pedal with Potentiometer (Adafruit)

Adafruit Feather RP2040 (Adafruit)

3 - 1k resistor (Adafruit)

Panel Mount 1/8 / 3.5mm Audio Jack (Adafruit)

Toggle Switch (Adafruit)

Adafruit Perma-Proto Half-sized Breadboard PCB (Adafruit)

Optional - Lithium Ion Polymer Battery - 3.7v 500mAh (Adafruit)

Header kit for Feather (Adafruit)

Silicone Cover Stranded-Core Wire (Adafruit)

2.5mm Audio cable with bare wire open end (Amazon - Affiliate link) (Digikey)

2 - 4N35 Octocoupler - (Amazon - Affiliate link pack of 20) (Digikey)

How It Works

trs.jpg

I am using this with my Canon camera. For my camera when Tip is grounded to sleeve the camera takes a picture. When ring is grounded to sleeve the camera focuses. I have included an image of an audio jack and the labeling for tip, ring, sleeve.

The way I have designed the foot pedal to operate is as follows.

When the pedal is partly pressed it starts to count to three. With each count it blinks red to let you know pedal is partly pressed. Once it reaches 3 it blinks white and focuses the camera. You can stop pressing pedal anytime before it reaches three to stop counting and start count over.

If it notices a full pedal press it will blink green and take a photo. Depending on camera settings this may only happen if camera is focused.

Circuit Diagram


I used Fritzing to create the wiring. I have found it helps me document the circuit before moving from breadboard to permanent solution.

Programming Language

This project uses CircuitPython for the code. More information can be found at the following links.

Adafruit Welcome To CircuitPython - https://learn.adafruit.com/welcome-to-circuitpython

CircuitPython - https://circuitpython.org/

Feather RP2040 CircuitPython - https://circuitpython.org/board/adafruit_feather_rp2040/

Setting Foot Pedal Range

serial output.jpg

Different pedals may have a different resistance range. The code below will output to a serial monitor the value it is reading for the pedal at current position.

import time
import board
import analogio
import digitalio
import neopixel

led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
led.value = True #Turn led on so we know when device is on
potentiometer = analogio.AnalogIn(board.A0) #Foot Pedal potentiometer

while True:
    print(potentiometer.value)
    time.sleep(0.25)


Some of the values I got while the pedal was not being pressed was 3488, 3408, 3008, 3392, 3760, 3536, 2848.

When I pressed the pedal partly I got 6336, 6352, 6576, 7456, 7184, 7200, 6800.

For the range in the code I then used 5000 - 8000 for half press. If you set minimum too low you may get false triggers. Same with if range is too small you might not register foot presses.

while potentiometer.value < 8000 and potentiometer.value > 5000:  #Half press of foot pedal

For full press I added a buffer from previous values and used 9000

if potentiometer.value > 9000: #Full press of foot pedal

Code

import time
import board
import analogio
import digitalio
import neopixel


led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
led.value = True #Turn led on so we know when device is on

pixel = neopixel.NeoPixel(board.NEOPIXEL, 1) #Onboard neopixel
pixel.brightness = 0.3

potentiometer = analogio.AnalogIn(board.A0) #Foot Pedal potentiometer

shutter = digitalio.DigitalInOut(board.D25)
shutter.direction = digitalio.Direction.OUTPUT

focus = digitalio.DigitalInOut(board.D24)
focus.direction = digitalio.Direction.OUTPUT

shutter.value = True
focus.value = True

while True:

    timer = 0
    
    if potentiometer.value > 9000: #Full press of foot pedal
        print("picture")
        shutter.value = False
        pixel.fill((0, 255, 0))
        time.sleep(1)
        shutter.value = True
        pixel.fill((0, 0, 0))

    while potentiometer.value < 8000 and potentiometer.value > 5000: #Half press of foot pedal
	    if timer >= 3: #Starts focusing camera after beign pressed for short time
            print("focus")
            focus.value = False
            pixel.fill((255, 255, 255)) #Turn Neopixel white
            time.sleep(0.5)
            focus.value = True
            pixel.fill((0, 0, 0)) #Neopixel off

        print(potentiometer.value)
        pixel.fill((255, 0, 0))
        time.sleep(0.25)
        pixel.fill((0, 0, 0))
        time.sleep(0.25)
        timer = timer + 1
        print(timer)

Downloads

Enclosure

Every good project needs an enclosure. Luckily the folks at Adafruit already designed an enclosure that I could use. The enclosure they designed can be downloaded at the following link. Perma-Proto Feather Case

The parts I used were bottom-cover-halfsize.stl, top-cover-halfsize.stl, and case-switch-jack-halfsize.stl (Modified)

On the case file I had to reduce the hole on one side for the panel mount audio jack. The modified file is included below.

Part Choices

For this project I used the Adafruit Feather RP2040 because it has built in lipo battery charger and connector. This allows me to easily use on battery power and have one less cable in my way. Also by wiring a toggle switch from enable to ground you can have an easy on off switch.

I also used 4N35 optocouplers to prevent damage to my camera. Optocouplers prevent voltage from circuit going to the camera. For the shutter to work I just need to ground the tip connector to sleeve. For focus it needs ring grounded to tip.

Final Thoughts

I think this came out well. This has been a project I have wanted to complete for quite some time. I had purchased the foot pedal in 2018. This was also my first time getting to use an optocoupler, since they came in a pack of 20 I need to come up with some more projects for them. Let me know in comments if you have any suggestions for them.

I hope I explained this well enough to allow the project to be recreated. If there's something I didn't explain or you need more clarification just let me know in the comments and I will try to answer it.