Willpiam
Posts: 27
Joined: Thu Feb 26, 2015 11:16 pm

Headphone jack as input

Thu Apr 14, 2016 10:05 pm

Hello everyone my name is William and I've started a new rip project.
I'm trying to make a camera. Yes it's been done before but I figured it would be an intresting project to try. Once I have it working I'll be trying to get it as compact as posable maybe even using one of those fancy new raspberry Pi zeros.
Anyway the project requires some form of input for Python to know when to take a picture. I was doing some thinking and came up with the idea of using a headphone wire with a play/pause butten to do this job. I was wondering if anyone knows if this is even posable and if it's been done before. thanks in advance, William

User avatar
mikronauts
Posts: 2783
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Headphone jack as input

Thu Apr 14, 2016 10:14 pm

Not possible to use the headphone jack.

Use one of the GPIO pins, wired as follows:

3.3V -----/\/\/\/\/---------> GPIO <--------(switch)----/\/\/\/\/\/------- GND

The resistor connected between 3.3V and the GPIO should be 10k ohms

The resistor between GND and the far side of the switch should be 470 ohms

Edit: removed second switch
Willpiam wrote:Hello everyone my name is William and I've started a new rip project.
I'm trying to make a camera. Yes it's been done before but I figured it would be an intresting project to try. Once I have it working I'll be trying to get it as compact as posable maybe even using one of those fancy new raspberry Pi zeros.
Anyway the project requires some form of input for Python to know when to take a picture. I was doing some thinking and came up with the idea of using a headphone wire with a play/pause butten to do this job. I was wondering if anyone knows if this is even posable and if it's been done before. thanks in advance, William
Last edited by mikronauts on Thu Apr 14, 2016 10:53 pm, edited 2 times in total.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

Willpiam
Posts: 27
Joined: Thu Feb 26, 2015 11:16 pm

Re: Headphone jack as input

Thu Apr 14, 2016 10:16 pm

Okay. Does it simply not have the right hard wear to acknowledge a butten press from the jack?

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Headphone jack as input

Thu Apr 14, 2016 10:30 pm

Willpiam wrote:Okay. Does it simply not have the right hard wear to acknowledge a butten press from the jack?
William, hi, what PI do you have?

On the 2B and the 3B the 'headphone' jack is not a mic|headphone (with mic button), its a stereo output in combination with a composite video output!

The GPIO block is what you want to learn to program; as mentioned before.
marcus
:ugeek:

klricks
Posts: 7154
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Headphone jack as input

Thu Apr 14, 2016 11:51 pm

Willpiam wrote:Okay. Does it simply not have the right hard wear to acknowledge a butten press from the jack?
Although many headphones can work, the 'headphone jack' on the RPi is not really a headphone jack. It's an AV output similar to the AV output on a camcorder/ digital camera. The RPi audio is 'line out' and is intended to be connected to amplified computer speakers or the red /white audio inputs on a TV or stereo equipment.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

Willpiam
Posts: 27
Joined: Thu Feb 26, 2015 11:16 pm

Re: Headphone jack as input

Fri Apr 15, 2016 12:32 am

The model I have is just the B as far as I know. Eather way it looks like the answer is the same use the gpio pins. looks like I have a trip to the electronics shop in the near future. :D anyway thanks everyone for your awnsers it'll be a neat project.

Return to “General discussion”