Go Down

Topic: Barrel Jack connectors (Read 451 times) previous topic - next topic

Bertie64

Hi

I have 4 panel mounted barrel jack connectors fitted to my project box.

They need to have pumps or fans connected to them and I would like to use the third pin on the (panel mounted) female connector to communicate with the Arduino to indicate if something is unplugged and throw an error.

The supply to the Barrel jacks is 12V so my first guess is to not connect them directly to the Arduino...

Any pointers?


Thanks

septillion

#1
May 23, 2016, 08:03 pm Last Edit: May 23, 2016, 10:27 pm by septillion
How do you switch the jacks? And are the center positive or (evil!!!!!) center negative?

If you use center negative positive and you just share the GND of the 5V and the 12V you can connect the 3e pin of the barrel jack straight to the Arduino (and enable internal pullup) because it will then connect to the outer shell which is then GND. Only thin is, then you need to switch high side because you need the GND to be there all the time.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Bertie64

I'm using independent relays to switch the jacks on and off.

The jacks are centre positive.

It looks like there is one pin connected to the centre (positive) and the other two pins are connected to negative depending on whether the plug is inserted or not.

You say "If you use centre negative" do you mean centre positive?  It looks like I am using centre positive and the outer shell is, as you say, connected to ground...

So am I good to just hook it up to the pins on the Arduino?

Thanks for the quick reply.


Bertie64

Just to infill a little...

I have repurposed an old computer PSU to effectively give me a 12V and 5V rail.

I'm using the 5V to power some fans and switch a couple of latching solenoid valves.

I'm using the 12V for some indicator lights and to power a fan and three pumps.  The fan and pumps are switched on and off by relays with the hot side from the 12V supply going through the relay.

The Arduino itself is powered from the 12V rail (currently at 8V via a step-down converter, not sure if this is necessary but I originally wanted to use the Vin pin so I just left it like that).

Everything comes in via the PSU.

Only one pump is on at any one time.

What I would like to do is to have a check after the Arduino is booted up to make sure everything is plugged in.  But I need to do this without actually switching the pumps on.

Sorry if this is a bit naive.  I think I have a reasonable handle on coding the Arduino  and writing basic libraries, but I'm trying to learn the electronics side of things as I go along (preferably without blowing too many things up...)

Everything works so far and this part is really not 100% necessary.  I just figured if its possible I might as well try and do it, and maybe learn something new along the way....

septillion

#4
May 23, 2016, 10:34 pm Last Edit: May 24, 2016, 10:42 am by septillion
Of course I mean center positive! Stupid me ::) Center negative is just pure evil.

Then you have the right setup! It's all fine :) The Arduino power and jack power already share the GND (because a ATX PSU only has one GND) and if you use relays it's easy to switch the high side (aka 12V).

Now all you need to do is find the right pins on the barrel jack. One is the real connection to the shell/barrel of the plug inserted. The 3th connection is connected to that while there is no plug insered and gets disconnected when a plug is inserted. So that's basically a switch to GND. So just like a normal switch, connect it to the Arduino and use the internal pull up and you're good to go.
Connected to GND = LOW = No plug
Open = HIGH (because of pull up) = Plug inserted.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Bertie64

OK, that's all good to know.
I will get on it after another coffee!
 
Thanks.


gpsmikey

Do NOT use the same connectors for 5v and 12v (or other things) - sooner or later, you WILL connect them wrong (in a hurry, dark back there etc.) and let the magic smoke out.  If you MUST use the same connector types for different voltages, at least make sure to paint them different colors to make it more obvious.  I have found a number of ways to let the magic smoke out, but have not yet found a way to get it back in again ...  :o
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3

Paul__B

Just put a 15k resistor between the "back" connection on the jack and the Arduino input pin, using pinMode(pin, INPUT_PULLUP).  This will protect the Arduino from any odd thing that may happen in the process of plugging and unplugging.  15k is much less than the internal pullup, so it will still indicate LOW when nothing is plugged in.

septillion

The connection tap of a barrel jack socket is never in contact with the plug. It only makes contact with the barrel/sleeve/outer contact of the socket itself. So I see no need to add a series resistor. Does not harm either of course but I find 15k pretty high...
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Go Up